Skip to content

Commit b7dcda2

Browse files
committed
[Docs] Simplify README.md and fix links
Links now will render in PyPI Typo fixed in index.rst too
1 parent 3393742 commit b7dcda2

File tree

2 files changed

+95
-78
lines changed

2 files changed

+95
-78
lines changed

README.md

Lines changed: 94 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div align="center">
22

3-
<img src="docs/source/images/jslib_minimalist_logo_no_background_fixed.png" height="150px">
3+
<img src="https://raw.githubusercontent.com/Pabloo22/job_shop_lib/main/docs/source/images/jslib_minimalist_logo_no_background_fixed.png" height="150px">
44

55
<h1>JobShopLib</h1>
66

@@ -11,60 +11,93 @@
1111
[![Black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
1212
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
1313

14+
<img src="https://raw.githubusercontent.com/Pabloo22/job_shop_lib/main/docs/source/examples/output/ft06_optimized.gif" alt="Example Gif">
1415
</div>
1516

16-
JobShopLib is a Python package for creating, solving, and visualizing job shop scheduling problems (JSSP).
17+
JobShopLib is a Python package for **creating**, **solving**, and **visualizing**
18+
job shop scheduling problems.
1719

18-
It follows a modular design, allowing users to easily extend the library with new solvers, dispatching rules, visualization functions, etc.
20+
It provides solvers based on:
1921

20-
We support multiple solvers, including:
21-
- **Constraint Programming**: Based on OR-Tools' CP-SAT solver. It supports **release dates, deadlines, and due dates.** See the ["Solving the Problem" tutorial](https://github.com/Pabloo22/job_shop_lib/blob/main/docs/source/tutorial/02-Solving-the-Problem.ipynb) for an example.
22-
- **Dispatching Rules**: A set of predefined rules and the ability to create custom ones. They support arbitrary **setup times, machine breakdowns, release dates, deadlines, and due dates**. See the [following example](https://github.com/Pabloo22/job_shop_lib/blob/main/docs/source/examples/03-Dispatching-Rules.ipynb). You can also create videos or GIFs of the scheduling process. For creating GIFs or videos, see the [Save Gif example](https://github.com/Pabloo22/job_shop_lib/blob/main/docs/source/examples/04-Save-Gif.ipynb).
23-
- **Metaheuristics**: Currently, we have a **simulated annealing** implementation that supports **release dates, deadlines, and due dates**. We also support arbitrary neighborhood search strategies, including swapping operations in the critical path as described in the paper "Job Shop Scheduling by Simulated Annealing" by van Laarhoven et al. (1992); and energy functions. See our [simulated annealing tutorial](https://github.com/Pabloo22/job_shop_lib/blob/main/docs/source/tutorial/04-Simulated-Annealing.ipynb).
24-
- **Reinforcement Learning**: Two Gymnasium environments for solving the problem with **graph neural networks** (GNNs) or any other method. The environments support **setup times, release dates, deadlines, and due dates.** We're currently building a tutorial on how to use them.
22+
- **Graph neural networks** (Gymnasium environment)
23+
- **Dispatching rules**
24+
- **Simulated annealing**
25+
- **Constraint programming** (CP-SAT from Google OR-Tools)
2526

26-
We also provide useful utilities, data structures, and visualization functions:
27-
- **Intuitive Data Structures**: Easily create, manage, and manipulate job shop instances and solutions with user-friendly data structures. See [Getting Started](https://github.com/Pabloo22/job_shop_lib/blob/main/docs/source/tutorial/00-Getting-Started.ipynb) and [How Solutions are Represented](https://github.com/Pabloo22/job_shop_lib/blob/main/docs/source/tutorial/01-How-Solutions-are-Represented.ipynb).
28-
- **Benchmark Instances**: Load well-known benchmark instances directly from the library without manual downloading. See [Load Benchmark Instances](https://github.com/Pabloo22/job_shop_lib/blob/main/docs/source/examples/05-Load-Benchmark-Instances.ipynb).
29-
- **Random Instance Generation**: Create random instances with customizable sizes and properties. See [`this tutorial`](https://github.com/Pabloo22/job_shop_lib/blob/main/docs/source/tutorial/03-Generating-New-Instances.ipynb).
30-
- **Gantt Charts**: Visualize final schedules and how they are created iteratively by dispatching rule solvers or sequences of scheduling decisions with GIFs or videos.
31-
- **Graph Representations**: Represent and visualize instances as disjunctive graphs or agent-task graphs (introduced in the ScheduleNet paper). Build your own custom graphs with the `JobShopGraph` class. See the [Disjunctive Graphs](https://github.com/Pabloo22/job_shop_lib/blob/main/docs/source/tutorial/04-Disjunctive-Graphs.ipynb) and [Resource Task Graphs](https://job-shop-lib.readthedocs.io/en/stable/examples/07-Resource-Task-Graph.html) examples.
27+
It also includes utilities for:
3228

33-
## Installation :package:
29+
- **Load benchmark instances**
30+
- **Generating random problems**
31+
- **Gantt charts**
32+
- **Disjunctive graphs** (and any variant)
33+
- Training a GNN-based dispatcher using **reinforcement learning** or **imitation learning**
3434

35-
<!-- start installation -->
35+
It supports:
36+
- **Multi-machine operations**
37+
- **Release dates**
38+
- **Deadlines and due dates**
3639

37-
```bash
38-
pip install job-shop-lib
39-
```
40+
JobShopLib's design is intended to be modular and easy-to-use:
4041

41-
or
4242

43-
```bash
44-
poetry add job-shop-lib
45-
```
43+
```python
44+
import matplotlib.pyplot as plt
45+
plt.style.use("ggplot")
4646

47-
<!-- end installation -->
47+
from job_shop_lib import JobShopInstance, Operation
48+
from job_shop_lib.benchmarking import load_benchmark_instance
49+
from job_shop_lib.generation import GeneralInstanceGenerator
50+
from job_shop_lib.constraint_programming import ORToolsSolver
51+
from job_shop_lib.visualization import plot_gantt_chart, create_gif, plot_gantt_chart_wrapper
52+
from job_shop_lib.dispatching import DispatchingRuleSolver
4853

49-
## Publication :scroll:
54+
# Create your own instance manually,
55+
job_1 = [Operation(machines=0, duration=1), Operation(1, 1), Operation(2, 7)]
56+
job_2 = [Operation(1, 5), Operation(2, 1), Operation(0, 1)]
57+
job_3 = [Operation(2, 1), Operation(0, 3), Operation(1, 2)]
58+
jobs = [job_1, job_2, job_3]
59+
instance = JobShopInstance(jobs)
5060

51-
For an in-depth explanation of the library (v1.0.0), including its design, features, reinforcement learning environments, and some experiments, please refer to my [Bachelor's thesis](https://www.arxiv.org/abs/2506.13781).
61+
# load a popular benchmark instance,
62+
ft06 = load_benchmark_instance("ft06")
5263

53-
You can also cite the library using the following BibTeX entry:
64+
# or generate a random one.
65+
generator = GeneralInstanceGenerator(
66+
duration_range=(5, 10), seed=42, num_jobs=5, num_machines=5
67+
)
68+
random_instance = generator.generate()
5469

55-
```bibtex
56-
@misc{arino2025jobshoplib,
57-
title={Solving the Job Shop Scheduling Problem with Graph Neural Networks: A Customizable Reinforcement Learning Environment},
58-
author={Pablo Ariño Fernández},
59-
year={2025},
60-
eprint={2506.13781},
61-
archivePrefix={arXiv},
62-
primaryClass={cs.LG},
63-
url={https://arxiv.org/abs/2506.13781},
64-
}
70+
# Solve it using constraint programming,
71+
solver = ORToolsSolver(max_time_in_seconds=10)
72+
ft06_schedule = solver(ft06)
73+
74+
# Visualize the solution as a Gantt chart,
75+
fig, ax = plot_gantt_chart(ft06_schedule)
76+
plt.show()
77+
78+
# or visualize how the solution is built step by step using a dispatching rule.
79+
mwkr_solver = DispatchingRuleSolver("most_work_remaining")
80+
plt.style.use("ggplot")
81+
plot_function = plot_gantt_chart_wrapper(
82+
title="Solution with Most Work Remaining Rule"
83+
)
84+
create_gif( # Creates the gif above
85+
gif_path="ft06_optimized.gif",
86+
instance=ft06,
87+
solver=mwkr_solver,
88+
plot_function=plot_function,
89+
fps=4,
90+
)
6591
```
6692

67-
## Some Examples :rocket:
93+
## Installing :package:
94+
<!-- start installation -->
95+
```bash
96+
pip install job-shop-lib
97+
```
98+
<!-- end installation -->
99+
100+
## Quick Start :rocket:
68101

69102
### Create a Job Shop Instance
70103

@@ -170,11 +203,11 @@ ft06_schedule = solver(ft06)
170203
fig, ax = plot_gantt_chart(ft06_schedule)
171204
plt.show()
172205
```
173-
![Example Gannt Chart](docs/source/images/ft06_solution.png)
206+
![Example Gannt Chart](https://raw.githubusercontent.com/Pabloo22/job_shop_lib/main/docs/source/images/ft06_solution.png)
174207

175208
### Solve an Instance with a Dispatching Rule Solver
176209

177-
A dispatching rule is a heuristic guideline used to prioritize and sequence jobs on various machines. Supported dispatching rules are:
210+
A dispatching rule is a heuristic guideline used to prioritize and sequence jobs on various machines. Supported dispatching rules are (although you can also create your own):
178211

179212
```python
180213
class DispatchingRule(str, Enum):
@@ -207,7 +240,7 @@ create_gif(
207240
)
208241
```
209242

210-
![Example Gif](docs/source/examples/output/ft06_optimized.gif)
243+
![Example Gif](https://raw.githubusercontent.com/Pabloo22/job_shop_lib/main/docs/source/examples/output/ft06_optimized.gif)
211244

212245
The dashed red line represents the current time step, which is computed as the earliest time when the next operation can start.
213246

@@ -219,14 +252,8 @@ The dashed red line represents the current time step, which is computed as the e
219252

220253
One of the main purposes of this library is to provide an easy way to encode instances as graphs. This can be very useful, not only for visualization purposes but also for developing graph neural network-based algorithms.
221254

222-
A graph is represented by the `JobShopGraph` class, which internally stores a `networkx.DiGraph` object.
223-
224255
#### Disjunctive Graph
225256

226-
The disjunctive graph is created by first adding nodes representing each operation in the jobs, along with two special nodes: a source $S$ and a sink $T$. Each operation node is linked to the next operation in its job sequence by **conjunctive edges**, forming a path from the source to the sink. These edges represent the order in which operations of a single job must be performed.
227-
228-
Additionally, the graph includes **disjunctive edges** between operations that use the same machine but belong to different jobs. These edges are bidirectional, indicating that either of the connected operations can be performed first. The disjunctive edges thus represent the scheduling choices available: the order in which operations sharing a machine can be processed. Solving the job shop scheduling problem involves choosing a direction for each disjunctive edge such that the overall processing time is minimized.
229-
230257
```python
231258
from job_shop_lib.visualization import plot_disjunctive_graph
232259

@@ -242,39 +269,12 @@ fig = plot_disjunctive_graph(
242269
plt.show()
243270
```
244271

245-
![Example Disjunctive Graph](docs/source/images/example_disjunctive_graph.png)
272+
![Example Disjunctive Graph](https://raw.githubusercontent.com/Pabloo22/job_shop_lib/main/docs/source/images/example_disjunctive_graph.png)
246273

247274

248275
> [!TIP]
249276
> Installing the optional dependency [PyGraphViz](https://pygraphviz.github.io/) is recommended.
250277
251-
The `JobShopGraph` class provides easy access to the nodes, for example, to get all the nodes of a specific type:
252-
253-
```python
254-
from job_shop_lib.graphs import build_disjunctive_graph
255-
256-
disjunctive_graph = build_disjunctive_graph(instance)
257-
258-
>>> disjunctive_graph.nodes_by_type
259-
defaultdict(list,
260-
{<NodeType.OPERATION: 1>: [Node(node_type=OPERATION, value=O(m=0, d=1, j=0, p=0), id=0),
261-
Node(node_type=OPERATION, value=O(m=1, d=1, j=0, p=1), id=1),
262-
Node(node_type=OPERATION, value=O(m=2, d=7, j=0, p=2), id=2),
263-
Node(node_type=OPERATION, value=O(m=1, d=5, j=1, p=0), id=3),
264-
Node(node_type=OPERATION, value=O(m=2, d=1, j=1, p=1), id=4),
265-
Node(node_type=OPERATION, value=O(m=0, d=1, j=1, p=2), id=5),
266-
Node(node_type=OPERATION, value=O(m=2, d=1, j=2, p=0), id=6),
267-
Node(node_type=OPERATION, value=O(m=0, d=3, j=2, p=1), id=7),
268-
Node(node_type=OPERATION, value=O(m=1, d=2, j=2, p=2), id=8)],
269-
<NodeType.SOURCE: 5>: [Node(node_type=SOURCE, value=None, id=9)],
270-
<NodeType.SINK: 6>: [Node(node_type=SINK, value=None, id=10)]})
271-
```
272-
273-
Other attributes include:
274-
- `nodes`: A list of all nodes in the graph.
275-
- `nodes_by_machine`: A nested list mapping each machine to its associated operation nodes, aiding in machine-specific analysis.
276-
- `nodes_by_job`: Similar to `nodes_by_machine`, but maps jobs to their operation nodes, useful for job-specific traversal.
277-
278278
#### Resource-Task Graph
279279

280280
Introduced in the paper "ScheduleNet: Learn to solve multi-agent scheduling problems with reinforcement learning" by [Park et al. (2021)](https://arxiv.org/abs/2106.03051), the resource-task graph (orginally named "agent-task graph") is a graph that represents the scheduling problem as a multi-agent reinforcement learning problem.
@@ -301,7 +301,7 @@ plt.show()
301301
```
302302

303303
<div align="center">
304-
<img src="docs/source/examples/output/agent_task_graph.png" width="300">
304+
<img src="https://raw.githubusercontent.com/Pabloo22/job_shop_lib/main/docs/source/examples/output/agent_task_graph.png" width="300">
305305
</div>
306306
<br>
307307

@@ -312,7 +312,7 @@ The library generalizes this graph by allowing the addition of job nodes and a g
312312
### Gymnasium Environments
313313

314314
<div align="center">
315-
<img src="docs/source/images/rl_diagram.png">
315+
<img src="https://raw.githubusercontent.com/Pabloo22/job_shop_lib/main/docs/source/images/rl_diagram.png">
316316
</div>
317317
<br>
318318

@@ -390,6 +390,23 @@ Any contribution is welcome, whether it's a small bug or documentation fix or a
390390

391391
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
392392

393+
## Publication :scroll:
394+
395+
For an in-depth explanation of the library (v1.0.0), including its design, features, reinforcement learning environments, and some experiments, please refer to https://www.arxiv.org/abs/2506.13781.
396+
397+
You can also cite the library using the following BibTeX entry:
398+
399+
```bibtex
400+
@misc{arino2025jobshoplib,
401+
title={Solving the Job Shop Scheduling Problem with Graph Neural Networks: A Customizable Reinforcement Learning Environment},
402+
author={Pablo Ariño Fernández},
403+
year={2025},
404+
eprint={2506.13781},
405+
archivePrefix={arXiv},
406+
primaryClass={cs.LG},
407+
url={https://arxiv.org/abs/2506.13781},
408+
}
409+
```
393410

394411
## References :books:
395412

docs/source/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ It also includes utilities for:
3535
- **Disjunctive graphs** (and any variant)
3636
- Training a GNN-based dispatcher using **reinforcement learning** or **imitation learning**
3737

38-
JobShopLib design is intended to be modular and easy-to-use:
38+
JobShopLib's design is intended to be modular and easy-to-use:
3939

4040
.. code-block:: python
4141

0 commit comments

Comments
 (0)