Skip to content

Commit

Permalink
more typos fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
yurchisin committed Nov 14, 2024
1 parent 9b72d98 commit 7481dcb
Show file tree
Hide file tree
Showing 4 changed files with 151 additions and 33 deletions.
135 changes: 126 additions & 9 deletions optimization202/ESUPS_case_study/opti202_disaster_prepositioning.ipynb

Large diffs are not rendered by default.

11 changes: 7 additions & 4 deletions optimization202/Modeling_Session_1/completed_exercise_set1.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -102,19 +102,22 @@
"\n",
"> **Q8b.** \n",
"\n",
"\\begin{align*}\n",
"\\begin{align}\n",
"x_1 + x_2 + x_3 &= 6 \\\\\n",
"3x_1 + 2x_2 + x_3 &\\ge 20 \\\\\n",
"x_1, x_2, x_3, &\\ge 0\n",
"\\end{align*}\n",
"\\end{align}\n",
"\n",
"`Solution:`\n",
"\n",
"Substitute $(1)$ into $(2)$:\n",
"$3x_1 + 2x_2 + x_3 = 2x_1 + x_2 + (x_1 + x_2 + x_3) = 2x_1 + x_2 + 6$\n",
"\n",
"Note that since $x_1$ and $x_2$ and both nonnegative, the first equation implies $x_1 \\le 6$ and $x_1 \\le 6$. \n",
"This simplifies $(2)$ as $2x_1 + x_2 \\ge 14$.\n",
"\n",
"Since $x_3$ is nonnegative, the first equation implies $x_1 + x_2\\le 6$, or $-x_1 - x_2 \\ge -6$.\n",
"\n",
"Thus $2x_1 + x_2 + 6 \\le 18$ and cannot be 20 or more. \n",
"Adding the inequalities gives $x_1 \\ge 8$, which can't happen due to $(1)$. \n",
"\n",
"**Q9.** Translate the following into constraints using binary variables for deciding to invest in three stocks. Then determine if they are compatible as above. \n",
"\n",
Expand Down
19 changes: 9 additions & 10 deletions optimization202/Modeling_Session_2/completed_exercise_set2.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"metadata": {},
"source": [
"# Back to the widget production problem\n",
"Let's go back to the Opti 101/201 classic: Widget production and distribution. Use the code below for as the base model for this problem. "
"Let's go back to the Opti 101/201 classic: Widget production and distribution. Use the code below as the base model for this problem."
]
},
{
Expand All @@ -15,7 +15,6 @@
"outputs": [],
"source": [
"%pip install gurobipy\n",
"%pip install seaborn\n",
"\n",
"import pandas as pd\n",
"import numpy as np\n",
Expand Down Expand Up @@ -244,14 +243,14 @@
"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",
"- [Visualization of PWL](https://docs.gurobi.com/projects/optimizer/en/current/concepts/modeling/objectives.html#piecewise-linear-objectives)\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",
"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",
"- If we decide to bulk ship at least half of a production facility's max to any one distribution location, every widget over that half capacity number costs 60% of the new transportation cost. \n",
"\n",
" So if the original cost is 2, the new cost of shipping from $p$ to $d$ for the first half of capacity is 2.5 (0.50 flat increase), and anything produces after that ships at 1.5. Update the model to reflect this (0.60 * 2.5). "
" So, if the original cost is 2, the new cost of shipping from $p$ to $d$ for the first half of capacity is 2.5 (0.50 flat increase), and anything produced after that ships at 1.5. Update the model to reflect this (0.60 * 2.5). "
]
},
{
Expand Down Expand Up @@ -986,7 +985,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Fill in the blanks in the code below to simulate an uncertain transportation cost from Cleveland to Indianapolis. We will use assume the cost is normally distributed with mean 2.3 and standard deviation 0.2. Generate 1000 samples. "
"Fill in the blanks in the code below to simulate an uncertain transportation cost from Cleveland to Indianapolis. We will assume the cost is normally distributed with mean 2.3 and standard deviation 0.2. Generate 1000 samples. "
]
},
{
Expand Down Expand Up @@ -1076,7 +1075,7 @@
"source": [
"### Individual chance constraint\n",
"\n",
"Meeting widget demand in Nashville is now an extremely high priority. Historically, our data says that the demand here for the next sales period follow a [Poisson distribution](https://en.wikipedia.org/wiki/Poisson_distribution) that has a mean of 100 (in the original model, demand was 101). Fill in the code blanks below to make sure we meet the demand with probability 0.95."
"Meeting widget demand in Nashville is now an extremely high priority. Historically, our data says that the demand here for the next sales period follows a [Poisson distribution](https://en.wikipedia.org/wiki/Poisson_distribution) that has a mean of 100 (in the original model, demand was 101). Fill in the code blanks below to make sure we meet the demand with probability 0.95."
]
},
{
Expand Down Expand Up @@ -1318,7 +1317,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Create an optimization model where we decide the percentage of our budget to invest to **maximize the minimum** total estimated returns considering all scenarios. **HINT**: Define a single new auxillary variable."
"Create an optimization model where we decide the percentage of our budget to invest to **maximize the minimum** total estimated returns considering all scenarios. **HINT**: Define a single new auxiliary variable."
]
},
{
Expand Down Expand Up @@ -1441,8 +1440,8 @@
"metadata": {},
"source": [
"You now decide that your investments need to be a little more diversified. Add any necessary variables and constraints that will:\n",
"- Make sure you invest in at least four sectors, \n",
"- And any investment will need to be at least 10% of the budget."
"- Make sure you invest in at least four sectors.\n",
"- If an investment is made in a sector, then will need to be at least 10% of the budget."
]
},
{
Expand Down
19 changes: 9 additions & 10 deletions optimization202/Modeling_Session_2/exercise_set2.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"metadata": {},
"source": [
"# Back to the widget production problem\n",
"Let's go back to the Opti 101/201 classic: Widget production and distribution. Use the code below for as the base model for this problem. "
"Let's go back to the Opti 101/201 classic: Widget production and distribution. Use the code below as the base model for this problem."
]
},
{
Expand All @@ -15,7 +15,6 @@
"outputs": [],
"source": [
"%pip install gurobipy\n",
"%pip install seaborn\n",
"\n",
"import pandas as pd\n",
"import numpy as np\n",
Expand Down Expand Up @@ -137,14 +136,14 @@
"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",
"- [Visualization of PWL](https://docs.gurobi.com/projects/optimizer/en/current/concepts/modeling/objectives.html#piecewise-linear-objectives)\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",
"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",
"- If we decide to bulk ship at least half of a production facility's max to any one distribution location, every widget over that half capacity number costs 60% of the new transportation cost. \n",
"\n",
" So if the original cost is 2, the new cost of shipping from $p$ to $d$ for the first half of capacity is 2.5 (0.50 flat increase), and anything produces after that ships at 1.5. Update the model to reflect this (0.60 * 2.5). "
" So, if the original cost is 2, the new cost of shipping from $p$ to $d$ for the first half of capacity is 2.5 (0.50 flat increase), and anything produced after that ships at 1.5. Update the model to reflect this (0.60 * 2.5). "
]
},
{
Expand Down Expand Up @@ -305,7 +304,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Fill in the blanks in the code below to simulate an uncertain transportation cost from Cleveland to Indianapolis. We will use assume the cost is normally distributed with mean 2.3 and standard deviation 0.2. Generate 1000 samples. "
"Fill in the blanks in the code below to simulate an uncertain transportation cost from Cleveland to Indianapolis. We will assume the cost is normally distributed with mean 2.3 and standard deviation 0.2. Generate 1000 samples. "
]
},
{
Expand Down Expand Up @@ -384,7 +383,7 @@
"source": [
"### Individual chance constraint\n",
"\n",
"Meeting widget demand in Nashville is now an extremely high priority. Historically, our data says that the demand here for the next sales period follow a [Poisson distribution](https://en.wikipedia.org/wiki/Poisson_distribution) that has a mean of 100 (in the original model, demand was 101). Fill in the code blanks below to make sure we meet the demand with probability 0.95."
"Meeting widget demand in Nashville is now an extremely high priority. Historically, our data says that the demand here for the next sales period follows a [Poisson distribution](https://en.wikipedia.org/wiki/Poisson_distribution) that has a mean of 100 (in the original model, demand was 101). Fill in the code blanks below to make sure we meet the demand with probability 0.95."
]
},
{
Expand Down Expand Up @@ -484,7 +483,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Create an optimization model where we decide the percentage of our budget to invest to **maximize the minimum** total estimated returns considering all scenarios. **HINT**: Define a single new auxillary variable."
"Create an optimization model where we decide the percentage of our budget to invest to **maximize the minimum** total estimated returns considering all scenarios. **HINT**: Define a single new auxiliary variable."
]
},
{
Expand Down Expand Up @@ -525,8 +524,8 @@
"metadata": {},
"source": [
"You now decide that your investments need to be a little more diversified. Add any necessary variables and constraints that will:\n",
"- Make sure you invest in at least four sectors, \n",
"- And any investment will need to be at least 10% of the budget."
"- Make sure you invest in at least four sectors.\n",
"- If an investment is made in a sector, then will need to be at least 10% of the budget."
]
},
{
Expand Down

0 comments on commit 7481dcb

Please sign in to comment.