IGJSP 0.0.10__tar.gz → 1.0.1__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-0.0.10 → igjsp-1.0.1}/.gitignore +2 -0
- igjsp-1.0.1/PKG-INFO +304 -0
- igjsp-1.0.1/README.md +288 -0
- {igjsp-0.0.10 → igjsp-1.0.1}/pyproject.toml +2 -2
- igjsp-1.0.1/src/IGJSP/Minizinc/Types/RD/FJSP/type0.dzn +9 -0
- igjsp-1.0.1/src/IGJSP/Minizinc/Types/RD/FJSP/type1.dzn +11 -0
- igjsp-1.0.1/src/IGJSP/Minizinc/Types/RD/FJSP/type2.dzn +11 -0
- igjsp-1.0.1/src/IGJSP/Minizinc/Types/RD/JSP/type0.dzn +8 -0
- igjsp-1.0.1/src/IGJSP/Minizinc/Types/RD/JSP/type1.dzn +10 -0
- igjsp-1.0.1/src/IGJSP/Minizinc/Types/RD/JSP/type2.dzn +10 -0
- {igjsp-0.0.10 → igjsp-1.0.1}/src/IGJSP/generador.py +318 -156
- {igjsp-0.0.10 → igjsp-1.0.1}/src/IGJSP/main.py +13 -6
- igjsp-0.0.10/PKG-INFO +0 -216
- igjsp-0.0.10/README.md +0 -200
- igjsp-0.0.10/src/IGJSP/Minizinc/Types/RD/type0.dzn +0 -8
- igjsp-0.0.10/src/IGJSP/Minizinc/Types/RD/type1.dzn +0 -10
- igjsp-0.0.10/src/IGJSP/Minizinc/Types/RD/type2.dzn +0 -10
- {igjsp-0.0.10 → igjsp-1.0.1}/.gitattributes +0 -0
- {igjsp-0.0.10 → igjsp-1.0.1}/.vscode/settings.json +0 -0
- {igjsp-0.0.10 → igjsp-1.0.1}/LICENSE +0 -0
- {igjsp-0.0.10 → igjsp-1.0.1}/src/IGJSP/Minizinc/Models/RD/JSP0.mzn +0 -0
- {igjsp-0.0.10 → igjsp-1.0.1}/src/IGJSP/Minizinc/Models/RD/JSP1.mzn +0 -0
- {igjsp-0.0.10 → igjsp-1.0.1}/src/IGJSP/Minizinc/Models/RD/JSP2.mzn +0 -0
- {igjsp-0.0.10 → igjsp-1.0.1}/src/IGJSP/Minizinc/Types/RD/JSP0.mzn +0 -0
- {igjsp-0.0.10 → igjsp-1.0.1}/src/IGJSP/Minizinc/Types/RD/JSP1.mzn +0 -0
- {igjsp-0.0.10 → igjsp-1.0.1}/src/IGJSP/Minizinc/Types/RD/JSP2.mzn +0 -0
igjsp-1.0.1/PKG-INFO
ADDED
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: IGJSP
|
|
3
|
+
Version: 1.0.1
|
|
4
|
+
Summary: Instance generator for JSP
|
|
5
|
+
Project-URL: Homepage, https://gps.blogs.upv.es/
|
|
6
|
+
Author-email: GPS-UPV <gps@dsic.upv.es>
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Requires-Python: >=3.9
|
|
12
|
+
Requires-Dist: numpy
|
|
13
|
+
Requires-Dist: scipy
|
|
14
|
+
Requires-Dist: tqdm
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
|
|
17
|
+
# Instance Generator for JSP & FJSP (Energy‑aware)
|
|
18
|
+
|
|
19
|
+
## Description
|
|
20
|
+
|
|
21
|
+
Instance generator for the **Job Shop Scheduling Problem (JSP)** and the **Flexible Job Shop Scheduling Problem (FJSP)** with speed‑scaling and optional release/due dates. The generator produces instances in **JSON**, **MiniZinc DZN**, and **Taillard-like text** formats, and it is designed for reproducible experiments via a random seed.
|
|
22
|
+
|
|
23
|
+
### Key features
|
|
24
|
+
|
|
25
|
+
- Supports **JSP** and **FJSP** (`instance_type="JSP"` or `instance_type="FJSP"`).
|
|
26
|
+
- **Energy‑aware speed scaling**: each operation can be executed at one of several speeds; processing time and energy consumption are linked per speed.
|
|
27
|
+
- **Release/Due date modes** (`ReleaseDateDueDate`): `0` (none), `1` (per job), `2` (per operation).
|
|
28
|
+
- Multiple output formats: **JSON**, **DZN** (MiniZinc templates), **Taillard-style** text.
|
|
29
|
+
- **Distributions** for data generation: `uniform`, `normal`, `exponential`.
|
|
30
|
+
- Reproducibility via **seed**.
|
|
31
|
+
- **FJSP** adds a per‑job binary vector of **available machines**.
|
|
32
|
+
|
|
33
|
+
> **About value ranges & scaling**
|
|
34
|
+
>
|
|
35
|
+
> - With the **uniform** distribution, base operation costs are sampled within **[10, 100]**.
|
|
36
|
+
> - Initial *release times* are sampled from **[0, 100]** (in steps of 10) and then normalized to start at 0.
|
|
37
|
+
> - **Energy consumption** values are normalized into **[1, 100]** by construction.
|
|
38
|
+
> - **Processing times** are derived from base costs and speed scaling and **are not capped** at 100 (they can exceed 100), especially with `normal`/`exponential` draws.
|
|
39
|
+
>
|
|
40
|
+
> As a result, energy values and the initial release‑date seeds are within 0–100; if you need strict 0–100 ranges for *all* fields, set an external rescaling on the produced arrays or constrain generation to `distribution="uniform"` and adjust your post‑processing accordingly.
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## Python API
|
|
45
|
+
|
|
46
|
+
### Generator initialization
|
|
47
|
+
|
|
48
|
+
```python
|
|
49
|
+
from IGJSP.generador import Generator
|
|
50
|
+
|
|
51
|
+
gen = Generator(
|
|
52
|
+
json=False, # write JSON files
|
|
53
|
+
dzn=False, # write DZN files (MiniZinc)
|
|
54
|
+
taillard=False, # write Taillard-like txt
|
|
55
|
+
savepath="./output", # base output directory/template
|
|
56
|
+
single_folder_output=False # put artifacts in a single folder
|
|
57
|
+
)
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Instance creation
|
|
61
|
+
|
|
62
|
+
```python
|
|
63
|
+
obj = gen.generate_new_instance(
|
|
64
|
+
jobs=10, machines=4,
|
|
65
|
+
speed=1, # number of speed levels
|
|
66
|
+
ReleaseDateDueDate=0, # 0 (none), 1 (per job), 2 (per operation)
|
|
67
|
+
distribution="uniform", # 'uniform' | 'normal' | 'exponential'
|
|
68
|
+
seed=1,
|
|
69
|
+
tpm=[], # optional per-machine time scale
|
|
70
|
+
instance_type="JSP", # 'JSP' (default) or 'FJSP'
|
|
71
|
+
size=1 # how many instances to emit (looped)
|
|
72
|
+
)
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
If all three output flags (`json`, `dzn`, `taillard`) are `False`, the function returns the in‑memory instance object (`JSP` or `FJSP`). Otherwise, it writes files under `savepath` and returns the last instance created.
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## Generating a JSP problem instance
|
|
80
|
+
|
|
81
|
+
To generate an instance of the problem, use the `Generator` class (module `Generador`). Initialize it and then call `generate_new_instance` with the parameters below.
|
|
82
|
+
|
|
83
|
+
### Parameters (generation)
|
|
84
|
+
|
|
85
|
+
1. **Jobs:** `jobs` — number of jobs. Default: `10`
|
|
86
|
+
2. **Machines:** `machines` — number of machines. Default: `4`
|
|
87
|
+
3. **Release and Due Date:** `ReleaseDateDueDate`
|
|
88
|
+
- `0`: neither jobs nor operations have release/due times (default)
|
|
89
|
+
- `1`: each job has a release and due date
|
|
90
|
+
- `2`: each operation has a release and due date
|
|
91
|
+
4. **Speeds:** `speed` — number of speed levels. Default: `1`
|
|
92
|
+
5. **Distribution:** `distribution` — `uniform`, `normal`, or `exponential`. Default: `normal`
|
|
93
|
+
6. **Seed:** `seed` — random seed for reproducibility. Default: `1`
|
|
94
|
+
|
|
95
|
+
### Parameters (output)
|
|
96
|
+
|
|
97
|
+
- **JSON:** `json` (bool) — write JSON file(s). Default: `False`
|
|
98
|
+
- **DZN:** `dzn` (bool) — write MiniZinc DZN file(s). Default: `False`
|
|
99
|
+
- **Taillard:** `taillard` (bool) — write Taillard-like text file. Default: `False`
|
|
100
|
+
- **Save Path:** `savepath` (str) — base path/template for outputs. Default: `./output`
|
|
101
|
+
- **Single folder:** `single_folder_output` (bool) — whether to write all artifacts into a single folder. Default: `False`
|
|
102
|
+
|
|
103
|
+
### Example (JSP)
|
|
104
|
+
|
|
105
|
+
```python
|
|
106
|
+
from IGJSP.generador import Generator
|
|
107
|
+
generator = Generator(json=True, savepath="output")
|
|
108
|
+
generator.generate_new_instance(
|
|
109
|
+
jobs=4, machines=2,
|
|
110
|
+
ReleaseDateDueDate=2,
|
|
111
|
+
distribution="exponential",
|
|
112
|
+
seed=53
|
|
113
|
+
)
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Example of JSON generated (JSP)
|
|
117
|
+
|
|
118
|
+
```json
|
|
119
|
+
{
|
|
120
|
+
"nbJobs": [
|
|
121
|
+
0,
|
|
122
|
+
1
|
|
123
|
+
],
|
|
124
|
+
"nbMchs": [
|
|
125
|
+
0,
|
|
126
|
+
1,
|
|
127
|
+
2,
|
|
128
|
+
3
|
|
129
|
+
],
|
|
130
|
+
"speed": 1,
|
|
131
|
+
"timeEnergy": [
|
|
132
|
+
{
|
|
133
|
+
"jobId": 0,
|
|
134
|
+
"operations": {
|
|
135
|
+
"0": {
|
|
136
|
+
"speed-scaling": [
|
|
137
|
+
{
|
|
138
|
+
"procTime": 8,
|
|
139
|
+
"energyCons": 92
|
|
140
|
+
}
|
|
141
|
+
],
|
|
142
|
+
"release-date": 30,
|
|
143
|
+
"due-date": 41
|
|
144
|
+
},
|
|
145
|
+
"2": {
|
|
146
|
+
"speed-scaling": [
|
|
147
|
+
{
|
|
148
|
+
"procTime": 17,
|
|
149
|
+
"energyCons": 84
|
|
150
|
+
}
|
|
151
|
+
],
|
|
152
|
+
"release-date": 41,
|
|
153
|
+
"due-date": 77
|
|
154
|
+
},
|
|
155
|
+
"3": {
|
|
156
|
+
"speed-scaling": [
|
|
157
|
+
{
|
|
158
|
+
"procTime": 3,
|
|
159
|
+
"energyCons": 97
|
|
160
|
+
}
|
|
161
|
+
],
|
|
162
|
+
"release-date": 77,
|
|
163
|
+
"due-date": 80
|
|
164
|
+
},
|
|
165
|
+
"1": {
|
|
166
|
+
"speed-scaling": [
|
|
167
|
+
{
|
|
168
|
+
"procTime": 7,
|
|
169
|
+
"energyCons": 93
|
|
170
|
+
}
|
|
171
|
+
],
|
|
172
|
+
"release-date": 80,
|
|
173
|
+
"due-date": 88
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
"release-date": 30,
|
|
177
|
+
"due-date": 88
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
"jobId": 1,
|
|
181
|
+
"operations": {
|
|
182
|
+
"1": {
|
|
183
|
+
"speed-scaling": [
|
|
184
|
+
{
|
|
185
|
+
"procTime": 4,
|
|
186
|
+
"energyCons": 96
|
|
187
|
+
}
|
|
188
|
+
],
|
|
189
|
+
"release-date": 0,
|
|
190
|
+
"due-date": 5
|
|
191
|
+
},
|
|
192
|
+
"3": {
|
|
193
|
+
"speed-scaling": [
|
|
194
|
+
{
|
|
195
|
+
"procTime": 3,
|
|
196
|
+
"energyCons": 97
|
|
197
|
+
}
|
|
198
|
+
],
|
|
199
|
+
"release-date": 5,
|
|
200
|
+
"due-date": 9
|
|
201
|
+
},
|
|
202
|
+
"2": {
|
|
203
|
+
"speed-scaling": [
|
|
204
|
+
{
|
|
205
|
+
"procTime": 1,
|
|
206
|
+
"energyCons": 99
|
|
207
|
+
}
|
|
208
|
+
],
|
|
209
|
+
"release-date": 9,
|
|
210
|
+
"due-date": 10
|
|
211
|
+
},
|
|
212
|
+
"0": {
|
|
213
|
+
"speed-scaling": [
|
|
214
|
+
{
|
|
215
|
+
"procTime": 6,
|
|
216
|
+
"energyCons": 94
|
|
217
|
+
}
|
|
218
|
+
],
|
|
219
|
+
"release-date": 10,
|
|
220
|
+
"due-date": 17
|
|
221
|
+
}
|
|
222
|
+
},
|
|
223
|
+
"release-date": 0,
|
|
224
|
+
"due-date": 17
|
|
225
|
+
}
|
|
226
|
+
],
|
|
227
|
+
"minMakespan": 35,
|
|
228
|
+
"minEnergy": 752,
|
|
229
|
+
"maxMinMakespan": 14,
|
|
230
|
+
"maxMinEnergy": 0
|
|
231
|
+
}
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
---
|
|
235
|
+
|
|
236
|
+
## Generating an FJSP problem instance
|
|
237
|
+
|
|
238
|
+
Set `instance_type="FJSP"` to enable flexible routing. In the JSON output, each job includes an `available_machines` binary vector of length `nbMchs`, indicating where the job's operations can be processed (`1` = available, `0` = not available).
|
|
239
|
+
|
|
240
|
+
### Example (FJSP)
|
|
241
|
+
|
|
242
|
+
```python
|
|
243
|
+
from IGJSP.generador import Generator
|
|
244
|
+
generator = Generator(json=True, savepath="output")
|
|
245
|
+
generator.generate_new_instance(
|
|
246
|
+
jobs=3, machines=3,
|
|
247
|
+
speed=1,
|
|
248
|
+
ReleaseDateDueDate=0,
|
|
249
|
+
distribution="uniform",
|
|
250
|
+
seed=7,
|
|
251
|
+
instance_type="FJSP"
|
|
252
|
+
)
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
### Example of JSON generated (FJSP)
|
|
256
|
+
|
|
257
|
+
Abridged example to illustrate the additional `available_machines` field:
|
|
258
|
+
|
|
259
|
+
```json
|
|
260
|
+
{
|
|
261
|
+
"nbJobs": [0,1,2],
|
|
262
|
+
"nbMchs": [0,1,2],
|
|
263
|
+
"speed": 1,
|
|
264
|
+
"timeEnergy": [
|
|
265
|
+
{
|
|
266
|
+
"jobId": 0,
|
|
267
|
+
"available_machines": [1,0,1],
|
|
268
|
+
"operations": {
|
|
269
|
+
"0": { "speed-scaling": [ { "procTime": 12, "energyCons": 90 } ] },
|
|
270
|
+
"2": { "speed-scaling": [ { "procTime": 18, "energyCons": 84 } ] },
|
|
271
|
+
"1": { "speed-scaling": [ { "procTime": 11, "energyCons": 89 } ] }
|
|
272
|
+
}
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
"jobId": 1,
|
|
276
|
+
"available_machines": [1,1,0],
|
|
277
|
+
"operations": {
|
|
278
|
+
"2": { "speed-scaling": [ { "procTime": 7, "energyCons": 93 } ] },
|
|
279
|
+
"0": { "speed-scaling": [ { "procTime": 5, "energyCons": 95 } ] },
|
|
280
|
+
"1": { "speed-scaling": [ { "procTime": 13, "energyCons": 88 } ] }
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
],
|
|
284
|
+
"minMakespan": 123,
|
|
285
|
+
"minEnergy": 456,
|
|
286
|
+
"maxMinMakespan": 78,
|
|
287
|
+
"maxMinEnergy": 90
|
|
288
|
+
}
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
---
|
|
292
|
+
|
|
293
|
+
## Notes on outputs
|
|
294
|
+
|
|
295
|
+
- **JSON**: Contains `nbJobs`, `nbMchs`, `speed`, and a `timeEnergy` list with per‑job `operations`. For `ReleaseDateDueDate=1` (per job) or `2` (per operation), `release-date`/`due-date` fields are added accordingly.
|
|
296
|
+
- **DZN**: The generator writes `.dzn` files using templates located inside generator packages, parameterized by the selected RD mode and speed levels.
|
|
297
|
+
- **Taillard-like**: Writes textual matrices for processing times, energy consumption, and the job‑specific machine order; the FJSP variant also appends an `Available machines:` section (binary rows per job).
|
|
298
|
+
|
|
299
|
+
---
|
|
300
|
+
|
|
301
|
+
## Reproducibility & scaling tips
|
|
302
|
+
|
|
303
|
+
- Use a fixed `seed` to reproduce instances exactly.
|
|
304
|
+
- For tighter value ranges (e.g., unit testing), prefer `distribution="uniform"` and post‑scale arrays if you require strict bounds (e.g., map processing times to `[1,100]` after generation). Energy values are already normalized to `[1,100]` by design.
|
igjsp-1.0.1/README.md
ADDED
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
# Instance Generator for JSP & FJSP (Energy‑aware)
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
Instance generator for the **Job Shop Scheduling Problem (JSP)** and the **Flexible Job Shop Scheduling Problem (FJSP)** with speed‑scaling and optional release/due dates. The generator produces instances in **JSON**, **MiniZinc DZN**, and **Taillard-like text** formats, and it is designed for reproducible experiments via a random seed.
|
|
6
|
+
|
|
7
|
+
### Key features
|
|
8
|
+
|
|
9
|
+
- Supports **JSP** and **FJSP** (`instance_type="JSP"` or `instance_type="FJSP"`).
|
|
10
|
+
- **Energy‑aware speed scaling**: each operation can be executed at one of several speeds; processing time and energy consumption are linked per speed.
|
|
11
|
+
- **Release/Due date modes** (`ReleaseDateDueDate`): `0` (none), `1` (per job), `2` (per operation).
|
|
12
|
+
- Multiple output formats: **JSON**, **DZN** (MiniZinc templates), **Taillard-style** text.
|
|
13
|
+
- **Distributions** for data generation: `uniform`, `normal`, `exponential`.
|
|
14
|
+
- Reproducibility via **seed**.
|
|
15
|
+
- **FJSP** adds a per‑job binary vector of **available machines**.
|
|
16
|
+
|
|
17
|
+
> **About value ranges & scaling**
|
|
18
|
+
>
|
|
19
|
+
> - With the **uniform** distribution, base operation costs are sampled within **[10, 100]**.
|
|
20
|
+
> - Initial *release times* are sampled from **[0, 100]** (in steps of 10) and then normalized to start at 0.
|
|
21
|
+
> - **Energy consumption** values are normalized into **[1, 100]** by construction.
|
|
22
|
+
> - **Processing times** are derived from base costs and speed scaling and **are not capped** at 100 (they can exceed 100), especially with `normal`/`exponential` draws.
|
|
23
|
+
>
|
|
24
|
+
> As a result, energy values and the initial release‑date seeds are within 0–100; if you need strict 0–100 ranges for *all* fields, set an external rescaling on the produced arrays or constrain generation to `distribution="uniform"` and adjust your post‑processing accordingly.
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Python API
|
|
29
|
+
|
|
30
|
+
### Generator initialization
|
|
31
|
+
|
|
32
|
+
```python
|
|
33
|
+
from IGJSP.generador import Generator
|
|
34
|
+
|
|
35
|
+
gen = Generator(
|
|
36
|
+
json=False, # write JSON files
|
|
37
|
+
dzn=False, # write DZN files (MiniZinc)
|
|
38
|
+
taillard=False, # write Taillard-like txt
|
|
39
|
+
savepath="./output", # base output directory/template
|
|
40
|
+
single_folder_output=False # put artifacts in a single folder
|
|
41
|
+
)
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Instance creation
|
|
45
|
+
|
|
46
|
+
```python
|
|
47
|
+
obj = gen.generate_new_instance(
|
|
48
|
+
jobs=10, machines=4,
|
|
49
|
+
speed=1, # number of speed levels
|
|
50
|
+
ReleaseDateDueDate=0, # 0 (none), 1 (per job), 2 (per operation)
|
|
51
|
+
distribution="uniform", # 'uniform' | 'normal' | 'exponential'
|
|
52
|
+
seed=1,
|
|
53
|
+
tpm=[], # optional per-machine time scale
|
|
54
|
+
instance_type="JSP", # 'JSP' (default) or 'FJSP'
|
|
55
|
+
size=1 # how many instances to emit (looped)
|
|
56
|
+
)
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
If all three output flags (`json`, `dzn`, `taillard`) are `False`, the function returns the in‑memory instance object (`JSP` or `FJSP`). Otherwise, it writes files under `savepath` and returns the last instance created.
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## Generating a JSP problem instance
|
|
64
|
+
|
|
65
|
+
To generate an instance of the problem, use the `Generator` class (module `Generador`). Initialize it and then call `generate_new_instance` with the parameters below.
|
|
66
|
+
|
|
67
|
+
### Parameters (generation)
|
|
68
|
+
|
|
69
|
+
1. **Jobs:** `jobs` — number of jobs. Default: `10`
|
|
70
|
+
2. **Machines:** `machines` — number of machines. Default: `4`
|
|
71
|
+
3. **Release and Due Date:** `ReleaseDateDueDate`
|
|
72
|
+
- `0`: neither jobs nor operations have release/due times (default)
|
|
73
|
+
- `1`: each job has a release and due date
|
|
74
|
+
- `2`: each operation has a release and due date
|
|
75
|
+
4. **Speeds:** `speed` — number of speed levels. Default: `1`
|
|
76
|
+
5. **Distribution:** `distribution` — `uniform`, `normal`, or `exponential`. Default: `normal`
|
|
77
|
+
6. **Seed:** `seed` — random seed for reproducibility. Default: `1`
|
|
78
|
+
|
|
79
|
+
### Parameters (output)
|
|
80
|
+
|
|
81
|
+
- **JSON:** `json` (bool) — write JSON file(s). Default: `False`
|
|
82
|
+
- **DZN:** `dzn` (bool) — write MiniZinc DZN file(s). Default: `False`
|
|
83
|
+
- **Taillard:** `taillard` (bool) — write Taillard-like text file. Default: `False`
|
|
84
|
+
- **Save Path:** `savepath` (str) — base path/template for outputs. Default: `./output`
|
|
85
|
+
- **Single folder:** `single_folder_output` (bool) — whether to write all artifacts into a single folder. Default: `False`
|
|
86
|
+
|
|
87
|
+
### Example (JSP)
|
|
88
|
+
|
|
89
|
+
```python
|
|
90
|
+
from IGJSP.generador import Generator
|
|
91
|
+
generator = Generator(json=True, savepath="output")
|
|
92
|
+
generator.generate_new_instance(
|
|
93
|
+
jobs=4, machines=2,
|
|
94
|
+
ReleaseDateDueDate=2,
|
|
95
|
+
distribution="exponential",
|
|
96
|
+
seed=53
|
|
97
|
+
)
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Example of JSON generated (JSP)
|
|
101
|
+
|
|
102
|
+
```json
|
|
103
|
+
{
|
|
104
|
+
"nbJobs": [
|
|
105
|
+
0,
|
|
106
|
+
1
|
|
107
|
+
],
|
|
108
|
+
"nbMchs": [
|
|
109
|
+
0,
|
|
110
|
+
1,
|
|
111
|
+
2,
|
|
112
|
+
3
|
|
113
|
+
],
|
|
114
|
+
"speed": 1,
|
|
115
|
+
"timeEnergy": [
|
|
116
|
+
{
|
|
117
|
+
"jobId": 0,
|
|
118
|
+
"operations": {
|
|
119
|
+
"0": {
|
|
120
|
+
"speed-scaling": [
|
|
121
|
+
{
|
|
122
|
+
"procTime": 8,
|
|
123
|
+
"energyCons": 92
|
|
124
|
+
}
|
|
125
|
+
],
|
|
126
|
+
"release-date": 30,
|
|
127
|
+
"due-date": 41
|
|
128
|
+
},
|
|
129
|
+
"2": {
|
|
130
|
+
"speed-scaling": [
|
|
131
|
+
{
|
|
132
|
+
"procTime": 17,
|
|
133
|
+
"energyCons": 84
|
|
134
|
+
}
|
|
135
|
+
],
|
|
136
|
+
"release-date": 41,
|
|
137
|
+
"due-date": 77
|
|
138
|
+
},
|
|
139
|
+
"3": {
|
|
140
|
+
"speed-scaling": [
|
|
141
|
+
{
|
|
142
|
+
"procTime": 3,
|
|
143
|
+
"energyCons": 97
|
|
144
|
+
}
|
|
145
|
+
],
|
|
146
|
+
"release-date": 77,
|
|
147
|
+
"due-date": 80
|
|
148
|
+
},
|
|
149
|
+
"1": {
|
|
150
|
+
"speed-scaling": [
|
|
151
|
+
{
|
|
152
|
+
"procTime": 7,
|
|
153
|
+
"energyCons": 93
|
|
154
|
+
}
|
|
155
|
+
],
|
|
156
|
+
"release-date": 80,
|
|
157
|
+
"due-date": 88
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
"release-date": 30,
|
|
161
|
+
"due-date": 88
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
"jobId": 1,
|
|
165
|
+
"operations": {
|
|
166
|
+
"1": {
|
|
167
|
+
"speed-scaling": [
|
|
168
|
+
{
|
|
169
|
+
"procTime": 4,
|
|
170
|
+
"energyCons": 96
|
|
171
|
+
}
|
|
172
|
+
],
|
|
173
|
+
"release-date": 0,
|
|
174
|
+
"due-date": 5
|
|
175
|
+
},
|
|
176
|
+
"3": {
|
|
177
|
+
"speed-scaling": [
|
|
178
|
+
{
|
|
179
|
+
"procTime": 3,
|
|
180
|
+
"energyCons": 97
|
|
181
|
+
}
|
|
182
|
+
],
|
|
183
|
+
"release-date": 5,
|
|
184
|
+
"due-date": 9
|
|
185
|
+
},
|
|
186
|
+
"2": {
|
|
187
|
+
"speed-scaling": [
|
|
188
|
+
{
|
|
189
|
+
"procTime": 1,
|
|
190
|
+
"energyCons": 99
|
|
191
|
+
}
|
|
192
|
+
],
|
|
193
|
+
"release-date": 9,
|
|
194
|
+
"due-date": 10
|
|
195
|
+
},
|
|
196
|
+
"0": {
|
|
197
|
+
"speed-scaling": [
|
|
198
|
+
{
|
|
199
|
+
"procTime": 6,
|
|
200
|
+
"energyCons": 94
|
|
201
|
+
}
|
|
202
|
+
],
|
|
203
|
+
"release-date": 10,
|
|
204
|
+
"due-date": 17
|
|
205
|
+
}
|
|
206
|
+
},
|
|
207
|
+
"release-date": 0,
|
|
208
|
+
"due-date": 17
|
|
209
|
+
}
|
|
210
|
+
],
|
|
211
|
+
"minMakespan": 35,
|
|
212
|
+
"minEnergy": 752,
|
|
213
|
+
"maxMinMakespan": 14,
|
|
214
|
+
"maxMinEnergy": 0
|
|
215
|
+
}
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
## Generating an FJSP problem instance
|
|
221
|
+
|
|
222
|
+
Set `instance_type="FJSP"` to enable flexible routing. In the JSON output, each job includes an `available_machines` binary vector of length `nbMchs`, indicating where the job's operations can be processed (`1` = available, `0` = not available).
|
|
223
|
+
|
|
224
|
+
### Example (FJSP)
|
|
225
|
+
|
|
226
|
+
```python
|
|
227
|
+
from IGJSP.generador import Generator
|
|
228
|
+
generator = Generator(json=True, savepath="output")
|
|
229
|
+
generator.generate_new_instance(
|
|
230
|
+
jobs=3, machines=3,
|
|
231
|
+
speed=1,
|
|
232
|
+
ReleaseDateDueDate=0,
|
|
233
|
+
distribution="uniform",
|
|
234
|
+
seed=7,
|
|
235
|
+
instance_type="FJSP"
|
|
236
|
+
)
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
### Example of JSON generated (FJSP)
|
|
240
|
+
|
|
241
|
+
Abridged example to illustrate the additional `available_machines` field:
|
|
242
|
+
|
|
243
|
+
```json
|
|
244
|
+
{
|
|
245
|
+
"nbJobs": [0,1,2],
|
|
246
|
+
"nbMchs": [0,1,2],
|
|
247
|
+
"speed": 1,
|
|
248
|
+
"timeEnergy": [
|
|
249
|
+
{
|
|
250
|
+
"jobId": 0,
|
|
251
|
+
"available_machines": [1,0,1],
|
|
252
|
+
"operations": {
|
|
253
|
+
"0": { "speed-scaling": [ { "procTime": 12, "energyCons": 90 } ] },
|
|
254
|
+
"2": { "speed-scaling": [ { "procTime": 18, "energyCons": 84 } ] },
|
|
255
|
+
"1": { "speed-scaling": [ { "procTime": 11, "energyCons": 89 } ] }
|
|
256
|
+
}
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
"jobId": 1,
|
|
260
|
+
"available_machines": [1,1,0],
|
|
261
|
+
"operations": {
|
|
262
|
+
"2": { "speed-scaling": [ { "procTime": 7, "energyCons": 93 } ] },
|
|
263
|
+
"0": { "speed-scaling": [ { "procTime": 5, "energyCons": 95 } ] },
|
|
264
|
+
"1": { "speed-scaling": [ { "procTime": 13, "energyCons": 88 } ] }
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
],
|
|
268
|
+
"minMakespan": 123,
|
|
269
|
+
"minEnergy": 456,
|
|
270
|
+
"maxMinMakespan": 78,
|
|
271
|
+
"maxMinEnergy": 90
|
|
272
|
+
}
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
---
|
|
276
|
+
|
|
277
|
+
## Notes on outputs
|
|
278
|
+
|
|
279
|
+
- **JSON**: Contains `nbJobs`, `nbMchs`, `speed`, and a `timeEnergy` list with per‑job `operations`. For `ReleaseDateDueDate=1` (per job) or `2` (per operation), `release-date`/`due-date` fields are added accordingly.
|
|
280
|
+
- **DZN**: The generator writes `.dzn` files using templates located inside generator packages, parameterized by the selected RD mode and speed levels.
|
|
281
|
+
- **Taillard-like**: Writes textual matrices for processing times, energy consumption, and the job‑specific machine order; the FJSP variant also appends an `Available machines:` section (binary rows per job).
|
|
282
|
+
|
|
283
|
+
---
|
|
284
|
+
|
|
285
|
+
## Reproducibility & scaling tips
|
|
286
|
+
|
|
287
|
+
- Use a fixed `seed` to reproduce instances exactly.
|
|
288
|
+
- For tighter value ranges (e.g., unit testing), prefer `distribution="uniform"` and post‑scale arrays if you require strict bounds (e.g., map processing times to `[1,100]` after generation). Energy values are already normalized to `[1,100]` by design.
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "IGJSP"
|
|
7
|
-
version = "
|
|
7
|
+
version = "1.0.1"
|
|
8
8
|
authors = [
|
|
9
9
|
{ name="GPS-UPV", email="gps@dsic.upv.es" },
|
|
10
10
|
]
|
|
@@ -26,4 +26,4 @@ dependencies = [
|
|
|
26
26
|
Homepage = "https://gps.blogs.upv.es/"
|
|
27
27
|
|
|
28
28
|
[tool.hatch.build.targets.wheel]
|
|
29
|
-
packages = ["src/IGJSP","src/
|
|
29
|
+
packages = ["src/IGJSP","src/Minizinc"]
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
%SETS
|
|
2
|
+
JOBS = 1..{jobs};
|
|
3
|
+
MACHINES = 1..{machines};
|
|
4
|
+
SPEED = {Speed};
|
|
5
|
+
|
|
6
|
+
time = array3d(JOBS,MACHINES,1..SPEED,{time});
|
|
7
|
+
energy = array3d(JOBS,MACHINES,1..SPEED,{energy});
|
|
8
|
+
precedence = array2d(JOBS,MACHINES,{precedence});
|
|
9
|
+
available_machines = array2d(JOBS,MACHINES,{available_machines});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
%SETS
|
|
2
|
+
JOBS = 1..{jobs};
|
|
3
|
+
MACHINES = 1..{machines};
|
|
4
|
+
SPEED = {Speed};
|
|
5
|
+
|
|
6
|
+
time = array3d(JOBS,MACHINES,1..SPEED,{time});
|
|
7
|
+
energy = array3d(JOBS,MACHINES,1..SPEED,{energy});
|
|
8
|
+
precedence = array2d(JOBS,MACHINES,{precedence});
|
|
9
|
+
releaseDate = {releaseDate};
|
|
10
|
+
dueDate = {dueDate};
|
|
11
|
+
available_machines = array2d(JOBS,MACHINES,{available_machines});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
%SETS
|
|
2
|
+
JOBS = 1..{jobs};
|
|
3
|
+
MACHINES = 1..{machines};
|
|
4
|
+
SPEED = {Speed};
|
|
5
|
+
|
|
6
|
+
time = array3d(JOBS,MACHINES,1..SPEED,{time});
|
|
7
|
+
energy = array3d(JOBS,MACHINES,1..SPEED,{energy});
|
|
8
|
+
precedence = array2d(JOBS,MACHINES,{precedence});
|
|
9
|
+
releaseDate = array2d(JOBS,MACHINES,{releaseDate});
|
|
10
|
+
dueDate = array2d(JOBS,MACHINES,{dueDate});
|
|
11
|
+
available_machines = array2d(JOBS,MACHINES,{available_machines});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
%SETS
|
|
2
|
+
JOBS = 1..{jobs};
|
|
3
|
+
MACHINES = 1..{machines};
|
|
4
|
+
SPEED = {Speed};
|
|
5
|
+
|
|
6
|
+
time = array3d(JOBS,MACHINES,1..SPEED,{time});
|
|
7
|
+
energy = array3d(JOBS,MACHINES,1..SPEED,{energy});
|
|
8
|
+
precedence = array2d(JOBS,MACHINES,{precedence});
|
|
9
|
+
releaseDate = {releaseDate};
|
|
10
|
+
dueDate = {dueDate};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
%SETS
|
|
2
|
+
JOBS = 1..{jobs};
|
|
3
|
+
MACHINES = 1..{machines};
|
|
4
|
+
SPEED = {Speed};
|
|
5
|
+
|
|
6
|
+
time = array3d(JOBS,MACHINES,1..SPEED,{time});
|
|
7
|
+
energy = array3d(JOBS,MACHINES,1..SPEED,{energy});
|
|
8
|
+
precedence = array2d(JOBS,MACHINES,{precedence});
|
|
9
|
+
releaseDate = array2d(JOBS,MACHINES,{releaseDate});
|
|
10
|
+
dueDate = array2d(JOBS,MACHINES,{dueDate});
|