{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Flowshop sample" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We start by importing the corresponding jobshop problem module as following :" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "%load_ext autoreload\n", "%autoreload 2\n", "import pyscheduling.FS.FmCmax as fs" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We can either import the instance from a text file or randomly generate it." ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "instance = fs.FmCmax_Instance.generate_random(5,2)\n", "instance.to_txt(\"deleteMe.txt\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Finally, we use one of the implemented methods which are found in either **Heuristics** or **Metaheuristics** classes as following :" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Search stopped with status : FEASIBLE\n", " Solution is : \n", " Objective : 100\n", "Jobs sequence : 0\t3\t2\t1\t4\n", "Machine_ID | Job_schedule (job_id , start_time , completion_time) | Completion_time\n", "(0, 0, 4) : (3, 4, 14) : (2, 14, 25) : (1, 25, 43) : (4, 43, 75) | 75\n", "(0, 4, 34) : (3, 34, 66) : (2, 66, 85) : (1, 85, 97) : (4, 97, 100) | 100 \n", "Runtime is : 4.9900000007596645e-05s \n", "time to best is : -1s \n", "\n" ] } ], "source": [ "solution = fs.Heuristics.slope(instance)\n", "print(solution)" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3.9.12 ('pyscheduling')", "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.9.12" }, "orig_nbformat": 4, "vscode": { "interpreter": { "hash": "fa7cdbb78ab82d427a6b02c171e3c48e0658c2b720f18feff16576a8f3200f32" } } }, "nbformat": 4, "nbformat_minor": 2 }