Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 82 additions & 15 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.

Welcome to JobShopLib's documentation!
JobShopLib
======================================

**Version:** |version|

.. image:: https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png
Expand All @@ -14,30 +13,98 @@ Welcome to JobShopLib's documentation!
:alt: GitHub
:align: right

JobShopLib is a Python package for creating, solving, and visualizing
Job Shop Scheduling Problems (JSSP).
.. image:: examples/output/ft06_optimized.gif
:alt: JobShopLib example gif
:align: center

JobShopLib is a Python package for **creating**, **solving**, and **visualizing**
job shop scheduling problems.

It provides solvers based on:

- **Graph neural networks** (Gymnasium environment)
- **Dispatching rules**
- **Simulated annealing**
- **Constraint programming** (CP-SAT from Google OR-Tools)

It also includes utilities for:

- **Load benchmark instances**
- **Generating random problems**
- **Gantt charts**
- **Disjunctive graphs** (and any variant)
- Training a GNN-based dispatcher using **reinforcement learning** or **imitation learning**

JobShopLib design is intended to be modular and easy-to-use:

.. code-block:: python

import matplotlib.pyplot as plt
plt.style.use("ggplot")

from job_shop_lib import JobShopInstance, Operation
from job_shop_lib.benchmarking import load_benchmark_instance
from job_shop_lib.generation import GeneralInstanceGenerator
from job_shop_lib.constraint_programming import ORToolsSolver
from job_shop_lib.visualization import plot_gantt_chart, create_gif, plot_gantt_chart_wrapper
from job_shop_lib.dispatching import DispatchingRuleSolver

It follows a modular design, allowing users to easily extend the library
with new solvers, dispatching rules, visualization functions, etc.
# Create your own instance manually,
job_1 = [Operation(machines=0, duration=1), Operation(1, 1), Operation(2, 7)]
job_2 = [Operation(1, 5), Operation(2, 1), Operation(0, 1)]
job_3 = [Operation(2, 1), Operation(0, 3), Operation(1, 2)]
jobs = [job_1, job_2, job_3]
instance = JobShopInstance(jobs)

# load a popular benchmark instance,
ft06 = load_benchmark_instance("ft06")

# or generate a random one.
generator = GeneralInstanceGenerator(
duration_range=(5, 10), seed=42, num_jobs=5, num_machines=5
)
random_instance = generator.generate()

# Solve it using constraint programming,
solver = ORToolsSolver(max_time_in_seconds=10)
ft06_schedule = solver(ft06)

# Visualize the solution as a Gantt chart,
fig, ax = plot_gantt_chart(ft06_schedule)
plt.show()

# or visualize how the solution is built step by step using a dispatching rule.
mwkr_solver = DispatchingRuleSolver("most_work_remaining")
plt.style.use("ggplot")
plot_function = plot_gantt_chart_wrapper(
title="Solution with Most Work Remaining Rule"
)
create_gif( # Creates the gif above
gif_path="ft06_optimized.gif",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The gif_path in this create_gif call is set to "ft06_optimized.gif", which would save the file in the current working directory. However, the .. image:: directive on line 16 points to examples/output/ft06_optimized.gif. To avoid confusion for users who might run this example code, and to ensure the generated GIF is placed where the documentation expects it, you might want to update the path.

Suggested change
gif_path="ft06_optimized.gif",
gif_path="examples/output/ft06_optimized.gif",

instance=ft06,
solver=mwkr_solver,
plot_function=plot_function,
fps=4,
)

See
`this <https://colab.research.google.com/drive/1XV_Rvq1F2ns6DFG8uNj66q_rcowwTZ4H?usp=sharing>`__
Google Colab notebook for a quick start guide!

Installing
-----------

.. code-block:: bash

pip install job_shop_lib

Contents
--------

.. toctree::
:maxdepth: 3
:maxdepth: 1

install
tutorial
examples
api

Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
api
4 changes: 2 additions & 2 deletions docs/source/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ For plotting a disjunctive graph, we recommend using [Graphviz](https://graphviz
- **macOS**: `brew install graphviz`
- **Windows**: `choco install graphviz` or download the installer from the [Graphviz website](https://graphviz.org/download/).

## Developement
## Development

See intructions in the [CONTRIBUTING.md](https://github.com/Pabloo22/job_shop_lib/blob/main/CONTRIBUTING.md) file.
See instructions in the [CONTRIBUTING.md](https://github.com/Pabloo22/job_shop_lib/blob/main/CONTRIBUTING.md) file.