Skip to content

Commit

Permalink
retry adding ipopt
Browse files Browse the repository at this point in the history
  • Loading branch information
murraybj committed Oct 2, 2024
1 parent 58b522c commit bd3351b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion Material/Pyomo Fundamentals/1.5 NLP vs MIP.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit bd3351b

Please sign in to comment.