diff --git a/notebooks/1_maze_tuto.ipynb b/notebooks/11_maze_tuto.ipynb similarity index 100% rename from notebooks/1_maze_tuto.ipynb rename to notebooks/11_maze_tuto.ipynb diff --git a/notebooks/2_gym_tuto.ipynb b/notebooks/12_gym_tuto.ipynb similarity index 100% rename from notebooks/2_gym_tuto.ipynb rename to notebooks/12_gym_tuto.ipynb diff --git a/notebooks/03_scheduling_tuto.ipynb b/notebooks/13_scheduling_tuto.ipynb similarity index 97% rename from notebooks/03_scheduling_tuto.ipynb rename to notebooks/13_scheduling_tuto.ipynb index 3a1c3769ea..b2e576b1a3 100644 --- a/notebooks/03_scheduling_tuto.ipynb +++ b/notebooks/13_scheduling_tuto.ipynb @@ -4,7 +4,22 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "The next cell is patching asyncio so that applications using async functions can run in jupyter or any application haviing " + "# Introduction to scheduling\n", + "\n", + "In this notebook, we explore how to solve a resource constrained project scheduling problem (RCPSP).\n", + "\n", + "The problem is made of $M$ activities that have precedence constraints. That means that if activity $j\\in[1,M]$ is a successor of activity $i\\in[1,M]$, then activity $i$ must be completed before activity $j$ can be started\n", + "\n", + "On top of these constraints, each project is assigned a set of K renewable resources where each resource $k$ is available in $R_{k}$ units for the entire duration of the project. Each activity may require one or more of these resources to be completed. While scheduling the activities, the daily resource usage for resource $k$ can not exceed $R_{k}$ units.\n", + "\n", + "Each activity $j$ takes $d_{j}$ time units to complete.\n", + "\n", + "The overall goal of the problem is usually to minimize the makespan.\n", + "\n", + "A classic variant of RCPSP is the multimode RCPSP where each task can be executed in several ways (one way=one mode). A typical example is :\n", + "\n", + "Mode n°1 'Fast mode': high resource consumption and fast\n", + "Mode n°2 'Slow mode' : low resource consumption but slow" ] }, { @@ -13,17 +28,11 @@ "metadata": {}, "outputs": [], "source": [ + "# patching asyncio so that applications using async functions can run in jupyter\n", "import nest_asyncio\n", "\n", - "nest_asyncio.apply()" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ + "nest_asyncio.apply()\n", + "\n", "import logging\n", "\n", "logging.basicConfig(level=logging.INFO)\n", @@ -32,44 +41,6 @@ "from pprint import pprint" ] }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "# fast testing without installing the lib.\n", - "# import sys\n", - "# sys.path.append(\"../\")" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Introduction to scheduling" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "In this notebook, we explore how to solve a resource constrained project scheduling problem (RCPSP).\n", - "\n", - "The problem is made of $M$ activities that have precedence constraints. That means that if activity $j\\in[1,M]$ is a successor of activity $i\\in[1,M]$, then activity $i$ must be completed before activity $j$ can be started\n", - "\n", - "On top of these constraints, each project is assigned a set of K renewable resources where each resource $k$ is available in $R_{k}$ units for the entire duration of the project. Each activity may require one or more of these resources to be completed. While scheduling the activities, the daily resource usage for resource $k$ can not exceed $R_{k}$ units.\n", - "\n", - "Each activity $j$ takes $d_{j}$ time units to complete.\n", - "\n", - "The overall goal of the problem is usually to minimize the makespan.\n", - "\n", - "A classic variant of RCPSP is the multimode RCPSP where each task can be executed in several ways (one way=one mode). A typical example is :\n", - "\n", - "Mode n°1 'Fast mode': high resource consumption and fast\n", - "Mode n°2 'Slow mode' : low resource consumption but slow" - ] - }, { "attachments": { "image.png": { @@ -79,7 +50,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# A simple problem definition\n", + "## A simple problem definition\n", "\n", "Let start with a very simple problem which has only 5 tasks to execute:\n", "All tasks have specific durations and they can consume 1 type of renewable resources.\n", @@ -101,7 +72,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## Domain definition" + "### Domain definition" ] }, { @@ -190,7 +161,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## Let's create an instance of this domain" + "### Let's create an instance of this domain" ] }, { @@ -297,7 +268,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## Using Lazy Astar to solve this problem" + "### Using Lazy Astar to solve this problem" ] }, { @@ -323,7 +294,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## Result analysis" + "### Result analysis" ] }, { @@ -414,7 +385,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# A slightly more complex problem" + "## A slightly more complex problem" ] }, { @@ -428,7 +399,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## Problem definition" + "### Problem definition" ] }, { @@ -574,7 +545,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## Create an instance of the J301 domain" + "### Create an instance of the J301 domain" ] }, { @@ -592,7 +563,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## Lazy Astar to solve this problem" + "### Lazy Astar to solve this problem" ] }, { @@ -637,7 +608,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## Let's now use a CP solver" + "### Let's now use a CP solver" ] }, { @@ -751,7 +722,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## Plotting the solution\n", + "### Plotting the solution\n", "We rely on discrete_optimization plot utilities (where the CP model is used) to plot the gantt chart of our solution." ] }, @@ -779,7 +750,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## Intermediate Conclusion\n", + "### Intermediate Conclusion\n", "On a problem containing only 32 tasks, an algorithm like $A^{*}$ cannot find a solution while a constraint programming approach takes less than half a second. Let's see what happen on a larger problem. " ] }, @@ -787,14 +758,14 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# Going further : a bigger RCPSP problem" + "## Going further : a bigger RCPSP problem" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "## Psplib files\n", + "### Psplib files\n", "We rely on psplib benchmark files (http://www.om-db.wi.tum.de/psplib/) which containts sets of instances of 30, 60, 90 and 120 activities.\n", "We will now use the ```j12051_1``` file that we identified as a difficult one to solve." ] @@ -803,7 +774,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "### psplib format " + "#### psplib format " ] }, { @@ -833,7 +804,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "### Parsing a psplib file \n", + "#### Parsing a psplib file \n", "We provide a parser for this files so that it is automatically transformed into a RCPSP domain in scikit-decide." ] }, @@ -861,7 +832,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## Using a CP solver again" + "### Using a CP solver again" ] }, { @@ -906,7 +877,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## Using the Large Neighboorhood Search algorithm\n", + "### Using the Large Neighboorhood Search algorithm\n", "\n", "Local search techniques are very effective to solve hard optimization problems. In the context of constraint programming (CP) for optimization problems, one of the most well-known and widely used local search techniques is the Large Neighborhood Search (LNS) algorithm . The basic idea is to iteratively relax a part of the problem, then to use constraint programming to optimize a simpler problem hoping that the reconstructed full solution improve our objective function.\n", "For more insight, you can read this paper [\\[1\\]](https://www.researchgate.net/publication/220462078_LSSPER_Solving_the_Resource-Constrained_Project_Scheduling_Problem_with_Large_Neighbourhood_Search)" @@ -963,7 +934,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# Conclusion\n", + "## Conclusion\n", "\n", "In this notebook, we have seen how to use [scikit-decide](https://airbus.github.io/scikit-decide) to plan tasks. The library offers a binding to a constraint programming (CP) based solver providing optimal solution on small and mid sized benchmark. It reaches its limit for instances with >100 tasks where the use of the approximated solver LNS+CP proves to be effective." ] @@ -971,7 +942,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3 (ipykernel)", + "display_name": "Python 3", "language": "python", "name": "python3" }, @@ -985,20 +956,20 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.12" + "version": "3.7.10" }, "toc": { "base_numbering": 1, "nav_menu": {}, "number_sections": true, "sideBar": true, - "skip_h1_title": false, + "skip_h1_title": true, "title_cell": "Table of Contents", "title_sidebar": "Contents", "toc_cell": false, "toc_position": {}, "toc_section_display": true, - "toc_window_display": false + "toc_window_display": true } }, "nbformat": 4,