From e993c93f4afbb6d772354fca2cd8e6bfe511cf8e Mon Sep 17 00:00:00 2001 From: Laurent Perron Date: Wed, 29 Nov 2017 11:49:13 +0100 Subject: [PATCH] add data file to rcpsp notebook --- examples/notebook/rcpsp_sat.ipynb | 43 ++++++++++++++++++++++++++----- 1 file changed, 37 insertions(+), 6 deletions(-) diff --git a/examples/notebook/rcpsp_sat.ipynb b/examples/notebook/rcpsp_sat.ipynb index 007b536064..dae023bf1e 100644 --- a/examples/notebook/rcpsp_sat.ipynb +++ b/examples/notebook/rcpsp_sat.ipynb @@ -3,9 +3,7 @@ { "cell_type": "code", "execution_count": null, - "metadata": { - "collapsed": false - }, + "metadata": {}, "outputs": [], "source": [ "from __future__ import print_function\n", @@ -13,6 +11,7 @@ "import argparse\n", "from collections import defaultdict\n", "from ortools.sat.python import cp_model\n", + "from ortools.sat.python import visualization\n", "from ortools.data import rcpsp_pb2\n", "from ortools.data import pywraprcpsp\n", "import time\n", @@ -265,14 +264,46 @@ " parser.ParseFile(args.input)\n", " problem = parser.Problem()\n", " SolveRcpsp(problem, args.output_proto)\n", - "\n", + " \n", + " \n", + "class FakeArgs(object):\n", + " def __init__(self):\n", + " self.output_proto = ''\n", + " self.input = '../data/rcpsp/single_mode/j301_1.sm'\n", + " \n", "\n", "if __name__ == '__main__':\n", - " main(parser.parse_args())" + " arguments = FakeArgs() if visualization.RunFromIPython() else parser.parse_args()\n", + " main(arguments)" ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] } ], - "metadata": {}, + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "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.6.2" + } + }, "nbformat": 4, "nbformat_minor": 2 }