Metadata-Version: 2.2
Name: jsp-instance-utils
Version: 1.0.2
Summary: A package containg benchmark instances for the Job Shop Scheduling Problem (JSP) scraped from 
Author: Alexander Nasuta
Author-email: Alexander Nasuta <alexander.nasuta@wzl-iqs.rwth-aachen.de>
License: MIT License
        
        Copyright (c) 2024 Alexander Nasuta
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
Project-URL: Homepage, https://github.com/Alexander-Nasuta/jsp-instance-utils/
Platform: unix
Platform: linux
Platform: osx
Platform: cygwin
Platform: win32
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests
Requires-Dist: numpy
Requires-Dist: ortools
Requires-Dist: beautifulsoup4
Requires-Dist: jsp-vis
Provides-Extra: dev
Requires-Dist: pip-tools; extra == "dev"
Requires-Dist: pytest; extra == "dev"
Requires-Dist: pytest-cov; extra == "dev"
Requires-Dist: tox; extra == "dev"
Requires-Dist: twine; extra == "dev"



<div id="top"></div>

<!-- PROJECT LOGO -->
<br />
<div align="center">
   <!--
  <a href="https://cybernetics-lab.de/">
    <img src="https://github.com/Alexander-Nasuta/graph-jsp-env/raw/master/resources/readme_images/logo.png">
  </a>
   -->

  <h1 align="center">
     Job Shop Scheduling Problem Benchmark Instances
  </h1>


</div>


- **Github**: https://github.com/Alexander-Nasuta/jsp-instance-utils/

- **PyPi**: https://pypi.org/project/jsp-instance-utils/


# About The Project
This project contains all Job Shop Scheduling Problem (JSP) benchmark instances from http://jobshop.jjvh.nl/ and some utility functions to work with JSP instances.
The project contains a parser to read the instances in the `.txt` files with JPS instances in `taillard` and `standard` format.
For more info about the formatting see: http://jobshop.jjvh.nl/explanation.php
The benchmark instances can be imported as a numpy array.
The instances have the shape `(2, n_jobs, n_machines)`, where the last dimension contains the processing time and the release time of the job on the machine.
So the instance-numpy-array consists of two numpy arrays, the first array contains the order of the machines and the second array contains the processing times of the tasks on the machines.
here is a minimal example of how to define a instance:

```python
import numpy as np
custom_jsp_instance = np.array([
    [
        [0, 1, 2, 3],  # job 0 (machine0, machine1, machine2, machine3)
        [0, 2, 1, 3]  # job 1 (machine0, machine1, machine2, machine3)
    ],
    [
        [11, 3, 3, 12],  # task durations of job 0
        [5, 16, 7, 4]  # task durations of job 1
    ]
])

```
# Installation

Install the package with pip:
```
   pip install jsp-instance-utils
```

# Importing a JSP instance OR-tools Solver
`jsp-instance-utils` contains provides a implementation of the OR-tools solver for the JSP in the numpy array format provided by `jsp-instance-utils`.
The following example shows how to import and solve the ft06 instance with the OR-tools solver:

```python
from jsp_instance_utils.instances import ft06
from jsp_instance_utils.jsp_or_tools_solver import solve_jsp

makespan, status, *_ = solve_jsp(jsp_instance=ft06, plot_results=True)

assert status == "OPTIMAL"
assert makespan == 55
```

The code above yields the following output, if the `plot_results` flag is set to `True`:

![](https://raw.githubusercontent.com/Alexander-Nasuta/jsp-instance-utils/main/resources/ft06-or-tools.png)

# Available Instances

All instances are available in the `jsp_instance_utils.instances` module.
You can also find them on this website: http://jobshop.jjvh.nl/

# More Examples
For more examples you can have a look at the test files in the `tests` directory.

# License

Distributed under the MIT License. See `LICENSE.txt` for more information.
[screenshot]: resources/readme_images/screenshot.png


