Skip to content

Commit

Permalink
ex2 notes
Browse files Browse the repository at this point in the history
  • Loading branch information
yurchisin committed Nov 13, 2024
1 parent 173e79b commit 293a11d
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 29 deletions.
51 changes: 23 additions & 28 deletions optimization202/Modeling_Session_2/completed_exercise_set2.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,9 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Requirement already satisfied: gurobipy in /Users/yurchisin/opt/anaconda3/envs/gurobi_ml/lib/python3.11/site-packages (12.0.0)\n",
"Note: you may need to restart the kernel to use updated packages.\n",
"Requirement already satisfied: seaborn in /Users/yurchisin/opt/anaconda3/envs/gurobi_ml/lib/python3.11/site-packages (0.13.0)\n",
"Requirement already satisfied: numpy!=1.24.0,>=1.20 in /Users/yurchisin/opt/anaconda3/envs/gurobi_ml/lib/python3.11/site-packages (from seaborn) (1.26.4)\n",
"Requirement already satisfied: pandas>=1.2 in /Users/yurchisin/opt/anaconda3/envs/gurobi_ml/lib/python3.11/site-packages (from seaborn) (2.2.2)\n",
"Requirement already satisfied: matplotlib!=3.6.1,>=3.3 in /Users/yurchisin/opt/anaconda3/envs/gurobi_ml/lib/python3.11/site-packages (from seaborn) (3.8.0)\n",
"Requirement already satisfied: contourpy>=1.0.1 in /Users/yurchisin/opt/anaconda3/envs/gurobi_ml/lib/python3.11/site-packages (from matplotlib!=3.6.1,>=3.3->seaborn) (1.1.1)\n",
"Requirement already satisfied: cycler>=0.10 in /Users/yurchisin/opt/anaconda3/envs/gurobi_ml/lib/python3.11/site-packages (from matplotlib!=3.6.1,>=3.3->seaborn) (0.12.1)\n",
"Requirement already satisfied: fonttools>=4.22.0 in /Users/yurchisin/opt/anaconda3/envs/gurobi_ml/lib/python3.11/site-packages (from matplotlib!=3.6.1,>=3.3->seaborn) (4.43.1)\n",
"Requirement already satisfied: kiwisolver>=1.0.1 in /Users/yurchisin/opt/anaconda3/envs/gurobi_ml/lib/python3.11/site-packages (from matplotlib!=3.6.1,>=3.3->seaborn) (1.4.5)\n",
"Requirement already satisfied: packaging>=20.0 in /Users/yurchisin/opt/anaconda3/envs/gurobi_ml/lib/python3.11/site-packages (from matplotlib!=3.6.1,>=3.3->seaborn) (23.2)\n",
"Requirement already satisfied: pillow>=6.2.0 in /Users/yurchisin/opt/anaconda3/envs/gurobi_ml/lib/python3.11/site-packages (from matplotlib!=3.6.1,>=3.3->seaborn) (10.0.1)\n",
"Requirement already satisfied: pyparsing>=2.3.1 in /Users/yurchisin/opt/anaconda3/envs/gurobi_ml/lib/python3.11/site-packages (from matplotlib!=3.6.1,>=3.3->seaborn) (3.1.1)\n",
"Requirement already satisfied: python-dateutil>=2.7 in /Users/yurchisin/opt/anaconda3/envs/gurobi_ml/lib/python3.11/site-packages (from matplotlib!=3.6.1,>=3.3->seaborn) (2.8.2)\n",
"Requirement already satisfied: pytz>=2020.1 in /Users/yurchisin/opt/anaconda3/envs/gurobi_ml/lib/python3.11/site-packages (from pandas>=1.2->seaborn) (2023.3.post1)\n",
"Requirement already satisfied: tzdata>=2022.7 in /Users/yurchisin/opt/anaconda3/envs/gurobi_ml/lib/python3.11/site-packages (from pandas>=1.2->seaborn) (2023.3)\n",
"Requirement already satisfied: six>=1.5 in /Users/yurchisin/opt/anaconda3/envs/gurobi_ml/lib/python3.11/site-packages (from python-dateutil>=2.7->matplotlib!=3.6.1,>=3.3->seaborn) (1.16.0)\n",
"Note: you may need to restart the kernel to use updated packages.\n"
]
}
],
"outputs": [],
"source": [
"%pip install gurobipy\n",
"%pip install seaborn\n",
Expand Down Expand Up @@ -250,7 +225,27 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## Piecewise Linear Modeling\n",
"## Piecewise Linear Modeling"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<div class=\"alert alert-success alert-dismissible\">\n",
" <a href=\"#\" class=\"close\" data-dismiss=\"alert\" aria-label=\"close\">&times;</a>\n",
" <strong>Here are a couple a good documentation links to help you use PWL in the code below. </strong>\n",
"</div>"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Links to PWL in `gurobipy`:\n",
"- [Model.addGenConstrPWL](https://docs.gurobi.com/projects/optimizer/en/current/reference/python/model.html#Model.addGenConstrPWL) command\n",
"- [Visualization of PWL](https://docs.gurobi.com/projects/optimizer/en/current/concepts/modeling/objectives.html#piecewise-linear-objectives) and how it gets put together\n",
"\n",
"### Scenario 1\n",
"Let's go back to the Opti 101/201 classic: Widget production and distribution. We have a new cost structure for transporting widgets we make. \n",
"- There will be a flat 0.50 increase for all transportation costs. \n",
Expand Down
22 changes: 21 additions & 1 deletion optimization202/Modeling_Session_2/exercise_set2.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,27 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## Piecewise Linear Modeling\n",
"## Piecewise Linear Modeling"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<div class=\"alert alert-success alert-dismissible\">\n",
" <a href=\"#\" class=\"close\" data-dismiss=\"alert\" aria-label=\"close\">&times;</a>\n",
" <strong>Here are a couple a good documentation links to help you use PWL in the code below. </strong>\n",
"</div>"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Links to PWL in `gurobipy`:\n",
"- [Model.addGenConstrPWL](https://docs.gurobi.com/projects/optimizer/en/current/reference/python/model.html#Model.addGenConstrPWL) command\n",
"- [Visualization of PWL](https://docs.gurobi.com/projects/optimizer/en/current/concepts/modeling/objectives.html#piecewise-linear-objectives) and how it gets put together\n",
"\n",
"### Scenario 1\n",
"Let's go back to the Opti 101/201 classic: Widget production and distribution. We have a new cost structure for transporting widgets we make. \n",
"- There will be a flat 0.50 increase for all transportation costs. \n",
Expand Down

0 comments on commit 293a11d

Please sign in to comment.