IGJSP 1.1.6__tar.gz → 1.1.7__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.6
3
+ Version: 1.1.7
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.6"
7
+ version = "1.1.7"
8
8
  authors = [
9
9
  { name = "GPS-UPV", email = "gps@dsic.upv.es" },
10
10
  ]
@@ -133,7 +133,7 @@ def _parse_array_generic(text, name):
133
133
 
134
134
  #################################################################################
135
135
  # #
136
- # JSP #
136
+ # JSP #
137
137
  # #
138
138
  #################################################################################
139
139
 
@@ -151,14 +151,17 @@ class JSP:
151
151
  np.random.seed(seed)
152
152
  self.rddd = rddd
153
153
  self.speed = speed
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
-
154
+ #Elimino por que no hace caso del seed. Se tiene que hacer antes de llamar a esta función
155
+ # if not tpm or len(tpm) != self.numMchs:
156
+ # if distribution == "uniform":
157
+ # tpm = np.random.uniform(10, 100, self.numMchs)
158
+ # elif distribution == "normal":
159
+ # tpm = [max(10, data) for data in np.random.normal(50, 20, self.numMchs)]
160
+ # else:
161
+ # tpm = expon(loc=10, scale=20).rvs(self.numMchs)
162
+ energyPer, timePer = self._particionate_speed_space(speed)
163
+ self._generate_standar_operation_cost(distribution,tpm)
164
+
162
165
  energyPer, timePer = self._particionate_speed_space(speed)
163
166
  self._generate_standar_operation_cost(distribution)
164
167
 
@@ -188,13 +191,16 @@ class JSP:
188
191
  timePer = sorted([random.uniform(0, 100)/100 for _ in range(3)])
189
192
  return energyPer, timePer
190
193
 
191
- def _generate_standar_operation_cost(self, distribution):
192
- if distribution == "uniform":
193
- self.operationCost = np.random.uniform(10, 100, (self.numJobs, self.numMchs))
194
- elif distribution == "normal":
195
- 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)
196
- elif distribution == "exponential":
197
- self.operationCost = np.random.exponential(10, (self.numJobs, self.numMchs))
194
+ def _generate_standar_operation_cost(self, distribution,tpm=[]):
195
+ if np.array(tpm).shape != (self.numJobs, self.numMchs):
196
+ if distribution == "uniform":
197
+ self.operationCost = np.random.uniform(10, 100, (self.numJobs, self.numMchs))
198
+ elif distribution == "normal":
199
+ 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)
200
+ elif distribution == "exponential":
201
+ self.operationCost = np.random.exponential(10, (self.numJobs, self.numMchs))
202
+ else:
203
+ self.operationCost = tpm
198
204
 
199
205
  def _jobToMachine(self, release_date_tasks, timePer, distribution):
200
206
  for job in range(self.numJobs):
@@ -667,17 +673,19 @@ class JSP:
667
673
  }
668
674
 
669
675
  if t == 1:
670
- replace_data["releaseDate"] = str([int(data.ReleaseDueDate[job, 0]) for job in range(data.numJobs)]).replace(", ", " ")
671
- replace_data["dueDate"] = str([int(data.ReleaseDueDate[job, 1]) for job in range(data.numJobs)]).replace(", ", " ")
676
+ replace_data["releaseDate"] = str(data.ReleaseDueDate[:, 0].flatten()).replace(" ",", ")
677
+ replace_data["dueDate"] = str(data.ReleaseDueDate[:, 1].flatten()).replace(" ",", ")
678
+
672
679
  elif t == 2:
673
- replace_data["releaseDate"] = str(data.ReleaseDueDate[:, :, 0].flatten()).replace(", ", " ")
674
- replace_data["dueDate"] = str(data.ReleaseDueDate[:, :, 1].flatten()).replace(", ", " ")
680
+ replace_data["releaseDate"] = str(data.ReleaseDueDate[:,:, 0].flatten()).replace(" ",", ")
681
+ replace_data["dueDate"] = str(data.ReleaseDueDate[:, :, 1].flatten()).replace(" ",", ")
675
682
 
676
683
  for job in range(data.numJobs):
677
684
  for i, prioridad in enumerate(range(data.numMchs)):
678
685
  precedence[job, data.Orden[job, prioridad]] = i
679
686
 
680
- replace_data["precedence"] = str(precedence.flatten()).replace(" ", ",")
687
+ replace_data["precedence"] = str(precedence.flatten()).replace(" ", ", ")
688
+
681
689
  filedata = _read_text_resource(f"Minizinc/Types/RD/JSP/type{t}.dzn")
682
690
  # with open(f"./Minizinc/Types/RD/JSP/type{t}.dzn", "r", encoding="utf-8") as file:
683
691
  # filedata = file.read()
@@ -1130,11 +1138,27 @@ class Generator:
1130
1138
  jsp_instance = JSP(jobs = jobs, machines = machines)
1131
1139
  case "FJSP":
1132
1140
  jsp_instance = FJSP(jobs = jobs, machines = machines)
1133
- instances = []
1141
+
1142
+ tpm_aux=[]
1143
+ orden_aux=[]
1144
+ for index in range(1, size + 1):
1145
+ if len(tpm) != machines:
1146
+ if distribution == "uniform":
1147
+ aux = np.random.uniform(10, 100, (jobs, machines))
1148
+ elif distribution == "normal":
1149
+ aux = np.array([max(10, x) for x in np.random.normal(50, 20, (jobs, machines)).reshape(-1)]).reshape(jobs, machines)
1150
+ elif distribution == "exponential":
1151
+ aux = np.random.exponential(10, (jobs, machines))
1152
+ tpm_aux.append(aux)
1153
+
1154
+ orden_aux.append([np.random.choice(range(machines), machines, replace=False) for job in range(jobs)])
1155
+
1156
+ orden_aux = np.array(orden_aux)
1157
+
1134
1158
  for index in range(1, size + 1):
1135
-
1136
- jsp_instance.fill_random_values(speed = speed, rddd = ReleaseDateDueDate, distribution = distribution, seed = seed,tpm = tpm)
1137
1159
 
1160
+ jsp_instance.fill_random_values(speed = speed, rddd = ReleaseDateDueDate, distribution = distribution, seed = seed,tpm = tpm_aux[index-1])
1161
+ jsp_instance.Orden = orden_aux[index-1]
1138
1162
  # Determinar el nombre de salida basado en `outputName` y los parámetros actuales
1139
1163
  problem_path = self.savepath.format(size = size, jobs =jobs, machines = machines, release_due_date = ReleaseDateDueDate, speed_scaling = speed, distribution = distribution, seed=seed)
1140
1164
 
@@ -1166,5 +1190,5 @@ class Generator:
1166
1190
  os.remove(pkl_path)
1167
1191
  if self.taillard:
1168
1192
  jsp_instance.saveTaillardStandardFile(f"{problem_path}/TAILLARD/" + jm_path.split("/")[0] + f"_{j}x{m}_{i}.txt")
1169
- instances.append(jsp_instance)
1170
- return instances if len(instances) >1 else instances[0]
1193
+
1194
+ return jsp_instance
File without changes
File without changes
File without changes
File without changes