Skip to content

Commit

Permalink
Fix Colab rendering errors (\textup and \bm)
Browse files Browse the repository at this point in the history
  • Loading branch information
alessandrozocca committed Jan 15, 2024
1 parent c57920b commit ab937d7
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 27 deletions.
11 changes: 6 additions & 5 deletions notebooks/03/02-shift-scheduling.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,15 @@
"outputs": [],
"source": [
"import sys\n",
" \n",
"if 'google.colab' in sys.modules:\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",
"solver = 'appsi_highs'\n",
"\n",
"solver = \"appsi_highs\"\n",
"\n",
"import pyomo.environ as pyo\n",
"\n",
"SOLVER = pyo.SolverFactory(solver)\n",
"\n",
"assert SOLVER.available(), f\"Solver {solver} is not available.\""
Expand Down Expand Up @@ -97,7 +98,7 @@
"source": [
"### Model sets\n",
"\n",
"Assuming that we have $N$ available workers, the problem requires the assignment of these available workers to a predetermined set of shifts with specific staffing requirements. Let $\\textup{R}_{d, s}$ describe the minimum number of workers required for the day-shift pair $(d, s)$.\n",
"Assuming that we have $N$ available workers, the problem requires the assignment of these available workers to a predetermined set of shifts with specific staffing requirements. Let $\\text{R}_{d, s}$ describe the minimum number of workers required for the day-shift pair $(d, s)$.\n",
"\n",
"There are three shifts per day, seven days per week. These observations suggest the need for three ordered sets:\n",
"\n",
Expand Down
15 changes: 8 additions & 7 deletions notebooks/03/05-machine-scheduling.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,15 @@
"outputs": [],
"source": [
"import sys\n",
" \n",
"if 'google.colab' in sys.modules:\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",
"solver = 'appsi_highs'\n",
" \n",
"\n",
"solver = \"appsi_highs\"\n",
"\n",
"import pyomo.environ as pyo\n",
"\n",
"SOLVER = pyo.SolverFactory(solver)\n",
"\n",
"assert SOLVER.available(), f\"Solver {solver} is not available.\""
Expand Down Expand Up @@ -813,8 +814,8 @@
"\n",
"$$\n",
"\\begin{align*}\n",
"\\textup{finish}_i & \\leq \\textup{start}_j + M z_{ij} \\\\\n",
"\\textup{finish}_j & \\leq \\textup{start}_i + M (1 - z_{ij}).\n",
"\\text{finish}_i & \\leq \\text{start}_j + M z_{ij} \\\\\n",
"\\text{finish}_j & \\leq \\text{start}_i + M (1 - z_{ij}).\n",
"\\end{align*}\n",
"$$\n",
"\n",
Expand Down
13 changes: 7 additions & 6 deletions notebooks/03/07-bim-production-revisited.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,15 @@
"outputs": [],
"source": [
"import sys\n",
" \n",
"if 'google.colab' in sys.modules:\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",
"solver = 'appsi_highs'\n",
" \n",
"\n",
"solver = \"appsi_highs\"\n",
"\n",
"import pyomo.environ as pyo\n",
"\n",
"SOLVER = pyo.SolverFactory(solver)\n",
"\n",
"assert SOLVER.available(), f\"Solver {solver} is not available.\""
Expand Down Expand Up @@ -520,7 +521,7 @@
"\\begin{align*}\n",
" \\min \\quad & \\sum_{t \\in T} \\Big( \\Big( \\sum_{s \\in S} \\pi_{s} b_{ts} + \\alpha_{s} y_{ts} \\Big) - \\beta p_t \\Big) +&\n",
" \\sum_{t \\in T} \\Big ( \\gamma_{\\text{copper}} r_t + \\sum_{p \\in P \\setminus \\{ \\text{copper}\\}} \\gamma_{p} s_{pt} \\Big) \\\\\n",
" \\textup{s.t.} \\quad \n",
" \\text{s.t.} \\quad \n",
" & \\sum_{p \\in P \\setminus \\{ \\text{copper}\\}} x_{pts} \\leq 100 \\cdot b_{ts} & \\forall \\, t \\in T, \\, \\forall \\, s \\in S\\\\\n",
" & s_{\\text{copper}, t} \\leq 10 \\cdot r_t & \\forall \\, t \\in T\\\\\n",
" & s_{\\text{copper}, t} \\leq 10000 & \\forall \\, t \\in T\\\\\n",
Expand Down
19 changes: 10 additions & 9 deletions notebooks/10/02-two-stage-production-planning.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,15 @@
"outputs": [],
"source": [
"import sys\n",
" \n",
"if 'google.colab' in sys.modules:\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",
"solver = 'appsi_highs'\n",
" \n",
"solver = \"appsi_highs\"\n",
"\n",
"import pyomo.environ as pyo\n",
"\n",
"SOLVER = pyo.SolverFactory(solver)\n",
"\n",
"assert SOLVER.available(), f\"Solver {solver} is not available.\""
Expand Down Expand Up @@ -204,9 +205,9 @@
"\\begin{align*}\n",
"x = \\begin{pmatrix} x \\end{pmatrix},\n",
"\\\n",
"\\bm{y} = \\begin{pmatrix} y_1 \\\\ y_2 \\\\ y_3 \\end{pmatrix},\n",
"y = \\begin{pmatrix} y_1 \\\\ y_2 \\\\ y_3 \\end{pmatrix},\n",
"\\\n",
"\\bm{z} = \\begin{pmatrix} z_A \\\\ z_B \\\\ z_D \\end{pmatrix}\n",
"z = \\begin{pmatrix} z_A \\\\ z_B \\\\ z_D \\end{pmatrix}\n",
"\\end{align*}\n",
"$$\n",
"\n",
Expand All @@ -221,11 +222,11 @@
"\n",
"$$\n",
"\\begin{align*}\n",
"R(\\bm{z}) = \\begin{pmatrix} 0 \\\\ 0 \\\\ 0 \\\\ 0 \\\\ -1 \\end{pmatrix}, \n",
"R(z) = \\begin{pmatrix} 0 \\\\ 0 \\\\ 0 \\\\ 0 \\\\ -1 \\end{pmatrix}, \n",
"\\\n",
"S(\\bm{z}) = \\begin{pmatrix} - (140 - 50z_A - 80z_B) & - (120 - 50z_A - 40z_B) & 1 \\\\ 1 & 0 & 0 \\\\ 1+z_A & 1 + z_A & 0 \\\\ 2(1+z_B) & 1 + z_B & 0 \\\\ 10 & 9 & 0 \\end{pmatrix},\n",
"S(z) = \\begin{pmatrix} - (140 - 50z_A - 80z_B) & - (120 - 50z_A - 40z_B) & 1 \\\\ 1 & 0 & 0 \\\\ 1+z_A & 1 + z_A & 0 \\\\ 2(1+z_B) & 1 + z_B & 0 \\\\ 10 & 9 & 0 \\end{pmatrix},\n",
"\\\n",
"t(\\bm{z}) = \\begin{pmatrix} 0 \\\\ -20(1+z_D) \\\\ 80 \\\\ 100 \\\\ 0 \\end{pmatrix} \\\\\n",
"t(z) = \\begin{pmatrix} 0 \\\\ -20(1+z_D) \\\\ 80 \\\\ 100 \\\\ 0 \\end{pmatrix} \\\\\n",
"\\end{align*}\n",
"$$"
]
Expand Down

0 comments on commit ab937d7

Please sign in to comment.