IGJSP 1.1.0__tar.gz → 1.1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: IGJSP
3
- Version: 1.1.0
3
+ Version: 1.1.1
4
4
  Summary: Instance generator for JSP
5
5
  Project-URL: Homepage, https://gps.blogs.upv.es/
6
6
  Author-email: GPS-UPV <gps@dsic.upv.es>
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "IGJSP"
7
- version = "1.1.0"
7
+ version = "1.1.1"
8
8
  authors = [
9
9
  { name="GPS-UPV", email="gps@dsic.upv.es" },
10
10
  ]
@@ -26,6 +26,42 @@ def t(c):
26
26
  return 4.0704 * np.log(2) / np.log(1 + (c* 2.5093)**3)
27
27
 
28
28
 
29
+ # ------- Helpers internos para el DZN -------
30
+
31
+ def _parse_int_var(text, name, default=None):
32
+ """
33
+ Busca una variable escalar tipo: name = 10;
34
+ """
35
+ m = re.search(rf'\b{name}\b\s*=\s*([0-9]+)', text)
36
+ if m:
37
+ return int(m.group(1))
38
+ if default is not None:
39
+ return default
40
+ raise ValueError(f"No se encontró la variable entera '{name}' en el fichero DZN.")
41
+
42
+
43
+ def _parse_array_var(text, name):
44
+ """
45
+ Busca una variable array tipo:
46
+ name = [1, 2, 3];
47
+ o
48
+ name = [1 2 3];
49
+ Devuelve un np.array de ints o None si no está.
50
+ """
51
+ m = re.search(rf'\b{name}\b\s*=.*?\[(.*?)\];', text, re.DOTALL)
52
+ if not m:
53
+ return None
54
+
55
+ inner = m.group(1).strip()
56
+ if not inner:
57
+ return np.array([], dtype=int)
58
+
59
+ # Separar por comas o espacios
60
+ tokens = re.split(r'[\s,]+', inner)
61
+ tokens = [t for t in tokens if t != '']
62
+
63
+ return np.array([int(t) for t in tokens], dtype=int)
64
+
29
65
  #################################################################################
30
66
  # #
31
67
  # JSP #
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes