Skip to content

Commit

Permalink
Add notebook numbering
Browse files Browse the repository at this point in the history
  • Loading branch information
alessandrozocca committed Nov 20, 2023
1 parent 9d1896f commit b5034fe
Show file tree
Hide file tree
Showing 19 changed files with 44 additions and 48 deletions.
24 changes: 12 additions & 12 deletions _toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@ root: intro.md
chapters:
- file: notebooks/01/01.00.md
sections:
- file: notebooks/01/production-planning.ipynb
- file: notebooks/01/production-planning-basic.ipynb
- file: notebooks/01/production-planning-advanced.ipynb
- file: notebooks/01/01-production-planning.ipynb
- file: notebooks/01/02_production-planning-basic.ipynb
- file: notebooks/01/03-production-planning-advanced.ipynb

- file: notebooks/02/02.00.md
sections:
- file: notebooks/02/bim.ipynb
- file: notebooks/02/lad-regression.ipynb
- file: notebooks/02/mad-portfolio-optimization.ipynb
- file: notebooks/02/bim-dual.ipynb
- file: notebooks/02/bim-maxmin.ipynb
- file: notebooks/02/bim-fractional.ipynb
- file: notebooks/02/bim-rawmaterialplanning
- file: notebooks/02/L1-regression-wine-quality.ipynb
- file: notebooks/02/multiproductionfaciliity_worstcase.ipynb
- file: notebooks/02/01-bim.ipynb
- file: notebooks/02/02-lad-regression.ipynb
- file: notebooks/02/03-mad-portfolio-optimization.ipynb
- file: notebooks/02/04-bim-dual.ipynb
- file: notebooks/02/05-bim-maxmin.ipynb
- file: notebooks/02/06-bim-fractional.ipynb
- file: notebooks/02/07-bim-rawmaterialplanning
- file: notebooks/02/08-L1-regression-wine-quality.ipynb
- file: notebooks/02/09-multiproductionfaciliity_worstcase.ipynb

- file: notebooks/03/03.00.md
sections:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# A first production planning problem"
"# 1.1 A first production planning problem"
]
},
{
Expand Down
6 changes: 3 additions & 3 deletions notebooks/01/01.00.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ and similarly for a maximization problem. Different types of function $f$ and se

In this introductory chapter, we present a simple example of optimization in the context of production planning.

- We first explain the structure and formalism of the corresponding optimization problem in a [first notebook](production-planning.ipynb)
- We then implement and solve the optimization in Pyomo in a [second notebook](production-planning-basic.ipynb), which also serves as a Pyomo tutorial.
- Lastly, we discuss some advance Pyomo features in a [third notebook](production-planning-advanced.ipynb).
- We first explain the structure and formalism of the corresponding optimization problem in a [first notebook](01-production-planning.ipynb)
- We then implement and solve the optimization in Pyomo in a [second notebook](02-production-planning-basic.ipynb), which also serves as a Pyomo tutorial.
- Lastly, we discuss some advance Pyomo features in a [third notebook](03-production-planning-advanced.ipynb).

Go to the [next chapter](../02/02.00.md) about linear optimization.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"```{index} single: solver; HiGHS\n",
"```\n",
"\n",
"# A basic Pyomo model\n",
"# 1.2 A basic Pyomo model\n",
"\n",
"Pyomo is an algebraic modeling language for mathematical optimization that is integrated within the Python programming environment. It enables users to create optimization models consisting of decision variables, expressions, objective functions, and constraints. Pyomo provides tools to transform models, and then solve them using a variety of open-source and commercial solvers. As an open-source project, Pyomo is not tied to any specific vendor, solver, or class of mathematical optimization problems, and is constantly evolving through contributions from third-party developers.\n",
"\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"```{index} single: solver; cbc\n",
"```\n",
"\n",
"# A data-driven Pyomo Model\n",
"# 1.3 A data-driven Pyomo Model\n",
"\n",
"In this notebook, we'll revisit the production planning example. However, this time we'll demonstrate how Python's data structures, combined with Pyomo's capabilities, can create an optimization model scales with problem data. This enables the model to adjust to new products, varying prices, or changing demand. We refer to this as \"data-driven\" modeling.\n",
"\n",
Expand Down
2 changes: 1 addition & 1 deletion notebooks/02/bim.ipynb → notebooks/02/01-bim.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"```{index} single: application; production planning\n",
"```\n",
"\n",
"# BIM production"
"# 2.1 BIM production"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"```{index} single: application; regression\n",
"```\n",
"\n",
"# Least Absolute Deviation (LAD) Regression\n",
"# 2.2 Least Absolute Deviation (LAD) Regression\n",
"\n",
"Linear regression is a supervised machine learning technique that dates back to at least the 19th century. It remains a cornerstone of modern data analysis, generating a linear model that predicts the values of a dependent variable based on one or more independent variables. This notebook introduces an alternative approach to traditional linear regression, employing linear optimization to optimize based on the Least Absolute Deviation (LAD) metric. \n",
"\n",
Expand Down
18 changes: 9 additions & 9 deletions notebooks/02/02.00.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ Linear problems can (i) be maximization problems, (ii) involve equality constrai

This chapter includes several with companion Pyomo implementation that explore various modeling and implementation aspects of LOs:

* A first LO example, modelling [the microchip production problem of company BIM](bim.ipynb)
* [Least Absolute Deviation (LAD) Regression](lad-regression.ipynb)
* [Mean Absolute Deviation (MAD) portfolio optimization](mad-portfolio-optimization.ipynb)
* [The dual problem of the microchip production problem](bim-dual.ipynb)
* [A variant of BIM problem: maximizing the lowest possible profit](bim-maxmin.ipynb)
* [Two variants of the BIM problem using fractional objective or additional fixed costs](bim-fractional.ipynb)
* [The BIM production problem using demand forecasts](bim-rawmaterialplanning)
* [Extra material: Wine quality prediction problem using $L_1$ regression](L1-regression-wine-quality.ipynb)
* [Extra material: Multi-product facility production](multiproductionfaciliity_worstcase.ipynb)
* A first LO example, modelling [the microchip production problem of company BIM](01-bim.ipynb)
* [Least Absolute Deviation (LAD) Regression](02-lad-regression.ipynb)
* [Mean Absolute Deviation (MAD) portfolio optimization](03-mad-portfolio-optimization.ipynb)
* [The dual problem of the microchip production problem](04-bim-dual.ipynb)
* [A variant of BIM problem: maximizing the lowest possible profit](05-bim-maxmin.ipynb)
* [Two variants of the BIM problem using fractional objective or additional fixed costs](06-bim-fractional.ipynb)
* [The BIM production problem using demand forecasts](07-bim-rawmaterialplanning)
* [Extra material: Wine quality prediction problem using $L_1$ regression](08-L1-regression-wine-quality.ipynb)
* [Extra material: Multi-product facility production](09-multiproductionfaciliity_worstcase.ipynb)

Go to the [next chapter](../03/03.00.md) about mixed-integer linear optimization.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"```{index} web scraping\n",
"```\n",
"\n",
"# Mean Absolute Deviation (MAD) portfolio optimization\n",
"# 2.3 Mean Absolute Deviation (MAD) portfolio optimization\n",
"\n",
"Portfolio optimization and modern portfolio theory has a long and important history in finance and investment. The principal idea is to find a blend of investments in financial securities that achieves an optimal trade-off between financial risk and return. The introduction of modern portfolio theory is generally attributed to the 1952 doctoral thesis of [Harry Markowitz](https://en.wikipedia.org/wiki/Harry_Markowitz) who subsequently was award a share of the 1990 Nobel Memorial Prize in Economics for his fundamental contributions to this field. The well-known \"Markowitz Model\" models measure risk using covariance of the portfolio with respect to constituent assets, then solves a minimum variance problem by quadratic optimization problem subject to constraints to allocate of wealth among assets.\n",
"\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"```{index} single: application; production planning\n",
"```\n",
"\n",
"# Dual of the BIM production problem"
"# 2.4 Dual of the BIM production problem"
]
},
{
Expand Down Expand Up @@ -61,7 +61,7 @@
"source": [
"## Derivation of the dual problem\n",
"\n",
"In a [previous notebook](bim.ipynb), we introduce the BIM production problem and showed that it can be modeled as the following LO problem:\n",
"In a [previous notebook](01-bim.ipynb), we introduce the BIM production problem and showed that it can be modeled as the following LO problem:\n",
"\n",
"$$\n",
"\\begin{align*}\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"```{index} single: solver; highs\n",
"```\n",
"\n",
"# BIM production for worst case"
"# 2.5 BIM production for worst case"
]
},
{
Expand Down Expand Up @@ -79,7 +79,7 @@
"source": [
"## BIM problem variant: Maximizing the lowest possible profit\n",
"\n",
"In the same way we can minimize a maximum like above, we can also maximize the minimum. Let us consider the [BIM microchip production problem](bim.ipynb), but suppose that there is uncertainty regarding the selling prices of the microchips. Instead of just the nominal prices 12$ and 9$, BIM estimates that prices may more generally take values $P=\\{ (12,9), (11,10), (8, 11) \\}$. The optimization problem for a production plan that achieves the maximum among the lowest possible profits can be formulated using the trick mentioned above and can be implemented in Pyomo as follows."
"In the same way we can minimize a maximum like above, we can also maximize the minimum. Let us consider the [BIM microchip production problem](01-bim.ipynb), but suppose that there is uncertainty regarding the selling prices of the microchips. Instead of just the nominal prices 12$ and 9$, BIM estimates that prices may more generally take values $P=\\{ (12,9), (11,10), (8, 11) \\}$. The optimization problem for a production plan that achieves the maximum among the lowest possible profits can be formulated using the trick mentioned above and can be implemented in Pyomo as follows."
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"```{index} single: solver; highs\n",
"```\n",
"\n",
"# BIM production variants"
"# 2.6 BIM production variants"
]
},
{
Expand Down Expand Up @@ -53,7 +53,7 @@
"source": [
"## Two variants of the BIM problem: fractional objective and additional fixed costs\n",
"\n",
"Recall the BIM production model introduced earlier [here](bim.ipynb), that is\n",
"Recall the BIM production model introduced earlier [here](01-bim.ipynb), that is\n",
"\n",
"$$\n",
"\\begin{align*}\n",
Expand Down Expand Up @@ -97,9 +97,6 @@
}
],
"source": [
"import pyomo.environ as pyo\n",
"\n",
"\n",
"def BIM_with_revenues_minus_costs():\n",
" m = pyo.ConcreteModel(\"BIM with revenues minus costs\")\n",
"\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"```{index} pandas dataframe\n",
"```\n",
"\n",
"# BIM production using demand forecasts"
"# 2.7 BIM production using demand forecasts"
]
},
{
Expand Down Expand Up @@ -66,7 +66,7 @@
"source": [
"## The problem: Optimal material acquisition and production planning using demand forecasts\n",
"\n",
"This example is a continuation of the BIM chip production problem illustrated [here](bim.ipynb). Recall hat BIM produces logic and memory chips using copper, silicon, germanium, and plastic and that each chip requires the following quantities of raw materials:\n",
"This example is a continuation of the BIM chip production problem illustrated [here](01-bim.ipynb). Recall hat BIM produces logic and memory chips using copper, silicon, germanium, and plastic and that each chip requires the following quantities of raw materials:\n",
"\n",
"<div align=\"center\">\n",
"\n",
Expand Down Expand Up @@ -372,7 +372,6 @@
],
"source": [
"import pandas as pd\n",
"import pyomo.environ as pyo\n",
"from io import StringIO\n",
"from IPython.display import display\n",
"\n",
Expand Down
6 changes: 3 additions & 3 deletions notebooks/03/bim-perturbed.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"```{index} single: application; production planning\n",
"```\n",
"\n",
"# BIM production with perturbed data"
"# 3.1 BIM production with perturbed data"
]
},
{
Expand All @@ -25,7 +25,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"id": "b97ff6f2-b423-4f2c-9626-4f77a71bbc7f",
"metadata": {
"colab": {
Expand Down Expand Up @@ -57,7 +57,7 @@
"source": [
"## Problem description\n",
"\n",
"The company BIM realizes that a $1\\%$ fraction of the copper always gets wasted while producing both types of microchips, more specifically $1\\%$ of the required amount. This means that it actually takes $4.04$ gr of copper to produce a logic chip and $2.02$ gr of copper to produce a memory chip. If we rewrite the linear problem of [the basic BIM problem](../02/bim.ipynb) and modify accordingly the coefficients in the corresponding constraints, we obtain the following problem \n",
"The company BIM realizes that a $1\\%$ fraction of the copper always gets wasted while producing both types of microchips, more specifically $1\\%$ of the required amount. This means that it actually takes $4.04$ gr of copper to produce a logic chip and $2.02$ gr of copper to produce a memory chip. If we rewrite the linear problem of [the basic BIM problem](../02/01-bim.ipynb) and modify accordingly the coefficients in the corresponding constraints, we obtain the following problem \n",
"\n",
"$$\n",
"\\begin{align*}\n",
Expand Down
2 changes: 1 addition & 1 deletion notebooks/03/bim-production-revisited.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"source": [
"## Problem description\n",
"\n",
"We consider again the [BIM raw material planning problem](../02/bim-rawmaterialplanning.ipynb) from Chapter 2 but with more sophisticated pricing and acquisition protocols. There are now three suppliers, each of which can deliver the following materials:\n",
"We consider again the [BIM raw material planning problem](../02/01-bim-rawmaterialplanning.ipynb) from Chapter 2 but with more sophisticated pricing and acquisition protocols. There are now three suppliers, each of which can deliver the following materials:\n",
" - A: **silicon**, **germanium** and **plastic**\n",
" - B: **copper**\n",
" - C: all the above\n",
Expand Down
2 changes: 1 addition & 1 deletion notebooks/03/recharging-electric-vehicle.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"```\n",
"```{index} pandas dataframe\n",
"```\n",
"# Recharging strategy for an electric vehicle\n",
"# 3.3 Recharging strategy for an electric vehicle\n",
"\n",
"Whether it is to visit family, take a sightseeing tour or call on business associates, planning a road trip is a familiar and routine task. Here we consider a road trip on a pre-determined route for which need to plan rest and recharging stops. This example demonstrates use of Pyomo disjunctions to model the decisions on where to stop. "
]
Expand Down
2 changes: 1 addition & 1 deletion notebooks/03/shift-scheduling.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"```\n",
"```{index} Gantt charts\n",
"```\n",
"# Workforce shift scheduling"
"# 3.2 Workforce shift scheduling"
]
},
{
Expand Down

0 comments on commit b5034fe

Please sign in to comment.