Skip to content

Commit 0fbb9dc

Browse files
update
1 parent 970ed8e commit 0fbb9dc

File tree

1 file changed

+74
-4
lines changed

1 file changed

+74
-4
lines changed

class01/background_materials/optimization_basics.jl

Lines changed: 74 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,29 @@ begin
3030
using Ipopt # Solver for NLPs
3131
end
3232

33-
# ╔═╡ 0df8b65a-0527-4545-bf11-00e9912bced0
33+
# ╔═╡ b879c4bf-8292-45a0-87d0-b1f0fa456585
3434
md"""
35-
3635
| | | |
3736
|-----------:|:--|:------------------|
3837
| Lecturer | : | Rosemberg, Andrew |
3938
| Date | : | 28 of July, 2025 |
4039
40+
"""
41+
42+
# ╔═╡ eeceb82e-abfb-4502-bcfb-6c9f76a0879d
43+
md"""
44+
## Prelude
45+
46+
Research and make sure you understand the following concepts/questions:
47+
- What is a convex maximization optimziation problem? and a minimization one? Why are convex problems desirable (compared to non-convex ones)?
48+
- What is a linear program?
49+
- What are Lagrangian multipliers?
50+
- What are Integer problems? and Mixed-Integer problems?
51+
- What is duality? Can you construct the dual of at least a linear program?
52+
"""
53+
54+
# ╔═╡ 0df8b65a-0527-4545-bf11-00e9912bced0
55+
md"""
4156
# Background – Modeling Optimization Problems in JuMP 🏗️
4257
4358
This short Pluto notebook walks you through three small optimisation models of increasing
@@ -253,9 +268,60 @@ replace the quadratic constraint by a sequence of cutting planes
253268
3. **Add Cut**
254269
* Add cut & repeat.
255270
256-
2
271+
At any point in the solution process, the current LP solution looks like (for a given set of cuts indexed by $j$):
272+
```math
273+
\begin{aligned}
274+
\min_{m,c} \quad & 200\,m + 80\,c \\
275+
\text{s.t.}\quad & 0 \le m \le 12, \\
276+
& 0 \le c \le 12, \\
277+
& 2\,\bar m_j\,(m - \bar m_j) + 2\,\bar c_j\,(c - \bar c_j) \le 100 - \bar m_j^{2} - \bar c_j^{2}, \quad j=1,\dots,J.
278+
\end{aligned}
279+
```
280+
281+
Your tasks
282+
283+
1. **Implement** the iterative procedure in JuMP + HiGHS:
284+
- master model with variables `m`, `c`;
285+
- a loop that solves, checks feasibility, and adds cuts when needed.
286+
287+
2. **Record** and (optionally) plot the objective value after each iteration.
288+
257289
"""
258290

291+
# ╔═╡ 7d855c60-41dd-40af-b00a-60b3e779ad13
292+
question_box(md"How can you check your answer?")
293+
294+
# ╔═╡ ae263aac-1668-4f18-8104-ac25953a4503
295+
question_box(md"""
296+
### How do you solve two-stage problems?
297+
298+
How can you use cutting planes to solve a linear Two--Stage problem
299+
300+
```math
301+
\begin{aligned}
302+
\min_{x}\; & c^{\top}x
303+
\;+\;
304+
\mathbb{E}_{\xi}\!\Bigl[
305+
\min_{y(\xi)} \; q^{\top}y(\xi)
306+
\Bigr] \\[6pt]
307+
\text{s.t.}\; & A\,x = b, \quad x \ge 0
308+
\qquad\qquad\text{(first-stage decisions)}
309+
\end{aligned}
310+
```
311+
312+
For each realisation $\xi = \bigl(h(\xi),\,T(\xi)\bigr)$ of the uncertain data,
313+
the **second-stage (recourse) problem** is
314+
315+
```math
316+
\begin{aligned}
317+
\min_{y(\xi)}\; & q^{\top}y(\xi) \\[4pt]
318+
\text{s.t.}\; & T(\xi)\,y(\xi) = h(\xi) - W\,x, \\
319+
& y(\xi) \ge 0
320+
\qquad\qquad\text{(second-stage decisions)}
321+
\end{aligned}
322+
```
323+
""")
324+
259325
# ╔═╡ 808c505d-e10d-42e3-9fb1-9c6f384b2c3c
260326
md"""
261327
---
@@ -709,6 +775,8 @@ end
709775
# ╔═╡ Cell order:
710776
# ╟─881eed45-e7f0-4785-bde8-530e378d7050
711777
# ╟─9f5675a3-07df-4fb1-b683-4c5fd2a85002
778+
# ╟─b879c4bf-8292-45a0-87d0-b1f0fa456585
779+
# ╟─eeceb82e-abfb-4502-bcfb-6c9f76a0879d
712780
# ╟─0df8b65a-0527-4545-bf11-00e9912bced0
713781
# ╠═9ce52307-bc22-4f66-a4af-a4e4ac382212
714782
# ╟─6f67ca7c-1391-4cb9-b692-cd818e037587
@@ -721,7 +789,9 @@ end
721789
# ╠═c369ab46-b416-4c12-83fe-65040a0c47c8
722790
# ╟─20aef3e9-47b5-4f60-9726-7db77f7c3e47
723791
# ╟─b13f9775-68c2-4646-9b67-c69ee23a4ea0
724-
# ╠═ea3ea95a-58cb-4d0d-a167-aa68b8bc2645
792+
# ╟─ea3ea95a-58cb-4d0d-a167-aa68b8bc2645
793+
# ╟─7d855c60-41dd-40af-b00a-60b3e779ad13
794+
# ╟─ae263aac-1668-4f18-8104-ac25953a4503
725795
# ╟─808c505d-e10d-42e3-9fb1-9c6f384b2c3c
726796
# ╠═39617561-bbbf-4ef6-91e2-358dfe76581c
727797
# ╟─01367096-3971-4e79-ace2-83600672fbde

0 commit comments

Comments
 (0)