IGJSP 1.1.5__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.5
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.5"
7
+ version = "1.1.7"
8
8
  authors = [
9
9
  { name = "GPS-UPV", email = "gps@dsic.upv.es" },
10
10
  ]
@@ -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)
@@ -132,7 +133,7 @@ def _parse_array_generic(text, name):
132
133
 
133
134
  #################################################################################
134
135
  # #
135
- # JSP #
136
+ # JSP #
136
137
  # #
137
138
  #################################################################################
138
139
 
@@ -161,6 +162,9 @@ class JSP:
161
162
  energyPer, timePer = self._particionate_speed_space(speed)
162
163
  self._generate_standar_operation_cost(distribution,tpm)
163
164
 
165
+ energyPer, timePer = self._particionate_speed_space(speed)
166
+ self._generate_standar_operation_cost(distribution)
167
+
164
168
  self.ProcessingTime = np.zeros((self.numJobs, self.numMchs, self.speed), dtype=int)
165
169
  self.EnergyConsumption = np.zeros((self.numJobs, self.numMchs, self.speed), dtype=int)
166
170
  self.Orden = np.zeros((self.numJobs, self.numMchs), dtype=int)
@@ -183,7 +187,8 @@ class JSP:
183
187
 
184
188
  def _particionate_speed_space(self, speed):
185
189
  energyPer = np.linspace(0.5, 3, speed) if speed > 1 else [1]
186
- timePer = [t(c) for c in energyPer]
190
+ # timePer = [t(c) for c in energyPer]
191
+ timePer = sorted([random.uniform(0, 100)/100 for _ in range(3)])
187
192
  return energyPer, timePer
188
193
 
189
194
  def _generate_standar_operation_cost(self, distribution,tpm=[]):
@@ -213,16 +218,18 @@ class JSP:
213
218
  self.ReleaseDueDate[job, machine, 1] = releaseDateTask
214
219
  else:
215
220
  releaseDateTask += np.median(self.ProcessingTime[job, machine, :])
221
+
216
222
  if self.rddd == 1:
217
223
  self.ReleaseDueDate[job] = [initial, int(self._release_due(releaseDateTask, distribution))]
218
-
219
224
 
220
225
  def _genProcEnergy(self, job, machine, timePer):
221
- ans = []
222
- for tper in timePer:
223
- time = max(1, self.operationCost[job, machine] * tper)
224
- ans.append((time, max(1, f(time))))
225
- return ans
226
+ # ans = []
227
+ # for tper in timePer:
228
+ # time = max(1, self.operationCost[job, machine] * tper)
229
+ # ans.append((time, max(1, f(time))))
230
+ # ans.append((time, max(1, f(time))))
231
+ timePer = sorted([random.uniform(0, 100)/100 for _ in range(3)])
232
+ return [(round(i*100),round((1-i)*100)) for i in timePer]
226
233
 
227
234
  def _release_due(self, duration, distribution):
228
235
  if distribution == "uniform":
@@ -667,7 +674,6 @@ class JSP:
667
674
 
668
675
  if t == 1:
669
676
  replace_data["releaseDate"] = str(data.ReleaseDueDate[:, 0].flatten()).replace(" ",", ")
670
- # replace_data["releaseDate"] = ", ".join(list(map(str,data.ReleaseDueDate[:, 0])))
671
677
  replace_data["dueDate"] = str(data.ReleaseDueDate[:, 1].flatten()).replace(" ",", ")
672
678
 
673
679
  elif t == 2:
@@ -679,6 +685,7 @@ class JSP:
679
685
  precedence[job, data.Orden[job, prioridad]] = i
680
686
 
681
687
  replace_data["precedence"] = str(precedence.flatten()).replace(" ", ", ")
688
+
682
689
  filedata = _read_text_resource(f"Minizinc/Types/RD/JSP/type{t}.dzn")
683
690
  # with open(f"./Minizinc/Types/RD/JSP/type{t}.dzn", "r", encoding="utf-8") as file:
684
691
  # filedata = file.read()
File without changes
File without changes
File without changes
File without changes