Skip to content

Commit df791be

Browse files
committed
Add lp_intro in lectures
1 parent c803c72 commit df791be

File tree

2 files changed

+11
-16
lines changed

2 files changed

+11
-16
lines changed

lectures/_toc.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ parts:
1313
- file: short_path
1414
- file: scalar_dynam
1515
- file: linear_equations
16+
- file: lp_intro
1617
- file: lln_clt
1718
- file: markov_chains
1819
- caption: Models

in-work/lp_intro.md renamed to lectures/lp_intro.md

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ jupytext:
33
text_representation:
44
extension: .md
55
format_name: myst
6-
format_version: 0.13
7-
jupytext_version: 1.14.4
86
kernelspec:
97
display_name: Python 3 (ipykernel)
108
language: python
@@ -53,7 +51,7 @@ from matplotlib.patches import Polygon
5351

5452
Let's start with some examples of linear programming problem.
5553

56-
+++
54+
5755

5856
## Example 1: Production Problem
5957

@@ -141,13 +139,13 @@ The intersection of the feasible set and the highest orange line delineates the
141139

142140
In this example, the optimal set is the point $(2.5, 5)$.
143141

144-
+++
142+
145143

146144
### Computation: Using OR-Tools
147145

148146
Let's try to solve the same problem using the package *ortools.linear_solver*
149147

150-
+++
148+
151149

152150
The following cell instantiates a solver and creates two variables specifying the range of values that they can have.
153151

@@ -276,7 +274,7 @@ $$
276274
\end{aligned}
277275
$$
278276

279-
+++
277+
280278

281279
### Computation: Using OR-Tools
282280

@@ -348,7 +346,7 @@ OR-Tools tells us that the best investment strategy is:
348346

349347
4. At the end of the third year, the mutual fund will get payouts from the annuity and corporate bond and repay its loan from the bank. At the end it will own $ \$141018.24 $, so that it's total net rate of return over the three periods is $ 41.02\%$.
350348

351-
+++
349+
352350

353351
## Standard Form
354352

@@ -439,7 +437,7 @@ $$
439437
\end{aligned}
440438
$$
441439
442-
+++
440+
443441
444442
### Computation: Using SciPy
445443
@@ -501,7 +499,7 @@ See the [official documentation](https://docs.scipy.org/doc/scipy/reference/gene
501499
This problem is to maximize the objective, so that we need to put a minus sign in front of parameter vector c.
502500
```
503501
504-
+++
502+
505503
506504
### Example 2: Investment Problem
507505
@@ -592,27 +590,25 @@ SciPy tells us that the best investment strategy is:
592590
593591
4. At the end of the third year, the mutual fund will get payouts from the annuity and corporate bond and repay its loan from the bank. At the end it will own $ \$141018.24 $, so that it's total net rate of return over the three periods is $ 41.02\% $.
594592
595-
+++
593+
596594
597595
```{note}
598596
You might notice the difference in the values of optimal solution using OR-Tools and SciPy but the optimal value is the same. It is because there can be many optimal solutions for the same problem.
599597
```
600598
601-
+++
599+
602600
603601
## Exercises
604602
605603
```{exercise-start}
606604
:label: ex1
607605
```
608606
609-
### Exercise 1
610607
Implement a new extended solution for the Problem 1 where in the factory owner decides that number of units of Product 1 should not be less than the number of units of Product 2.
611608
612609
```{exercise-end}
613610
```
614611
615-
+++
616612
617613
```{solution-start} ex1
618614
:class: dropdown
@@ -675,8 +671,6 @@ else:
675671
```{exercise-start}
676672
:label: ex2
677673
```
678-
### Exercise 2
679-
680674
681675
A carpenter manufactures $2$ products - $A$ and $B$.
682676
@@ -692,7 +686,7 @@ Find the number of units of $A$ and product $B$ that he should manufacture in or
692686
```{exercise-end}
693687
```
694688
695-
+++
689+
696690
697691
Solution:
698692

0 commit comments

Comments
 (0)