Skip to content

Commit

Permalink
Update various notebooks
Browse files Browse the repository at this point in the history
  • Loading branch information
alessandrozocca committed Oct 20, 2023
1 parent 8a55ce7 commit 83a5a8d
Show file tree
Hide file tree
Showing 8 changed files with 1,329 additions and 2,420 deletions.
1,223 changes: 99 additions & 1,124 deletions notebooks/03/bim-production-revisited.ipynb

Large diffs are not rendered by default.

301 changes: 155 additions & 146 deletions notebooks/03/shift-scheduling.ipynb

Large diffs are not rendered by default.

34 changes: 19 additions & 15 deletions notebooks/03/simple-production-model-gdp.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,17 @@
"outputs": [],
"source": [
"import sys\n",
"\n",
" \n",
"if 'google.colab' in sys.modules:\n",
" !pip install pyomo >/dev/null 2>/dev/null\n",
" !pip install highspy >/dev/null 2>/dev/null\n",
"\n",
" from pyomo.environ import SolverFactory\n",
" SOLVER = SolverFactory('appsi_highs')\n",
" \n",
"else:\n",
" from pyomo.environ import SolverFactory\n",
" SOLVER = SolverFactory('cbc')\n",
"\n",
"assert SOLVER.available(), f\"Solver {SOLVER} is not available.\""
" \n",
"solver = 'appsi_highs'\n",
" \n",
"import pyomo.environ as pyo\n",
"SOLVER = pyo.SolverFactory(solver)\n",
" \n",
"assert SOLVER.available(), f\"Solver {solver} is not available.\""
]
},
{
Expand Down Expand Up @@ -101,15 +99,15 @@
"\n",
"A small production facility produces two products, $X$ and $Y$. With current technology $\\alpha$, the facility is subject to the following conditions and constraints:\n",
"\n",
"* Product $X$ requires 1 hour of labor A, 2 hours of labor B, and 100$ of raw material. Product $X$ sells for 270$ per unit. The daily demand is limited to 40 units.\n",
"* Product $X$ requires 1 hour of labor A, 2 hours of labor B, and 100\\$ of raw material. Product $X$ sells for 270\\$ per unit. The daily demand is limited to 40 units.\n",
"\n",
"* Product $Y$ requires 1 hour of labor A, 1 hour of labor B, and 90$ of raw material. Product $Y$ sells for 210$ per unit with unlimited demand. \n",
"* Product $Y$ requires 1 hour of labor A, 1 hour of labor B, and 90\\$ of raw material. Product $Y$ sells for 210\\$ per unit with unlimited demand. \n",
"\n",
"* There are 80 hours per day of labor A available at a cost of 50$/hour.\n",
"* There are 80 hours per day of labor A available at a cost of 50\\$/hour.\n",
"\n",
"* There are 100 hours per day of labor B available at a cost of 40$/hour.\n",
"* There are 100 hours per day of labor B available at a cost of 40\\$/hour.\n",
"\n",
"Using the given data we see that the net profit for each unit of $X$ and $Y$ is 40$ and 30$, respectively. The optimal product strategy is the solution to a linear optimization\n",
"Using the given data we see that the net profit for each unit of $X$ and $Y$ is 40\\$ and 30\\$, respectively. The optimal product strategy is the solution to a linear optimization\n",
"\n",
"$$\n",
"\\begin{align*}\n",
Expand All @@ -133,6 +131,8 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Running HiGHS 1.5.3 [date: 2023-05-16, git hash: 594fa5a9d]\n",
"Copyright (c) 2023 HiGHS under MIT licence terms\n",
"Profit = $2600.00\n",
"Production X = 20.0\n",
"Production Y = 60.0\n"
Expand Down Expand Up @@ -232,6 +232,8 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Running HiGHS 1.5.3 [date: 2023-05-16, git hash: 594fa5a9d]\n",
"Copyright (c) 2023 HiGHS under MIT licence terms\n",
"Profit = $3600.00\n",
"Production X = 40.0\n",
"Production Y = 40.0\n"
Expand Down Expand Up @@ -332,6 +334,8 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Running HiGHS 1.5.3 [date: 2023-05-16, git hash: 594fa5a9d]\n",
"Copyright (c) 2023 HiGHS under MIT licence terms\n",
"Profit = $3600.00\n",
"Production X = 40.0\n",
"Production Y = 40.0\n"
Expand Down

This file was deleted.

18 changes: 8 additions & 10 deletions notebooks/04/dinner-seat-allocation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -53,19 +53,17 @@
"outputs": [],
"source": [
"import sys\n",
"\n",
" \n",
"if 'google.colab' in sys.modules:\n",
" !pip install pyomo >/dev/null 2>/dev/null\n",
" !pip install highspy >/dev/null 2>/dev/null\n",
"\n",
" from pyomo.environ import SolverFactory\n",
" SOLVER = SolverFactory('appsi_highs')\n",
" \n",
"else:\n",
" from pyomo.environ import SolverFactory\n",
" SOLVER = SolverFactory('cbc')\n",
"\n",
"assert SOLVER.available(), f\"Solver {SOLVER} is not available.\""
" \n",
"solver = 'appsi_highs'\n",
" \n",
"import pyomo.environ as pyo\n",
"SOLVER = pyo.SolverFactory(solver)\n",
" \n",
"assert SOLVER.available(), f\"Solver {solver} is not available.\""
]
},
{
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Loading

0 comments on commit 83a5a8d

Please sign in to comment.