diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d7c7a42f..7497258d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -28,6 +28,8 @@ jobs: sudo apt update sudo apt-get install -y -qq glpk-utils sudo apt-get install -y -qq coinor-cbc + sudo pip install idaes-pse --pre + idaes get-extensions --to ./solvers # Install dependencies - name: Set up Python 3.11 @@ -40,6 +42,7 @@ jobs: pip install -r requirements.txt pip install openpyxl + # (optional) Cache your executed notebooks between runs # if you have config: # execute: diff --git a/Material/Pyomo Fundamentals/1.4 Loading data from Excel.ipynb b/Material/Pyomo Fundamentals/1.4 Loading data from Excel.ipynb index c4395342..35b8e658 100644 --- a/Material/Pyomo Fundamentals/1.4 Loading data from Excel.ipynb +++ b/Material/Pyomo Fundamentals/1.4 Loading data from Excel.ipynb @@ -33,6 +33,7 @@ "import pandas as pd\n", "import pyomo.environ as pyo\n", "import os\n", + "import openpyxl\n", "path = os.path.abspath('knapsack_data.xlsx')\n", "df_items = pd.read_excel(path, sheet_name='data', header=0, index_col=0)\n", "W_max = 14\n", @@ -51,7 +52,7 @@ "model.weight_con = pyo.Constraint(\n", " expr = sum( w[i]*model.x[i] for i in A ) <= W_max )\n", "\n", - "opt = pyo.SolverFactory('glpk')\n", + "opt = pyo.SolverFactory('cbc')\n", "opt_success = opt.solve(model)\n", "\n", "total_weight = sum( w[i]*pyo.value(model.x[i]) for i in A )\n", diff --git a/Material/Pyomo Fundamentals/1.5 NLP vs MIP.ipynb b/Material/Pyomo Fundamentals/1.5 NLP vs MIP.ipynb index f6fa2de9..f9e4ac9f 100644 --- a/Material/Pyomo Fundamentals/1.5 NLP vs MIP.ipynb +++ b/Material/Pyomo Fundamentals/1.5 NLP vs MIP.ipynb @@ -58,7 +58,7 @@ "model.weight_con = pyo.Constraint(\n", " expr = sum( w[i]*model.x[i] for i in A ) <= W_max )\n", "\n", - "opt = pyo.SolverFactory('ipopt')\n", + "opt = pyo.SolverFactory('ipopt', executable='/content/solvers/ipopt')\n", "opt_success = opt.solve(model)\n", "\n", "model.pprint()\n",