Skip to content

Commit

Permalink
Update notebooks' preamble
Browse files Browse the repository at this point in the history
  • Loading branch information
alessandrozocca committed Nov 20, 2023
1 parent a9be9c6 commit 9d1896f
Show file tree
Hide file tree
Showing 37 changed files with 555 additions and 525 deletions.
29 changes: 11 additions & 18 deletions notebooks/02/L1-regression-wine-quality.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,7 @@
"source": [
"## Preamble: Install Pyomo and a solver\n",
"\n",
"This cell selects and verifies a global SOLVER for the notebook.\n",
"\n",
"If run on Google Colab, the cell installs Pyomo and HiGHS, then sets SOLVER to \n",
"use the Highs solver via the appsi module. If run elsewhere, it assumes Pyomo and CBC\n",
"have been previously installed and sets SOLVER to use the CBC solver via the Pyomo \n",
"SolverFactory. It then verifies that SOLVER is available."
"The following cell sets and verifies a global SOLVER for the notebook. If run on Google Colab, the cell installs Pyomo and the HiGHS solver, while, if run elsewhere, it assumes Pyomo and HiGHS have been previously installed. It then sets to use HiGHS as solver via the appsi module and a test is performed to verify that it is available. The solver interface is stored in a global object `SOLVER` for later use."
]
},
{
Expand All @@ -45,19 +40,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.\""
" %pip install pyomo >/dev/null 2>/dev/null\n",
" %pip install highspy >/dev/null 2>/dev/null\n",
" \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
29 changes: 11 additions & 18 deletions notebooks/02/bim-dual.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,7 @@
"source": [
"## Preamble: Install Pyomo and a solver\n",
"\n",
"This cell selects and verifies a global SOLVER for the notebook.\n",
"\n",
"If run on Google Colab, the cell installs Pyomo and HiGHS, then sets SOLVER to \n",
"use the Highs solver via the appsi module. If run elsewhere, it assumes Pyomo and CBC\n",
"have been previously installed and sets SOLVER to use the CBC solver via the Pyomo \n",
"SolverFactory. It then verifies that SOLVER is available."
"The following cell sets and verifies a global SOLVER for the notebook. If run on Google Colab, the cell installs Pyomo and the HiGHS solver, while, if run elsewhere, it assumes Pyomo and HiGHS have been previously installed. It then sets to use HiGHS as solver via the appsi module and a test is performed to verify that it is available. The solver interface is stored in a global object `SOLVER` for later use."
]
},
{
Expand All @@ -46,19 +41,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.\""
" %pip install pyomo >/dev/null 2>/dev/null\n",
" %pip install highspy >/dev/null 2>/dev/null\n",
" \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
29 changes: 11 additions & 18 deletions notebooks/02/bim-fractional.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,7 @@
"source": [
"## Preamble: Install Pyomo and a solver\n",
"\n",
"This cell selects and verifies a global SOLVER for the notebook.\n",
"\n",
"If run on Google Colab, the cell installs Pyomo and HiGHS, then sets SOLVER to \n",
"use the Highs solver via the appsi module. If run elsewhere, it assumes Pyomo and CBC\n",
"have been previously installed and sets SOLVER to use the CBC solver via the Pyomo \n",
"SolverFactory. It then verifies that SOLVER is available."
"The following cell sets and verifies a global SOLVER for the notebook. If run on Google Colab, the cell installs Pyomo and the HiGHS solver, while, if run elsewhere, it assumes Pyomo and HiGHS have been previously installed. It then sets to use HiGHS as solver via the appsi module and a test is performed to verify that it is available. The solver interface is stored in a global object `SOLVER` for later use."
]
},
{
Expand All @@ -39,19 +34,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.\""
" %pip install pyomo >/dev/null 2>/dev/null\n",
" %pip install highspy >/dev/null 2>/dev/null\n",
" \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
29 changes: 11 additions & 18 deletions notebooks/02/bim-maxmin.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,7 @@
"source": [
"## Preamble: Install Pyomo and a solver\n",
"\n",
"This cell selects and verifies a global SOLVER for the notebook.\n",
"\n",
"If run on Google Colab, the cell installs Pyomo and HiGHS, then sets SOLVER to \n",
"use the Highs solver via the appsi module. If run elsewhere, it assumes Pyomo and CBC\n",
"have been previously installed and sets SOLVER to use the CBC solver via the Pyomo \n",
"SolverFactory. It then verifies that SOLVER is available."
"The following cell sets and verifies a global SOLVER for the notebook. If run on Google Colab, the cell installs Pyomo and the HiGHS solver, while, if run elsewhere, it assumes Pyomo and HiGHS have been previously installed. It then sets to use HiGHS as solver via the appsi module and a test is performed to verify that it is available. The solver interface is stored in a global object `SOLVER` for later use."
]
},
{
Expand All @@ -39,19 +34,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.\""
" %pip install pyomo >/dev/null 2>/dev/null\n",
" %pip install highspy >/dev/null 2>/dev/null\n",
" \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
29 changes: 11 additions & 18 deletions notebooks/02/bim-rawmaterialplanning.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,7 @@
"source": [
"## Preamble: Install Pyomo and a solver\n",
"\n",
"This cell selects and verifies a global SOLVER for the notebook.\n",
"\n",
"If run on Google Colab, the cell installs Pyomo and HiGHS, then sets SOLVER to \n",
"use the Highs solver via the appsi module. If run elsewhere, it assumes Pyomo and CBC\n",
"have been previously installed and sets SOLVER to use the CBC solver via the Pyomo \n",
"SolverFactory. It then verifies that SOLVER is available."
"The following cell sets and verifies a global SOLVER for the notebook. If run on Google Colab, the cell installs Pyomo and the HiGHS solver, while, if run elsewhere, it assumes Pyomo and HiGHS have been previously installed. It then sets to use HiGHS as solver via the appsi module and a test is performed to verify that it is available. The solver interface is stored in a global object `SOLVER` for later use."
]
},
{
Expand All @@ -52,19 +47,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.\""
" %pip install pyomo >/dev/null 2>/dev/null\n",
" %pip install highspy >/dev/null 2>/dev/null\n",
" \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
29 changes: 11 additions & 18 deletions notebooks/02/bim.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,7 @@
"source": [
"## Preamble: Install Pyomo and a solver\n",
"\n",
"This cell selects and verifies a global SOLVER for the notebook.\n",
"\n",
"If run on Google Colab, the cell installs Pyomo and HiGHS, then sets SOLVER to \n",
"use the Highs solver via the appsi module. If run elsewhere, it assumes Pyomo and CBC\n",
"have been previously installed and sets SOLVER to use the CBC solver via the Pyomo \n",
"SolverFactory. It then verifies that SOLVER is available."
"The following cell sets and verifies a global SOLVER for the notebook. If run on Google Colab, the cell installs Pyomo and the HiGHS solver, while, if run elsewhere, it assumes Pyomo and HiGHS have been previously installed. It then sets to use HiGHS as solver via the appsi module and a test is performed to verify that it is available. The solver interface is stored in a global object `SOLVER` for later use."
]
},
{
Expand All @@ -48,19 +43,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.\""
" %pip install pyomo >/dev/null 2>/dev/null\n",
" %pip install highspy >/dev/null 2>/dev/null\n",
" \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
29 changes: 11 additions & 18 deletions notebooks/02/lad-regression.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,7 @@
"source": [
"## Preamble: Install Pyomo and a solver\n",
"\n",
"This cell selects and verifies a global SOLVER for the notebook.\n",
"\n",
"If run on Google Colab, the cell installs Pyomo and HiGHS, then sets SOLVER to \n",
"use the Highs solver via the appsi module. If run elsewhere, it assumes Pyomo and CBC\n",
"have been previously installed and sets SOLVER to use the CBC solver via the Pyomo \n",
"SolverFactory. It then verifies that SOLVER is available."
"The following cell sets and verifies a global SOLVER for the notebook. If run on Google Colab, the cell installs Pyomo and the HiGHS solver, while, if run elsewhere, it assumes Pyomo and HiGHS have been previously installed. It then sets to use HiGHS as solver via the appsi module and a test is performed to verify that it is available. The solver interface is stored in a global object `SOLVER` for later use."
]
},
{
Expand All @@ -44,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.\""
" %pip install pyomo >/dev/null 2>/dev/null\n",
" %pip install highspy >/dev/null 2>/dev/null\n",
" \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
29 changes: 11 additions & 18 deletions notebooks/02/mad-portfolio-optimization.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,7 @@
"source": [
"## Preamble: Install Pyomo and a solver\n",
"\n",
"This cell selects and verifies a global SOLVER for the notebook.\n",
"\n",
"If run on Google Colab, the cell installs Pyomo and HiGHS, then sets SOLVER to \n",
"use the Highs solver via the appsi module. If run elsewhere, it assumes Pyomo and CBC\n",
"have been previously installed and sets SOLVER to use the CBC solver via the Pyomo \n",
"SolverFactory. It then verifies that SOLVER is available."
"The following cell sets and verifies a global SOLVER for the notebook. If run on Google Colab, the cell installs Pyomo and the HiGHS solver, while, if run elsewhere, it assumes Pyomo and HiGHS have been previously installed. It then sets to use HiGHS as solver via the appsi module and a test is performed to verify that it is available. The solver interface is stored in a global object `SOLVER` for later use."
]
},
{
Expand All @@ -54,19 +49,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.\""
" %pip install pyomo >/dev/null 2>/dev/null\n",
" %pip install highspy >/dev/null 2>/dev/null\n",
" \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
29 changes: 11 additions & 18 deletions notebooks/02/multiproductionfaciliity_worstcase.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,7 @@
"source": [
"## Preamble: Install Pyomo and a solver\n",
"\n",
"This cell selects and verifies a global SOLVER for the notebook.\n",
"\n",
"If run on Google Colab, the cell installs Pyomo and HiGHS, then sets SOLVER to \n",
"use the Highs solver via the appsi module. If run elsewhere, it assumes Pyomo and CBC\n",
"have been previously installed and sets SOLVER to use the CBC solver via the Pyomo \n",
"SolverFactory. It then verifies that SOLVER is available."
"The following cell sets and verifies a global SOLVER for the notebook. If run on Google Colab, the cell installs Pyomo and the HiGHS solver, while, if run elsewhere, it assumes Pyomo and HiGHS have been previously installed. It then sets to use HiGHS as solver via the appsi module and a test is performed to verify that it is available. The solver interface is stored in a global object `SOLVER` for later use."
]
},
{
Expand All @@ -47,19 +42,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.\""
" %pip install pyomo >/dev/null 2>/dev/null\n",
" %pip install highspy >/dev/null 2>/dev/null\n",
" \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
Loading

0 comments on commit 9d1896f

Please sign in to comment.