-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit fa8abef
Showing
282 changed files
with
59,880 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Sphinx build info version 1 | ||
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. | ||
config: 7f44addf40977a20ba6f0964f170c40a | ||
tags: 645f666f9bcd5a90fca523b33c5a78b7 |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,203 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# Getting Started to Job Shop Lib\n", | ||
"\n", | ||
"The main class of the library is the `JobShopInstance` class, which stores a list of jobs and its `Operations`.\n", | ||
"\n", | ||
"Each operation is also a class, which stores the machine(s) in which the operation can be processed and its duration (also known as processing time). Let's see an example of how to use the `JobShopInstance` class to model a JSSP instance.\n", | ||
"\n", | ||
"In this example, we model a simple Job Shop Scheduling Problem using the `JobShopInstance` class. We define three types of machines: CPU, GPU, and Data Center, each represented by a unique identifier." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"JobShopInstance(name=Example, num_jobs=3, num_machines=3)" | ||
] | ||
}, | ||
"execution_count": 1, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"from job_shop_lib import JobShopInstance, Operation\n", | ||
"\n", | ||
"CPU = 0\n", | ||
"GPU = 1\n", | ||
"DATA_CENTER = 2\n", | ||
"\n", | ||
"job_1 = [Operation(CPU, 1), Operation(GPU, 1), Operation(DATA_CENTER, 7)]\n", | ||
"job_2 = [Operation(GPU, 5), Operation(DATA_CENTER, 1), Operation(CPU, 1)]\n", | ||
"job_3 = [Operation(DATA_CENTER, 1), Operation(CPU, 3), Operation(GPU, 2)]\n", | ||
"\n", | ||
"jobs = [job_1, job_2, job_3]\n", | ||
"\n", | ||
"instance = JobShopInstance(\n", | ||
" jobs,\n", | ||
" name=\"Example\",\n", | ||
" # Any extra parameters are stored inside the\n", | ||
" # metadata attribute as a dictionary:\n", | ||
" lower_bound=7,\n", | ||
")\n", | ||
"instance" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"The job and its position in it are automatically inferred. Now, we can access to some stats of the instance:" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"Number of jobs: 3\n", | ||
"Number of machines: 3\n", | ||
"Number of operations: 9\n", | ||
"Name: Example\n", | ||
"Is flexible?: False\n", | ||
"Max operation time: 7\n", | ||
"Machine loads: [5, 8, 9]\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"print(\"Number of jobs:\", instance.num_jobs)\n", | ||
"print(\"Number of machines:\", instance.num_machines)\n", | ||
"print(\"Number of operations:\", instance.num_operations)\n", | ||
"print(\"Name:\", instance.name)\n", | ||
"print(\"Is flexible?:\", instance.is_flexible)\n", | ||
"print(\"Max operation time:\", instance.max_duration)\n", | ||
"print(\"Machine loads:\", instance.machine_loads)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 3, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"array([[1, 1, 7],\n", | ||
" [5, 1, 1],\n", | ||
" [1, 3, 2]])" | ||
] | ||
}, | ||
"execution_count": 3, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"import numpy as np\n", | ||
"\n", | ||
"np.array(instance.durations_matrix)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 4, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"array([[0, 1, 2],\n", | ||
" [1, 2, 0],\n", | ||
" [2, 0, 1]])" | ||
] | ||
}, | ||
"execution_count": 4, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"np.array(instance.machines_matrix)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"Some of this attributes could take $O(num\\_operations)$ to compute. This is the reason we use the `functools.cached_property` decorator to cache the results of the computation of these attributes." | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"Note that we just had to specify the machines in which the operation can be processed and its duration. The `job_id` and the position of the operation in the job are automatically inferred by the `JobShopInstance` class." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 5, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"Machine id: 0\n", | ||
"Duration: 1\n", | ||
"Job id: 0\n", | ||
"Position: 0\n", | ||
"Operation id: 0\n", | ||
"String representation: O(m=0, d=1, j=0, p=0)\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"first_operation = job_1[0]\n", | ||
"print(\"Machine id:\", first_operation.machine_id)\n", | ||
"print(\"Duration:\", first_operation.duration)\n", | ||
"# If the operation only has one machine, we can use the `machine_id` property\n", | ||
"# instead of the `machines` attribute:\n", | ||
"print(\"Job id:\", first_operation.job_id)\n", | ||
"print(\"Position:\", first_operation.position_in_job)\n", | ||
"print(\"Operation id:\", first_operation.operation_id)\n", | ||
"print(\"String representation:\", str(first_operation))" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "job-shop-lib-gOF0HMZJ-py3.11", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.11.8" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
237 changes: 237 additions & 0 deletions
237
.doctrees/nbsphinx/examples/01-How-Solutions-are-Represented.ipynb
Large diffs are not rendered by default.
Oops, something went wrong.
194 changes: 194 additions & 0 deletions
194
.doctrees/nbsphinx/examples/02-Solving-the-Problem.ipynb
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.