IGJSP 1.1.3__tar.gz → 1.1.5__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.3
3
+ Version: 1.1.5
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>
@@ -11,7 +11,6 @@ Classifier: Programming Language :: Python :: 3
11
11
  Requires-Python: >=3.9
12
12
  Requires-Dist: numpy
13
13
  Requires-Dist: scipy
14
- Requires-Dist: tqdm
15
14
  Description-Content-Type: text/markdown
16
15
 
17
16
  # Instance Generator for JSP & FJSP (Energy‑aware)
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "IGJSP"
7
- version = "1.1.3"
7
+ version = "1.1.5"
8
8
  authors = [
9
9
  { name = "GPS-UPV", email = "gps@dsic.upv.es" },
10
10
  ]
@@ -18,8 +18,7 @@ classifiers = [
18
18
  ]
19
19
  dependencies = [
20
20
  "numpy",
21
- "scipy",
22
- "tqdm",
21
+ "scipy"
23
22
  ]
24
23
 
25
24
  [project.urls]
@@ -150,17 +150,17 @@ class JSP:
150
150
  np.random.seed(seed)
151
151
  self.rddd = rddd
152
152
  self.speed = speed
153
- if not tpm or len(tpm) != self.numMchs:
154
- if distribution == "uniform":
155
- tpm = np.random.uniform(10, 100, self.numMchs)
156
- elif distribution == "normal":
157
- tpm = [max(10, data) for data in np.random.normal(50, 20, self.numMchs)]
158
- else:
159
- tpm = expon(loc=10, scale=20).rvs(self.numMchs)
160
-
153
+ #Elimino por que no hace caso del seed. Se tiene que hacer antes de llamar a esta función
154
+ # if not tpm or len(tpm) != self.numMchs:
155
+ # if distribution == "uniform":
156
+ # tpm = np.random.uniform(10, 100, self.numMchs)
157
+ # elif distribution == "normal":
158
+ # tpm = [max(10, data) for data in np.random.normal(50, 20, self.numMchs)]
159
+ # else:
160
+ # tpm = expon(loc=10, scale=20).rvs(self.numMchs)
161
161
  energyPer, timePer = self._particionate_speed_space(speed)
162
- self._generate_standar_operation_cost(distribution)
163
-
162
+ self._generate_standar_operation_cost(distribution,tpm)
163
+
164
164
  self.ProcessingTime = np.zeros((self.numJobs, self.numMchs, self.speed), dtype=int)
165
165
  self.EnergyConsumption = np.zeros((self.numJobs, self.numMchs, self.speed), dtype=int)
166
166
  self.Orden = np.zeros((self.numJobs, self.numMchs), dtype=int)
@@ -186,13 +186,16 @@ class JSP:
186
186
  timePer = [t(c) for c in energyPer]
187
187
  return energyPer, timePer
188
188
 
189
- def _generate_standar_operation_cost(self, distribution):
190
- if distribution == "uniform":
191
- self.operationCost = np.random.uniform(10, 100, (self.numJobs, self.numMchs))
192
- elif distribution == "normal":
193
- self.operationCost = np.array([max(10, x) for x in np.random.normal(50, 20, (self.numJobs, self.numMchs)).reshape(-1)]).reshape(self.numJobs, self.numMchs)
194
- elif distribution == "exponential":
195
- self.operationCost = np.random.exponential(10, (self.numJobs, self.numMchs))
189
+ def _generate_standar_operation_cost(self, distribution,tpm=[]):
190
+ if np.array(tpm).shape != (self.numJobs, self.numMchs):
191
+ if distribution == "uniform":
192
+ self.operationCost = np.random.uniform(10, 100, (self.numJobs, self.numMchs))
193
+ elif distribution == "normal":
194
+ self.operationCost = np.array([max(10, x) for x in np.random.normal(50, 20, (self.numJobs, self.numMchs)).reshape(-1)]).reshape(self.numJobs, self.numMchs)
195
+ elif distribution == "exponential":
196
+ self.operationCost = np.random.exponential(10, (self.numJobs, self.numMchs))
197
+ else:
198
+ self.operationCost = tpm
196
199
 
197
200
  def _jobToMachine(self, release_date_tasks, timePer, distribution):
198
201
  for job in range(self.numJobs):
@@ -212,6 +215,7 @@ class JSP:
212
215
  releaseDateTask += np.median(self.ProcessingTime[job, machine, :])
213
216
  if self.rddd == 1:
214
217
  self.ReleaseDueDate[job] = [initial, int(self._release_due(releaseDateTask, distribution))]
218
+
215
219
 
216
220
  def _genProcEnergy(self, job, machine, timePer):
217
221
  ans = []
@@ -662,17 +666,19 @@ class JSP:
662
666
  }
663
667
 
664
668
  if t == 1:
665
- replace_data["releaseDate"] = str([int(data.ReleaseDueDate[job, 0]) for job in range(data.numJobs)]).replace(", ", " ")
666
- replace_data["dueDate"] = str([int(data.ReleaseDueDate[job, 1]) for job in range(data.numJobs)]).replace(", ", " ")
669
+ replace_data["releaseDate"] = str(data.ReleaseDueDate[:, 0].flatten()).replace(" ",", ")
670
+ # replace_data["releaseDate"] = ", ".join(list(map(str,data.ReleaseDueDate[:, 0])))
671
+ replace_data["dueDate"] = str(data.ReleaseDueDate[:, 1].flatten()).replace(" ",", ")
672
+
667
673
  elif t == 2:
668
- replace_data["releaseDate"] = str(data.ReleaseDueDate[:, :, 0].flatten()).replace(", ", " ")
669
- replace_data["dueDate"] = str(data.ReleaseDueDate[:, :, 1].flatten()).replace(", ", " ")
674
+ replace_data["releaseDate"] = str(data.ReleaseDueDate[:,:, 0].flatten()).replace(" ",", ")
675
+ replace_data["dueDate"] = str(data.ReleaseDueDate[:, :, 1].flatten()).replace(" ",", ")
670
676
 
671
677
  for job in range(data.numJobs):
672
678
  for i, prioridad in enumerate(range(data.numMchs)):
673
679
  precedence[job, data.Orden[job, prioridad]] = i
674
680
 
675
- replace_data["precedence"] = str(precedence.flatten()).replace(" ", ",")
681
+ replace_data["precedence"] = str(precedence.flatten()).replace(" ", ", ")
676
682
  filedata = _read_text_resource(f"Minizinc/Types/RD/JSP/type{t}.dzn")
677
683
  # with open(f"./Minizinc/Types/RD/JSP/type{t}.dzn", "r", encoding="utf-8") as file:
678
684
  # filedata = file.read()
@@ -1125,10 +1131,27 @@ class Generator:
1125
1131
  jsp_instance = JSP(jobs = jobs, machines = machines)
1126
1132
  case "FJSP":
1127
1133
  jsp_instance = FJSP(jobs = jobs, machines = machines)
1134
+
1135
+ tpm_aux=[]
1136
+ orden_aux=[]
1137
+ for index in range(1, size + 1):
1138
+ if len(tpm) != machines:
1139
+ if distribution == "uniform":
1140
+ aux = np.random.uniform(10, 100, (jobs, machines))
1141
+ elif distribution == "normal":
1142
+ aux = np.array([max(10, x) for x in np.random.normal(50, 20, (jobs, machines)).reshape(-1)]).reshape(jobs, machines)
1143
+ elif distribution == "exponential":
1144
+ aux = np.random.exponential(10, (jobs, machines))
1145
+ tpm_aux.append(aux)
1146
+
1147
+ orden_aux.append([np.random.choice(range(machines), machines, replace=False) for job in range(jobs)])
1148
+
1149
+ orden_aux = np.array(orden_aux)
1128
1150
 
1129
1151
  for index in range(1, size + 1):
1130
- jsp_instance.fill_random_values(speed = speed, rddd = ReleaseDateDueDate, distribution = distribution, seed = seed,tpm = tpm)
1131
1152
 
1153
+ jsp_instance.fill_random_values(speed = speed, rddd = ReleaseDateDueDate, distribution = distribution, seed = seed,tpm = tpm_aux[index-1])
1154
+ jsp_instance.Orden = orden_aux[index-1]
1132
1155
  # Determinar el nombre de salida basado en `outputName` y los parámetros actuales
1133
1156
  problem_path = self.savepath.format(size = size, jobs =jobs, machines = machines, release_due_date = ReleaseDateDueDate, speed_scaling = speed, distribution = distribution, seed=seed)
1134
1157
 
File without changes
File without changes
File without changes
File without changes