IGJSP 1.1.2__tar.gz → 1.1.4__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.4}/PKG-INFO +1 -1
- {igjsp-1.1.2 → igjsp-1.1.4}/pyproject.toml +13 -6
- {igjsp-1.1.2 → igjsp-1.1.4}/src/IGJSP/generador.py +90 -81
- igjsp-1.1.2/.gitattributes +0 -2
- igjsp-1.1.2/.vscode/settings.json +0 -3
- {igjsp-1.1.2 → igjsp-1.1.4}/.gitignore +0 -0
- {igjsp-1.1.2 → igjsp-1.1.4}/LICENSE +0 -0
- {igjsp-1.1.2 → igjsp-1.1.4}/README.md +0 -0
- {igjsp-1.1.2 → igjsp-1.1.4}/src/IGJSP/Minizinc/Models/RD/JSP0.mzn +0 -0
- {igjsp-1.1.2 → igjsp-1.1.4}/src/IGJSP/Minizinc/Models/RD/JSP1.mzn +0 -0
- {igjsp-1.1.2 → igjsp-1.1.4}/src/IGJSP/Minizinc/Models/RD/JSP2.mzn +0 -0
- {igjsp-1.1.2 → igjsp-1.1.4}/src/IGJSP/Minizinc/Types/RD/FJSP/type0.dzn +0 -0
- {igjsp-1.1.2 → igjsp-1.1.4}/src/IGJSP/Minizinc/Types/RD/FJSP/type1.dzn +0 -0
- {igjsp-1.1.2 → igjsp-1.1.4}/src/IGJSP/Minizinc/Types/RD/FJSP/type2.dzn +0 -0
- {igjsp-1.1.2 → igjsp-1.1.4}/src/IGJSP/Minizinc/Types/RD/JSP/type0.dzn +0 -0
- {igjsp-1.1.2 → igjsp-1.1.4}/src/IGJSP/Minizinc/Types/RD/JSP/type1.dzn +0 -0
- {igjsp-1.1.2 → igjsp-1.1.4}/src/IGJSP/Minizinc/Types/RD/JSP/type2.dzn +0 -0
- {igjsp-1.1.2 → igjsp-1.1.4}/src/IGJSP/Minizinc/Types/RD/JSP0.mzn +0 -0
- {igjsp-1.1.2 → igjsp-1.1.4}/src/IGJSP/Minizinc/Types/RD/JSP1.mzn +0 -0
- {igjsp-1.1.2 → igjsp-1.1.4}/src/IGJSP/Minizinc/Types/RD/JSP2.mzn +0 -0
- {igjsp-1.1.2 → igjsp-1.1.4}/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.4"
|
|
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,43 @@ 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(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
|
+
|
|
669
|
+
elif t == 2:
|
|
670
|
+
replace_data["releaseDate"] = str(data.ReleaseDueDate[:,:, 0].flatten()).replace(" ",", ")
|
|
671
|
+
replace_data["dueDate"] = str(data.ReleaseDueDate[:, :, 1].flatten()).replace(" ",", ")
|
|
672
|
+
|
|
673
|
+
for job in range(data.numJobs):
|
|
674
|
+
for i, prioridad in enumerate(range(data.numMchs)):
|
|
675
|
+
precedence[job, data.Orden[job, prioridad]] = i
|
|
676
|
+
|
|
677
|
+
replace_data["precedence"] = str(precedence.flatten()).replace(" ", ", ")
|
|
678
|
+
filedata = _read_text_resource(f"Minizinc/Types/RD/JSP/type{t}.dzn")
|
|
679
|
+
# with open(f"./Minizinc/Types/RD/JSP/type{t}.dzn", "r", encoding="utf-8") as file:
|
|
680
|
+
# filedata = file.read()
|
|
681
|
+
for k, v in replace_data.items():
|
|
682
|
+
filedata = filedata.replace("{" + k + "}", str(v))
|
|
683
|
+
os.makedirs(f"{OutputDir}/", exist_ok=True)
|
|
684
|
+
with open(f"{OutputDir}/{indexProblema}-{t}-{s}_{index}.dzn", "w+", encoding="utf-8") as new:
|
|
685
|
+
new.write(filedata)
|
|
674
686
|
|
|
675
687
|
def saveTaillardStandardFile(self, path):
|
|
676
688
|
os.makedirs("/".join(path.split("/")[:-1]),exist_ok=True)
|
|
@@ -997,7 +1009,7 @@ class FJSP(JSP):
|
|
|
997
1009
|
|
|
998
1010
|
f.write(json_str)
|
|
999
1011
|
|
|
1000
|
-
def saveDznFile(self, InputDir, OutputDir):
|
|
1012
|
+
def saveDznFile(self, InputDir, OutputDir,index):
|
|
1001
1013
|
indexProblema = OutputDir.split("/")[-2]
|
|
1002
1014
|
OutputDir = "/".join(OutputDir.split("/")[:-2])
|
|
1003
1015
|
# indexProblema = os.path.basename(os.path.normpath(OutputDir))
|
|
@@ -1006,45 +1018,44 @@ class FJSP(JSP):
|
|
|
1006
1018
|
# print(self.speed)
|
|
1007
1019
|
# for t in [0, 1, 2]:
|
|
1008
1020
|
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)
|
|
1021
|
+
# for s in range(1,self.speed+1):
|
|
1022
|
+
s= self.speed
|
|
1023
|
+
s0, sf, sp = [0,s,1]
|
|
1024
|
+
time = data.ProcessingTime[:, :, s0:sf:sp]
|
|
1025
|
+
energy = data.EnergyConsumption[:, :, s0:sf:sp]
|
|
1026
|
+
precedence = np.full((data.numJobs, data.numMchs), 0)
|
|
1027
|
+
|
|
1028
|
+
replace_data = {
|
|
1029
|
+
"machines": data.numMchs,
|
|
1030
|
+
"jobs": data.numJobs,
|
|
1031
|
+
"Speed": s,
|
|
1032
|
+
"time": str(time.flatten()).replace(" ", ", "),
|
|
1033
|
+
"energy": str(energy.flatten()).replace(" ", ", ")
|
|
1034
|
+
}
|
|
1035
|
+
if t == 1:
|
|
1036
|
+
replace_data["releaseDate"] = str([int(data.ReleaseDueDate[job, 0]) for job in range(data.numJobs)]).replace(" ", ",")
|
|
1037
|
+
replace_data["dueDate"] = str([int(data.ReleaseDueDate[job, 1]) for job in range(data.numJobs)]).replace(" ", ",")
|
|
1038
|
+
elif t == 2:
|
|
1039
|
+
replace_data["releaseDate"] = str(data.ReleaseDueDate[:, :, 0].flatten()).replace(" ", ",")
|
|
1040
|
+
replace_data["dueDate"] = str(data.ReleaseDueDate[:, :, 1].flatten()).replace(" ", ",")
|
|
1041
|
+
|
|
1042
|
+
for job in range(data.numJobs):
|
|
1043
|
+
for i, prioridad in enumerate(range(data.numMchs)):
|
|
1044
|
+
precedence[job, data.Orden[job, prioridad]] = i
|
|
1045
|
+
replace_data["precedence"] = str(precedence.flatten()).replace(" ", ",")
|
|
1046
|
+
|
|
1047
|
+
replace_data["available_machines"] = str(data.available_machines.flatten()).replace(" ", ", ")
|
|
1048
|
+
|
|
1049
|
+
# with open(f"./Minizinc/Types/RD/FJSP/type{t}.dzn", "r", encoding="utf-8") as file:
|
|
1050
|
+
# filedata = file.read()
|
|
1051
|
+
filedata = _read_text_resource(f"Minizinc/Types/RD/FJSP/type{t}.dzn")
|
|
1052
|
+
for kk, v in replace_data.items():
|
|
1053
|
+
filedata = filedata.replace("{" + kk + "}", str(v))
|
|
1054
|
+
|
|
1055
|
+
os.makedirs(f"{OutputDir}/", exist_ok=True)
|
|
1056
|
+
|
|
1057
|
+
with open(f"{OutputDir}/{indexProblema}-{t}-{s}_{index}.dzn", "w+", encoding="utf-8") as new:
|
|
1058
|
+
new.write(filedata)
|
|
1048
1059
|
|
|
1049
1060
|
def saveTaillardStandardFile(self, path):
|
|
1050
1061
|
os.makedirs("/".join(path.split("/")[:-1]),exist_ok=True)
|
|
@@ -1116,14 +1127,12 @@ class Generator:
|
|
|
1116
1127
|
jsp_instance = JSP(jobs = jobs, machines = machines)
|
|
1117
1128
|
case "FJSP":
|
|
1118
1129
|
jsp_instance = FJSP(jobs = jobs, machines = machines)
|
|
1119
|
-
|
|
1130
|
+
|
|
1120
1131
|
for index in range(1, size + 1):
|
|
1121
|
-
|
|
1122
1132
|
jsp_instance.fill_random_values(speed = speed, rddd = ReleaseDateDueDate, distribution = distribution, seed = seed,tpm = tpm)
|
|
1123
1133
|
|
|
1124
1134
|
# 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)
|
|
1135
|
+
problem_path = self.savepath.format(size = size, jobs =jobs, machines = machines, release_due_date = ReleaseDateDueDate, speed_scaling = speed, distribution = distribution, seed=seed)
|
|
1127
1136
|
|
|
1128
1137
|
if not (self.json or self.dzn or self.taillard): return jsp_instance
|
|
1129
1138
|
|
|
@@ -1139,7 +1148,7 @@ class Generator:
|
|
|
1139
1148
|
if self.dzn:
|
|
1140
1149
|
pkl_path = f"{problem_path}/" + jm_path.split("/")[0] + f"_{j}x{m}_{i}.pkl"
|
|
1141
1150
|
jsp_instance.savePythonFile(pkl_path)
|
|
1142
|
-
jsp_instance.saveDznFile(pkl_path, problem_path + jm_path)#f"{j}x{m}_{i}")
|
|
1151
|
+
jsp_instance.saveDznFile(pkl_path, problem_path + jm_path,index)#f"{j}x{m}_{i}")
|
|
1143
1152
|
os.remove(pkl_path)
|
|
1144
1153
|
if self.taillard:
|
|
1145
1154
|
jsp_instance.saveTaillardStandardFile(problem_path + jm_path.split("/")[0] + f"_{j}x{m}_{i}.txt")
|
|
@@ -1149,7 +1158,7 @@ class Generator:
|
|
|
1149
1158
|
if self.dzn:
|
|
1150
1159
|
pkl_path = f"{problem_path}/" + jm_path.split("/")[0] + f"_{j}x{m}_{i}.pkl"
|
|
1151
1160
|
jsp_instance.savePythonFile(pkl_path)
|
|
1152
|
-
jsp_instance.saveDznFile(pkl_path,f"{problem_path}/DZN/" + jm_path)#f"{j}x{m}_{i}")
|
|
1161
|
+
jsp_instance.saveDznFile(pkl_path,f"{problem_path}/DZN/" + jm_path,index)#f"{j}x{m}_{i}")
|
|
1153
1162
|
os.remove(pkl_path)
|
|
1154
1163
|
if self.taillard:
|
|
1155
1164
|
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
|