Skip to content

Commit

Permalink
1.0.0-alpha.5: Merge pull request #15 from development
Browse files Browse the repository at this point in the history
1.0.0-alpha.5: Address issue #14 and improve `Dispatcher` documentation
  • Loading branch information
Pabloo22 authored Nov 7, 2024
2 parents 031bdf3 + 0cb307e commit 0469b65
Show file tree
Hide file tree
Showing 30 changed files with 1,531 additions and 1,319 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ See [this](https://colab.research.google.com/drive/1XV_Rvq1F2ns6DFG8uNj66q_rcoww
Version 1.0.0 is currently in alpha stage and can be installed with:

```bash
pip install job-shop-lib==1.0.0a4
pip install job-shop-lib==1.0.0a5
```

Although this version is not stable and may contain breaking changes in subsequent releases, it is recommended to install it to access the new reinforcement learning environments and familiarize yourself with new changes (see the [latest pull requests](https://github.com/Pabloo22/job_shop_lib/pulls?q=is%3Apr+is%3Aclosed)). This version is the first one with a [documentation page](https://job-shop-lib.readthedocs.io/en/latest/).
Although this version is not stable and may contain breaking changes in subsequent releases, it is recommended to install it to access the new reinforcement learning environments and familiarize yourself with new changes (see the [latest pull requests](https://github.com/Pabloo22/job_shop_lib/pulls?q=is%3Apr+is%3Aclosed)). There is a [documentation page](https://job-shop-lib.readthedocs.io/en/latest/) for versions 1.0.0a3 and onward.

<!-- end installation -->

Expand Down
4 changes: 4 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import os
import sys

from job_shop_lib import __version__

version = __version__ # pylint: disable=invalid-name

sys.path.insert(0, os.path.abspath(".."))

# Configuration file for the Sphinx documentation builder.
Expand Down
10 changes: 5 additions & 5 deletions docs/source/examples/03-Dispatching-Rules.ipynb

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions docs/source/examples/04-Disjunctive-Graph.ipynb

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions docs/source/examples/05-Load-Benchmark-Instances.ipynb

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/source/examples/06-Save-Gif.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -209,7 +209,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "job-shop-lib-gOF0HMZJ-py3.11",
"display_name": "job-shop-lib-gOF0HMZJ-py3.12",
"language": "python",
"name": "python3"
},
Expand Down
10 changes: 5 additions & 5 deletions docs/source/examples/07-Agent-Task-Graph.ipynb

Large diffs are not rendered by default.

66 changes: 32 additions & 34 deletions docs/source/examples/08-Feature-Observers.ipynb

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions docs/source/examples/09-SingleJobShopGraphEnv.ipynb

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions docs/source/examples/10-MultiJobShopGraphEnv.ipynb

Large diffs are not rendered by default.

135 changes: 77 additions & 58 deletions docs/source/examples/11-UnscheduledOperationsObserver.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
" instances: list[JobShopInstance],\n",
" access_unscheduled: Callable[[Dispatcher], None],\n",
") -> float:\n",
" total_time = 0\n",
" total_time = 0.0\n",
" for instance in instances:\n",
" dispatcher = Dispatcher(instance)\n",
" solver = DispatchingRuleSolver(dispatching_rule=\"random\")\n",
Expand Down Expand Up @@ -68,12 +68,21 @@
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"NUMBER_OF_RUNS = 100"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Time taken using dispatcher method: 0.0174 seconds\n"
"Time taken using dispatcher method: 0.0134 seconds\n"
]
}
],
Expand All @@ -82,7 +91,13 @@
" _ = dispatcher.unscheduled_operations()\n",
"\n",
"\n",
"method_time = solve_instances_and_measure_time(instances, access_with_method)\n",
"method_time = (\n",
" sum(\n",
" solve_instances_and_measure_time(instances, access_with_method)\n",
" for _ in range(NUMBER_OF_RUNS)\n",
" )\n",
" / NUMBER_OF_RUNS\n",
")\n",
"print(f\"Time taken using dispatcher method: {method_time:.4f} seconds\")"
]
},
Expand All @@ -97,14 +112,14 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Time taken using observer: 0.0134 seconds\n"
"Time taken using observer: 0.0096 seconds\n"
]
}
],
Expand All @@ -114,8 +129,12 @@
" _ = observer.unscheduled_operations\n",
"\n",
"\n",
"observer_time = solve_instances_and_measure_time(\n",
" instances, access_with_observer\n",
"observer_time = (\n",
" sum(\n",
" solve_instances_and_measure_time(instances, access_with_observer)\n",
" for _ in range(NUMBER_OF_RUNS)\n",
" )\n",
" / NUMBER_OF_RUNS\n",
")\n",
"print(f\"Time taken using observer: {observer_time:.4f} seconds\")"
]
Expand All @@ -131,15 +150,15 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 5,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Speedup factor: 1.30x\n",
"The observer method is 1.30 times faster than the dispatcher method.\n"
"Speedup factor: 1.39x\n",
"The observer method is 1.39 times faster than the dispatcher method.\n"
]
}
],
Expand All @@ -159,7 +178,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -239,7 +258,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 7,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -273,37 +292,37 @@
" <tr>\n",
" <th>0</th>\n",
" <td>ta01</td>\n",
" <td>0.001951</td>\n",
" <td>0.001197</td>\n",
" <td>1.630117</td>\n",
" <td>0.001241</td>\n",
" <td>0.000778</td>\n",
" <td>1.595974</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>ta02</td>\n",
" <td>0.001707</td>\n",
" <td>0.001131</td>\n",
" <td>1.509800</td>\n",
" <td>0.001194</td>\n",
" <td>0.000696</td>\n",
" <td>1.716365</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>ta03</td>\n",
" <td>0.001790</td>\n",
" <td>0.001097</td>\n",
" <td>1.631349</td>\n",
" <td>0.001176</td>\n",
" <td>0.000823</td>\n",
" <td>1.428035</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>ta04</td>\n",
" <td>0.001682</td>\n",
" <td>0.001337</td>\n",
" <td>1.257420</td>\n",
" <td>0.002244</td>\n",
" <td>0.001288</td>\n",
" <td>1.742647</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>ta05</td>\n",
" <td>0.002723</td>\n",
" <td>0.001243</td>\n",
" <td>2.191114</td>\n",
" <td>0.001554</td>\n",
" <td>0.000971</td>\n",
" <td>1.599968</td>\n",
" </tr>\n",
" <tr>\n",
" <th>...</th>\n",
Expand All @@ -315,37 +334,37 @@
" <tr>\n",
" <th>75</th>\n",
" <td>ta76</td>\n",
" <td>0.051289</td>\n",
" <td>0.024095</td>\n",
" <td>2.128598</td>\n",
" <td>0.040594</td>\n",
" <td>0.021201</td>\n",
" <td>1.914774</td>\n",
" </tr>\n",
" <tr>\n",
" <th>76</th>\n",
" <td>ta77</td>\n",
" <td>0.055145</td>\n",
" <td>0.024647</td>\n",
" <td>2.237377</td>\n",
" <td>0.040637</td>\n",
" <td>0.018611</td>\n",
" <td>2.183487</td>\n",
" </tr>\n",
" <tr>\n",
" <th>77</th>\n",
" <td>ta78</td>\n",
" <td>0.052566</td>\n",
" <td>0.025209</td>\n",
" <td>2.085196</td>\n",
" <td>0.039647</td>\n",
" <td>0.019134</td>\n",
" <td>2.072027</td>\n",
" </tr>\n",
" <tr>\n",
" <th>78</th>\n",
" <td>ta79</td>\n",
" <td>0.052468</td>\n",
" <td>0.025190</td>\n",
" <td>2.082875</td>\n",
" <td>0.039633</td>\n",
" <td>0.018028</td>\n",
" <td>2.198378</td>\n",
" </tr>\n",
" <tr>\n",
" <th>79</th>\n",
" <td>ta80</td>\n",
" <td>0.053840</td>\n",
" <td>0.024191</td>\n",
" <td>2.225636</td>\n",
" <td>0.040346</td>\n",
" <td>0.023555</td>\n",
" <td>1.712866</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
Expand All @@ -354,22 +373,22 @@
],
"text/plain": [
" instance_names dispatcher_times observer_times instance_speedups\n",
"0 ta01 0.001951 0.001197 1.630117\n",
"1 ta02 0.001707 0.001131 1.509800\n",
"2 ta03 0.001790 0.001097 1.631349\n",
"3 ta04 0.001682 0.001337 1.257420\n",
"4 ta05 0.002723 0.001243 2.191114\n",
"0 ta01 0.001241 0.000778 1.595974\n",
"1 ta02 0.001194 0.000696 1.716365\n",
"2 ta03 0.001176 0.000823 1.428035\n",
"3 ta04 0.002244 0.001288 1.742647\n",
"4 ta05 0.001554 0.000971 1.599968\n",
".. ... ... ... ...\n",
"75 ta76 0.051289 0.024095 2.128598\n",
"76 ta77 0.055145 0.024647 2.237377\n",
"77 ta78 0.052566 0.025209 2.085196\n",
"78 ta79 0.052468 0.025190 2.082875\n",
"79 ta80 0.053840 0.024191 2.225636\n",
"75 ta76 0.040594 0.021201 1.914774\n",
"76 ta77 0.040637 0.018611 2.183487\n",
"77 ta78 0.039647 0.019134 2.072027\n",
"78 ta79 0.039633 0.018028 2.198378\n",
"79 ta80 0.040346 0.023555 1.712866\n",
"\n",
"[80 rows x 4 columns]"
]
},
"execution_count": 6,
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -388,16 +407,16 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(1.0698642580073283, 0.5022928130001674, 2.1548888368714754)"
"(0.8449087279923333, 0.3913600640034929, 2.2413732582217087)"
]
},
"execution_count": 7,
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -423,7 +442,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "job-shop-lib-gOF0HMZJ-py3.11",
"display_name": "job-shop-lib-gOF0HMZJ-py3.12",
"language": "python",
"name": "python3"
},
Expand All @@ -437,7 +456,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.8"
"version": "3.12.3"
}
},
"nbformat": 4,
Expand Down
20 changes: 7 additions & 13 deletions docs/source/examples/12-ReadyOperationsFilter.ipynb

Large diffs are not rendered by default.

Binary file added docs/source/examples/ft06_solution.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/source/examples/output/example_optimized.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/source/examples/output/example_optimized.mp4
Binary file not shown.
Binary file modified docs/source/examples/output/ft06_optimized.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/source/examples/output/ft06_optimized.mp4
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
Welcome to JobShopLib's documentation!
======================================

**Version:** 1.0.0-a.4
**Version:** |version|


JobShopLib is a Python package for creating, solving, and visualizing
Expand Down
6 changes: 3 additions & 3 deletions docs/source/tutorial/00-Getting-Started.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@
"Machine id: 0\n",
"Duration: 1\n",
"Job id: 0\n",
"Position: 0\n",
"Position in the job: 0\n",
"Operation id: 0\n",
"String representation: O(m=0, d=1, j=0, p=0)\n"
]
Expand All @@ -181,7 +181,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "job-shop-lib-gOF0HMZJ-py3.11",
"display_name": "job-shop-lib-gOF0HMZJ-py3.12",
"language": "python",
"name": "python3"
},
Expand All @@ -195,7 +195,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.8"
"version": "3.12.3"
}
},
"nbformat": 4,
Expand Down
8 changes: 4 additions & 4 deletions docs/source/tutorial/01-How-Solutions-are-Represented.ipynb

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions docs/source/tutorial/02-Solving-the-Problem.ipynb

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions job_shop_lib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,14 @@
from job_shop_lib._base_solver import BaseSolver, Solver


__version__ = "1.0.0-a.5"

__all__ = [
"Operation",
"JobShopInstance",
"ScheduledOperation",
"Schedule",
"Solver",
"BaseSolver",
"__version__",
]
4 changes: 2 additions & 2 deletions job_shop_lib/_job_shop_instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ class JobShopInstance:
jobs (list[list[Operation]]):
A list of lists of operations. Each list of operations represents
a job, and the operations are ordered by their position in the job.
The ``job_id``, ``position_in_job``, and `operation_id` attributes
of the operations are set when the instance is created.
The ``job_id``, ``position_in_job``, and ``operation_id``
attributes of the operations are set when the instance is created.
name (str):
A string with the name of the instance.
metadata (dict[str, Any]):
Expand Down
Loading

0 comments on commit 0469b65

Please sign in to comment.