Instance generator for JSP
Project description
Instance Generator for JSP & FJSP (Energy‑aware)
Description
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.
Key features
- Supports JSP and FJSP (
instance_type="JSP"orinstance_type="FJSP"). - Energy‑aware speed scaling: each operation can be executed at one of several speeds; processing time and energy consumption are linked per speed.
- Release/Due date modes (
ReleaseDateDueDate):0(none),1(per job),2(per operation). - Multiple output formats: JSON, DZN (MiniZinc templates), Taillard-style text.
- Distributions for data generation:
uniform,normal,exponential. - Reproducibility via seed.
- FJSP adds a per‑job binary vector of available machines.
About value ranges & scaling
- With the uniform distribution, base operation costs are sampled within [10, 100].
- Initial release times are sampled from [0, 100] (in steps of 10) and then normalized to start at 0.
- Energy consumption values are normalized into [1, 100] by construction.
- Processing times are derived from base costs and speed scaling and are not capped at 100 (they can exceed 100), especially with
normal/exponentialdraws.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.
Python API
Generator initialization
from IGJSP.generador import Generator
gen = Generator(
json=False, # write JSON files
dzn=False, # write DZN files (MiniZinc)
taillard=False, # write Taillard-like txt
savepath="./output", # base output directory/template
single_folder_output=False # put artifacts in a single folder
)
Instance creation
obj = gen.generate_new_instance(
jobs=10, machines=4,
speed=1, # number of speed levels
ReleaseDateDueDate=0, # 0 (none), 1 (per job), 2 (per operation)
distribution="uniform", # 'uniform' | 'normal' | 'exponential'
seed=1,
tpm=[], # optional per-machine time scale
instance_type="JSP", # 'JSP' (default) or 'FJSP'
size=1 # how many instances to emit (looped)
)
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.
Generating a JSP problem instance
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.
Parameters (generation)
- Jobs:
jobs— number of jobs. Default:10 - Machines:
machines— number of machines. Default:4 - Release and Due Date:
ReleaseDateDueDate0: neither jobs nor operations have release/due times (default)1: each job has a release and due date2: each operation has a release and due date
- Speeds:
speed— number of speed levels. Default:1 - Distribution:
distribution—uniform,normal, orexponential. Default:normal - Seed:
seed— random seed for reproducibility. Default:1
Parameters (output)
- JSON:
json(bool) — write JSON file(s). Default:False - DZN:
dzn(bool) — write MiniZinc DZN file(s). Default:False - Taillard:
taillard(bool) — write Taillard-like text file. Default:False - Save Path:
savepath(str) — base path/template for outputs. Default:./output - Single folder:
single_folder_output(bool) — whether to write all artifacts into a single folder. Default:False
Example (JSP)
from IGJSP.generador import Generator
generator = Generator(json=True, savepath="output")
generator.generate_new_instance(
jobs=4, machines=2,
ReleaseDateDueDate=2,
distribution="exponential",
seed=53
)
Example of JSON generated (JSP)
{
"nbJobs": [
0,
1
],
"nbMchs": [
0,
1,
2,
3
],
"speed": 1,
"timeEnergy": [
{
"jobId": 0,
"operations": {
"0": {
"speed-scaling": [
{
"procTime": 8,
"energyCons": 92
}
],
"release-date": 30,
"due-date": 41
},
"2": {
"speed-scaling": [
{
"procTime": 17,
"energyCons": 84
}
],
"release-date": 41,
"due-date": 77
},
"3": {
"speed-scaling": [
{
"procTime": 3,
"energyCons": 97
}
],
"release-date": 77,
"due-date": 80
},
"1": {
"speed-scaling": [
{
"procTime": 7,
"energyCons": 93
}
],
"release-date": 80,
"due-date": 88
}
},
"release-date": 30,
"due-date": 88
},
{
"jobId": 1,
"operations": {
"1": {
"speed-scaling": [
{
"procTime": 4,
"energyCons": 96
}
],
"release-date": 0,
"due-date": 5
},
"3": {
"speed-scaling": [
{
"procTime": 3,
"energyCons": 97
}
],
"release-date": 5,
"due-date": 9
},
"2": {
"speed-scaling": [
{
"procTime": 1,
"energyCons": 99
}
],
"release-date": 9,
"due-date": 10
},
"0": {
"speed-scaling": [
{
"procTime": 6,
"energyCons": 94
}
],
"release-date": 10,
"due-date": 17
}
},
"release-date": 0,
"due-date": 17
}
],
"minMakespan": 35,
"minEnergy": 752,
"maxMinMakespan": 14,
"maxMinEnergy": 0
}
Generating an FJSP problem instance
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).
Example (FJSP)
from IGJSP.generador import Generator
generator = Generator(json=True, savepath="output")
generator.generate_new_instance(
jobs=3, machines=3,
speed=1,
ReleaseDateDueDate=0,
distribution="uniform",
seed=7,
instance_type="FJSP"
)
Example of JSON generated (FJSP)
Abridged example to illustrate the additional available_machines field:
{
"nbJobs": [0,1,2],
"nbMchs": [0,1,2],
"speed": 1,
"timeEnergy": [
{
"jobId": 0,
"available_machines": [1,0,1],
"operations": {
"0": { "speed-scaling": [ { "procTime": 12, "energyCons": 90 } ] },
"2": { "speed-scaling": [ { "procTime": 18, "energyCons": 84 } ] },
"1": { "speed-scaling": [ { "procTime": 11, "energyCons": 89 } ] }
}
},
{
"jobId": 1,
"available_machines": [1,1,0],
"operations": {
"2": { "speed-scaling": [ { "procTime": 7, "energyCons": 93 } ] },
"0": { "speed-scaling": [ { "procTime": 5, "energyCons": 95 } ] },
"1": { "speed-scaling": [ { "procTime": 13, "energyCons": 88 } ] }
}
}
],
"minMakespan": 123,
"minEnergy": 456,
"maxMinMakespan": 78,
"maxMinEnergy": 90
}
Notes on outputs
- JSON: Contains
nbJobs,nbMchs,speed, and atimeEnergylist with per‑joboperations. ForReleaseDateDueDate=1(per job) or2(per operation),release-date/due-datefields are added accordingly. - DZN: The generator writes
.dznfiles using templates located inside generator packages, parameterized by the selected RD mode and speed levels. - 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).
Reproducibility & scaling tips
- Use a fixed
seedto reproduce instances exactly. - 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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file igjsp-1.1.10.tar.gz.
File metadata
- Download URL: igjsp-1.1.10.tar.gz
- Upload date:
- Size: 18.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
507d5afc741655516d9ef7ea7f2f04e72c3d08e1a45f6734d74e45e1bf505900
|
|
| MD5 |
cc6e9ac5ea6ac2a4ca85b9657f87f8eb
|
|
| BLAKE2b-256 |
81f7d5cdd2f1ad6496b56496ebc91912d5aca81d4ae3891cd5dd8686cdf1465d
|
File details
Details for the file igjsp-1.1.10-py3-none-any.whl.
File metadata
- Download URL: igjsp-1.1.10-py3-none-any.whl
- Upload date:
- Size: 23.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6824f61e6264dd94f823f7a11a838ce1a7779eeb166dfefa36e12f9b927efab9
|
|
| MD5 |
4dc1e7e2fa8c309ba35f1b6d22d70af2
|
|
| BLAKE2b-256 |
7aac95a48cbde7b2d11b30f45fd7724743d521f03085217a0d29d0dbb7a4860a
|