IGJSP 1.1.4__tar.gz → 1.1.6__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.4
3
+ Version: 1.1.6
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.4"
7
+ version = "1.1.6"
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]
@@ -3,6 +3,7 @@ import datetime
3
3
  import json
4
4
  import os
5
5
  import pickle
6
+ import random
6
7
  import re
7
8
  from itertools import combinations
8
9
 
@@ -11,11 +12,11 @@ import numpy as np
11
12
 
12
13
  np.set_printoptions(linewidth=np.inf, threshold=np.inf, formatter={"int": lambda x: f"{x}"})
13
14
 
15
+ from importlib.resources import as_file, files
14
16
  from pprint import pprint
15
17
 
16
18
  from scipy.stats import expon, norm, uniform
17
19
 
18
- from importlib.resources import files, as_file
19
20
 
20
21
  def _read_text_resource(rel_path: str, encoding: str = "utf-8") -> str:
21
22
  p = files("IGJSP").joinpath(rel_path)
@@ -183,7 +184,8 @@ class JSP:
183
184
 
184
185
  def _particionate_speed_space(self, speed):
185
186
  energyPer = np.linspace(0.5, 3, speed) if speed > 1 else [1]
186
- timePer = [t(c) for c in energyPer]
187
+ # timePer = [t(c) for c in energyPer]
188
+ timePer = sorted([random.uniform(0, 100)/100 for _ in range(3)])
187
189
  return energyPer, timePer
188
190
 
189
191
  def _generate_standar_operation_cost(self, distribution):
@@ -210,15 +212,18 @@ class JSP:
210
212
  self.ReleaseDueDate[job, machine, 1] = releaseDateTask
211
213
  else:
212
214
  releaseDateTask += np.median(self.ProcessingTime[job, machine, :])
215
+
213
216
  if self.rddd == 1:
214
217
  self.ReleaseDueDate[job] = [initial, int(self._release_due(releaseDateTask, distribution))]
215
218
 
216
219
  def _genProcEnergy(self, job, machine, timePer):
217
- ans = []
218
- for tper in timePer:
219
- time = max(1, self.operationCost[job, machine] * tper)
220
- ans.append((time, max(1, f(time))))
221
- return ans
220
+ # ans = []
221
+ # for tper in timePer:
222
+ # time = max(1, self.operationCost[job, machine] * tper)
223
+ # ans.append((time, max(1, f(time))))
224
+ # ans.append((time, max(1, f(time))))
225
+ timePer = sorted([random.uniform(0, 100)/100 for _ in range(3)])
226
+ return [(round(i*100),round((1-i)*100)) for i in timePer]
222
227
 
223
228
  def _release_due(self, duration, distribution):
224
229
  if distribution == "uniform":
@@ -662,19 +667,17 @@ class JSP:
662
667
  }
663
668
 
664
669
  if t == 1:
665
- replace_data["releaseDate"] = str(data.ReleaseDueDate[:, 0].flatten()).replace(" ",", ")
666
- # replace_data["releaseDate"] = ", ".join(list(map(str,data.ReleaseDueDate[:, 0])))
667
- replace_data["dueDate"] = str(data.ReleaseDueDate[:, 1].flatten()).replace(" ",", ")
668
-
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(", ", " ")
669
672
  elif t == 2:
670
- replace_data["releaseDate"] = str(data.ReleaseDueDate[:,:, 0].flatten()).replace(" ",", ")
671
- replace_data["dueDate"] = str(data.ReleaseDueDate[:, :, 1].flatten()).replace(" ",", ")
673
+ replace_data["releaseDate"] = str(data.ReleaseDueDate[:, :, 0].flatten()).replace(", ", " ")
674
+ replace_data["dueDate"] = str(data.ReleaseDueDate[:, :, 1].flatten()).replace(", ", " ")
672
675
 
673
676
  for job in range(data.numJobs):
674
677
  for i, prioridad in enumerate(range(data.numMchs)):
675
678
  precedence[job, data.Orden[job, prioridad]] = i
676
679
 
677
- replace_data["precedence"] = str(precedence.flatten()).replace(" ", ", ")
680
+ replace_data["precedence"] = str(precedence.flatten()).replace(" ", ",")
678
681
  filedata = _read_text_resource(f"Minizinc/Types/RD/JSP/type{t}.dzn")
679
682
  # with open(f"./Minizinc/Types/RD/JSP/type{t}.dzn", "r", encoding="utf-8") as file:
680
683
  # filedata = file.read()
@@ -1127,8 +1130,9 @@ class Generator:
1127
1130
  jsp_instance = JSP(jobs = jobs, machines = machines)
1128
1131
  case "FJSP":
1129
1132
  jsp_instance = FJSP(jobs = jobs, machines = machines)
1130
-
1133
+ instances = []
1131
1134
  for index in range(1, size + 1):
1135
+
1132
1136
  jsp_instance.fill_random_values(speed = speed, rddd = ReleaseDateDueDate, distribution = distribution, seed = seed,tpm = tpm)
1133
1137
 
1134
1138
  # Determinar el nombre de salida basado en `outputName` y los parámetros actuales
@@ -1162,5 +1166,5 @@ class Generator:
1162
1166
  os.remove(pkl_path)
1163
1167
  if self.taillard:
1164
1168
  jsp_instance.saveTaillardStandardFile(f"{problem_path}/TAILLARD/" + jm_path.split("/")[0] + f"_{j}x{m}_{i}.txt")
1165
-
1166
- return jsp_instance
1169
+ instances.append(jsp_instance)
1170
+ return instances if len(instances) >1 else instances[0]
File without changes
File without changes
File without changes
File without changes