IGJSP 1.1.2__tar.gz → 1.1.3__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.
- {igjsp-1.1.2 → igjsp-1.1.3}/PKG-INFO +1 -1
- {igjsp-1.1.2 → igjsp-1.1.3}/pyproject.toml +13 -6
- {igjsp-1.1.2 → igjsp-1.1.3}/src/IGJSP/generador.py +88 -81
- igjsp-1.1.2/.gitattributes +0 -2
- igjsp-1.1.2/.vscode/settings.json +0 -3
- {igjsp-1.1.2 → igjsp-1.1.3}/.gitignore +0 -0
- {igjsp-1.1.2 → igjsp-1.1.3}/LICENSE +0 -0
- {igjsp-1.1.2 → igjsp-1.1.3}/README.md +0 -0
- {igjsp-1.1.2 → igjsp-1.1.3}/src/IGJSP/Minizinc/Models/RD/JSP0.mzn +0 -0
- {igjsp-1.1.2 → igjsp-1.1.3}/src/IGJSP/Minizinc/Models/RD/JSP1.mzn +0 -0
- {igjsp-1.1.2 → igjsp-1.1.3}/src/IGJSP/Minizinc/Models/RD/JSP2.mzn +0 -0
- {igjsp-1.1.2 → igjsp-1.1.3}/src/IGJSP/Minizinc/Types/RD/FJSP/type0.dzn +0 -0
- {igjsp-1.1.2 → igjsp-1.1.3}/src/IGJSP/Minizinc/Types/RD/FJSP/type1.dzn +0 -0
- {igjsp-1.1.2 → igjsp-1.1.3}/src/IGJSP/Minizinc/Types/RD/FJSP/type2.dzn +0 -0
- {igjsp-1.1.2 → igjsp-1.1.3}/src/IGJSP/Minizinc/Types/RD/JSP/type0.dzn +0 -0
- {igjsp-1.1.2 → igjsp-1.1.3}/src/IGJSP/Minizinc/Types/RD/JSP/type1.dzn +0 -0
- {igjsp-1.1.2 → igjsp-1.1.3}/src/IGJSP/Minizinc/Types/RD/JSP/type2.dzn +0 -0
- {igjsp-1.1.2 → igjsp-1.1.3}/src/IGJSP/Minizinc/Types/RD/JSP0.mzn +0 -0
- {igjsp-1.1.2 → igjsp-1.1.3}/src/IGJSP/Minizinc/Types/RD/JSP1.mzn +0 -0
- {igjsp-1.1.2 → igjsp-1.1.3}/src/IGJSP/Minizinc/Types/RD/JSP2.mzn +0 -0
- {igjsp-1.1.2 → igjsp-1.1.3}/src/IGJSP/main.py +0 -0
|
@@ -4,17 +4,17 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "IGJSP"
|
|
7
|
-
version = "1.1.
|
|
7
|
+
version = "1.1.3"
|
|
8
8
|
authors = [
|
|
9
|
-
{ name="GPS-UPV", email="gps@dsic.upv.es" },
|
|
9
|
+
{ name = "GPS-UPV", email = "gps@dsic.upv.es" },
|
|
10
10
|
]
|
|
11
11
|
description = "Instance generator for JSP"
|
|
12
12
|
readme = "README.md"
|
|
13
13
|
requires-python = ">=3.9"
|
|
14
14
|
classifiers = [
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
"Programming Language :: Python :: 3",
|
|
16
|
+
"License :: OSI Approved :: MIT License",
|
|
17
|
+
"Operating System :: OS Independent",
|
|
18
18
|
]
|
|
19
19
|
dependencies = [
|
|
20
20
|
"numpy",
|
|
@@ -26,4 +26,11 @@ dependencies = [
|
|
|
26
26
|
Homepage = "https://gps.blogs.upv.es/"
|
|
27
27
|
|
|
28
28
|
[tool.hatch.build.targets.wheel]
|
|
29
|
-
packages = ["src/IGJSP"
|
|
29
|
+
packages = ["src/IGJSP"]
|
|
30
|
+
|
|
31
|
+
[tool.hatch.build.targets.sdist]
|
|
32
|
+
include = [
|
|
33
|
+
"src/IGJSP/**",
|
|
34
|
+
"README.md",
|
|
35
|
+
"pyproject.toml",
|
|
36
|
+
]
|
|
@@ -15,6 +15,15 @@ from pprint import pprint
|
|
|
15
15
|
|
|
16
16
|
from scipy.stats import expon, norm, uniform
|
|
17
17
|
|
|
18
|
+
from importlib.resources import files, as_file
|
|
19
|
+
|
|
20
|
+
def _read_text_resource(rel_path: str, encoding: str = "utf-8") -> str:
|
|
21
|
+
p = files("IGJSP").joinpath(rel_path)
|
|
22
|
+
if not p.is_file():
|
|
23
|
+
raise FileNotFoundError(
|
|
24
|
+
f"Template Minizinc no encontrado en el paquete: {rel_path}"
|
|
25
|
+
)
|
|
26
|
+
return p.read_text(encoding=encoding)
|
|
18
27
|
|
|
19
28
|
def f(x):
|
|
20
29
|
return int(np.exp(-int(x)/100)*100)
|
|
@@ -628,7 +637,7 @@ class JSP:
|
|
|
628
637
|
with open(path, 'wb') as f:
|
|
629
638
|
pickle.dump(self, f)
|
|
630
639
|
|
|
631
|
-
def saveDznFile(self, InputDir, OutputDir):
|
|
640
|
+
def saveDznFile(self, InputDir, OutputDir,index):
|
|
632
641
|
indexProblema = OutputDir.split("/")[-2]
|
|
633
642
|
OutputDir = "/".join(OutputDir.split("/")[:-2])
|
|
634
643
|
# indexProblema = os.path.basename(os.path.normpath(OutputDir))
|
|
@@ -637,40 +646,41 @@ class JSP:
|
|
|
637
646
|
# print(self.speed)
|
|
638
647
|
# for t in [0, 1, 2]:
|
|
639
648
|
t = data.rddd
|
|
640
|
-
for s in range(1,self.speed+1):
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
649
|
+
# for s in range(1,self.speed+1):
|
|
650
|
+
s = self.speed
|
|
651
|
+
s0, sf, sp = [0,s,1]
|
|
652
|
+
time = data.ProcessingTime[:, :, s0:sf:sp]
|
|
653
|
+
energy = data.EnergyConsumption[:, :, s0:sf:sp]
|
|
654
|
+
precedence = np.full((data.numJobs, data.numMchs), 0)
|
|
655
|
+
|
|
656
|
+
replace_data = {
|
|
657
|
+
"machines": data.numMchs,
|
|
658
|
+
"jobs": data.numJobs,
|
|
659
|
+
"Speed": s,
|
|
660
|
+
"time": str(time.flatten()).replace(" ", ", "),
|
|
661
|
+
"energy": str(energy.flatten()).replace(" ", ", ")
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
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(", ", " ")
|
|
667
|
+
elif t == 2:
|
|
668
|
+
replace_data["releaseDate"] = str(data.ReleaseDueDate[:, :, 0].flatten()).replace(", ", " ")
|
|
669
|
+
replace_data["dueDate"] = str(data.ReleaseDueDate[:, :, 1].flatten()).replace(", ", " ")
|
|
670
|
+
|
|
671
|
+
for job in range(data.numJobs):
|
|
672
|
+
for i, prioridad in enumerate(range(data.numMchs)):
|
|
673
|
+
precedence[job, data.Orden[job, prioridad]] = i
|
|
674
|
+
|
|
675
|
+
replace_data["precedence"] = str(precedence.flatten()).replace(" ", ",")
|
|
676
|
+
filedata = _read_text_resource(f"Minizinc/Types/RD/JSP/type{t}.dzn")
|
|
677
|
+
# with open(f"./Minizinc/Types/RD/JSP/type{t}.dzn", "r", encoding="utf-8") as file:
|
|
678
|
+
# filedata = file.read()
|
|
679
|
+
for k, v in replace_data.items():
|
|
680
|
+
filedata = filedata.replace("{" + k + "}", str(v))
|
|
681
|
+
os.makedirs(f"{OutputDir}/", exist_ok=True)
|
|
682
|
+
with open(f"{OutputDir}/{indexProblema}-{t}-{s}_{index}.dzn", "w+", encoding="utf-8") as new:
|
|
683
|
+
new.write(filedata)
|
|
674
684
|
|
|
675
685
|
def saveTaillardStandardFile(self, path):
|
|
676
686
|
os.makedirs("/".join(path.split("/")[:-1]),exist_ok=True)
|
|
@@ -997,7 +1007,7 @@ class FJSP(JSP):
|
|
|
997
1007
|
|
|
998
1008
|
f.write(json_str)
|
|
999
1009
|
|
|
1000
|
-
def saveDznFile(self, InputDir, OutputDir):
|
|
1010
|
+
def saveDznFile(self, InputDir, OutputDir,index):
|
|
1001
1011
|
indexProblema = OutputDir.split("/")[-2]
|
|
1002
1012
|
OutputDir = "/".join(OutputDir.split("/")[:-2])
|
|
1003
1013
|
# indexProblema = os.path.basename(os.path.normpath(OutputDir))
|
|
@@ -1006,45 +1016,44 @@ class FJSP(JSP):
|
|
|
1006
1016
|
# print(self.speed)
|
|
1007
1017
|
# for t in [0, 1, 2]:
|
|
1008
1018
|
t = data.rddd
|
|
1009
|
-
for s in range(1,self.speed+1):
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
# pickle.dump(new_object, new)
|
|
1019
|
+
# for s in range(1,self.speed+1):
|
|
1020
|
+
s= self.speed
|
|
1021
|
+
s0, sf, sp = [0,s,1]
|
|
1022
|
+
time = data.ProcessingTime[:, :, s0:sf:sp]
|
|
1023
|
+
energy = data.EnergyConsumption[:, :, s0:sf:sp]
|
|
1024
|
+
precedence = np.full((data.numJobs, data.numMchs), 0)
|
|
1025
|
+
|
|
1026
|
+
replace_data = {
|
|
1027
|
+
"machines": data.numMchs,
|
|
1028
|
+
"jobs": data.numJobs,
|
|
1029
|
+
"Speed": s,
|
|
1030
|
+
"time": str(time.flatten()).replace(" ", ", "),
|
|
1031
|
+
"energy": str(energy.flatten()).replace(" ", ", ")
|
|
1032
|
+
}
|
|
1033
|
+
if t == 1:
|
|
1034
|
+
replace_data["releaseDate"] = str([int(data.ReleaseDueDate[job, 0]) for job in range(data.numJobs)]).replace(" ", ",")
|
|
1035
|
+
replace_data["dueDate"] = str([int(data.ReleaseDueDate[job, 1]) for job in range(data.numJobs)]).replace(" ", ",")
|
|
1036
|
+
elif t == 2:
|
|
1037
|
+
replace_data["releaseDate"] = str(data.ReleaseDueDate[:, :, 0].flatten()).replace(" ", ",")
|
|
1038
|
+
replace_data["dueDate"] = str(data.ReleaseDueDate[:, :, 1].flatten()).replace(" ", ",")
|
|
1039
|
+
|
|
1040
|
+
for job in range(data.numJobs):
|
|
1041
|
+
for i, prioridad in enumerate(range(data.numMchs)):
|
|
1042
|
+
precedence[job, data.Orden[job, prioridad]] = i
|
|
1043
|
+
replace_data["precedence"] = str(precedence.flatten()).replace(" ", ",")
|
|
1044
|
+
|
|
1045
|
+
replace_data["available_machines"] = str(data.available_machines.flatten()).replace(" ", ", ")
|
|
1046
|
+
|
|
1047
|
+
# with open(f"./Minizinc/Types/RD/FJSP/type{t}.dzn", "r", encoding="utf-8") as file:
|
|
1048
|
+
# filedata = file.read()
|
|
1049
|
+
filedata = _read_text_resource(f"Minizinc/Types/RD/FJSP/type{t}.dzn")
|
|
1050
|
+
for kk, v in replace_data.items():
|
|
1051
|
+
filedata = filedata.replace("{" + kk + "}", str(v))
|
|
1052
|
+
|
|
1053
|
+
os.makedirs(f"{OutputDir}/", exist_ok=True)
|
|
1054
|
+
|
|
1055
|
+
with open(f"{OutputDir}/{indexProblema}-{t}-{s}_{index}.dzn", "w+", encoding="utf-8") as new:
|
|
1056
|
+
new.write(filedata)
|
|
1048
1057
|
|
|
1049
1058
|
def saveTaillardStandardFile(self, path):
|
|
1050
1059
|
os.makedirs("/".join(path.split("/")[:-1]),exist_ok=True)
|
|
@@ -1116,14 +1125,12 @@ class Generator:
|
|
|
1116
1125
|
jsp_instance = JSP(jobs = jobs, machines = machines)
|
|
1117
1126
|
case "FJSP":
|
|
1118
1127
|
jsp_instance = FJSP(jobs = jobs, machines = machines)
|
|
1119
|
-
|
|
1128
|
+
|
|
1120
1129
|
for index in range(1, size + 1):
|
|
1121
|
-
|
|
1122
1130
|
jsp_instance.fill_random_values(speed = speed, rddd = ReleaseDateDueDate, distribution = distribution, seed = seed,tpm = tpm)
|
|
1123
1131
|
|
|
1124
1132
|
# Determinar el nombre de salida basado en `outputName` y los parámetros actuales
|
|
1125
|
-
problem_path = self.savepath.format(size = size, jobs =jobs, machines = machines, release_due_date = ReleaseDateDueDate,
|
|
1126
|
-
speed_scaling = speed, distribution = distribution, seed=seed)
|
|
1133
|
+
problem_path = self.savepath.format(size = size, jobs =jobs, machines = machines, release_due_date = ReleaseDateDueDate, speed_scaling = speed, distribution = distribution, seed=seed)
|
|
1127
1134
|
|
|
1128
1135
|
if not (self.json or self.dzn or self.taillard): return jsp_instance
|
|
1129
1136
|
|
|
@@ -1139,7 +1146,7 @@ class Generator:
|
|
|
1139
1146
|
if self.dzn:
|
|
1140
1147
|
pkl_path = f"{problem_path}/" + jm_path.split("/")[0] + f"_{j}x{m}_{i}.pkl"
|
|
1141
1148
|
jsp_instance.savePythonFile(pkl_path)
|
|
1142
|
-
jsp_instance.saveDznFile(pkl_path, problem_path + jm_path)#f"{j}x{m}_{i}")
|
|
1149
|
+
jsp_instance.saveDznFile(pkl_path, problem_path + jm_path,index)#f"{j}x{m}_{i}")
|
|
1143
1150
|
os.remove(pkl_path)
|
|
1144
1151
|
if self.taillard:
|
|
1145
1152
|
jsp_instance.saveTaillardStandardFile(problem_path + jm_path.split("/")[0] + f"_{j}x{m}_{i}.txt")
|
|
@@ -1149,7 +1156,7 @@ class Generator:
|
|
|
1149
1156
|
if self.dzn:
|
|
1150
1157
|
pkl_path = f"{problem_path}/" + jm_path.split("/")[0] + f"_{j}x{m}_{i}.pkl"
|
|
1151
1158
|
jsp_instance.savePythonFile(pkl_path)
|
|
1152
|
-
jsp_instance.saveDznFile(pkl_path,f"{problem_path}/DZN/" + jm_path)#f"{j}x{m}_{i}")
|
|
1159
|
+
jsp_instance.saveDznFile(pkl_path,f"{problem_path}/DZN/" + jm_path,index)#f"{j}x{m}_{i}")
|
|
1153
1160
|
os.remove(pkl_path)
|
|
1154
1161
|
if self.taillard:
|
|
1155
1162
|
jsp_instance.saveTaillardStandardFile(f"{problem_path}/TAILLARD/" + jm_path.split("/")[0] + f"_{j}x{m}_{i}.txt")
|
igjsp-1.1.2/.gitattributes
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|