Download slides PDF
Linear programming and duality
Plan for the three-hour class
What makes a model linear?
Running example: two production routes
The production LP
Objective contours and the best feasible point
Why compare extreme points?
An LP can have many optimal solutions
Infeasible and unbounded are different
Quick check: feasibility before profit
Slack variables and standard form
A basis selects the variables we solve for
The Simplex decision at each step
Pivot 1: x enters, s₂ leaves
Dictionary after the first pivot
Pivot 2: y enters, s₁ leaves
The final dictionary certifies optimality
Degeneracy and starting feasibility
Practice: change the contribution
Practice solution: one pivot is enough
Break
The dual prices the resources
Primal and dual side by side
Signs depend on the formulation
Weak duality gives an upper bound
Dual geometry: tighten the upper bound
Solve the dual and compare
Strong duality for linear programs
The duality gap separates two kinds of waste
Complementary slackness
LP duality is KKT in a special form
Practice: a dual certificate
Practice solution: zero price for unused capacity
Shadow prices: value per extra unit
1. Resource 1 changes, resource 2 stays fixed
2. The intersection moves with b₁
3. Nonnegativity gives the allowable range
4. Inside the range: b₁ = 4.5
5. Duality confirms the shadow price
6. Below the range: b₁ = 2
7. Above the range: b₁ = 6
8. The value function changes slope
1. Resource 2 changes, resource 1 stays fixed
2. The intersection as a function of b₂
3. Nonnegativity gives 4 ≤ b₂ ≤ 8
4. Inside the range: b₂ = 6
5. Duality confirms the price of resource 2
6. Below the range: b₂ = 3
7. Above the range: b₂ = 9
8. The value function for resource 2
9. Changing both resources needs a joint check
1. Objective sensitivity keeps the feasible set fixed
2. Complementary slackness determines the prices
3. Nonnegative dual prices give the range
4. Below the range: c₁ = 1
5. At c₁ = 2, an entire edge is optimal
6. Inside the range: c₁ = 3.5
7. At c₁ = 4, the other edge is optimal
8. Above the range: c₁ = 5
9. Optimal value as the coefficient changes
1. Return to the original production model
2. Price the resources used by the new product
3. Derive reduced cost from a feasible exchange
4. The feasible step ends when x reaches zero
5. The new product invalidates the old certificate
6. Reoptimize and certify the new maximum
7. More than one new production plan is optimal
8. Compare three possible product contributions
9. A reduced-cost decision checklist
1. Send a minimization model to SciPy
2. Read the actual solver output
3. Derive the sign instead of memorizing it
4. Verify resource 1 with a small perturbation
5. Verify resource 2 independently
6. A marginal is not a global prediction
7. Row marginals and bound marginals differ
8. Connect the bound marginal to reduced cost
1. Define the baseline and the purchase offer
2. Convert the shadow-price range into a purchase limit
3. Add 0.5 capacity and calculate the gross gain
4. Subtract the purchase cost exactly once
5. Buying 2 units crosses the useful range
6. Use a break-even price for the whole offer
7. If capacity is divisible, choose how much to buy
8. Compare complete offers by net benefit
Exit ticket 1: can an entire edge be optimal?
Exit ticket 2: is this a valid dual bound?
Exit ticket 3: construct an optimality certificate
Exit ticket 4: when does the shadow price work?
Solution 1: combine a bound with an attainable edge
Solution 2: this dual candidate fails to give a bound
Solution 3: verify both sides before equating values
Solution 4A: predict, then check at b₁=4.2
Solution 4B: expose the failed extrapolation at 6
The big picture: one LP, four connected ideas
1. Primal proposes a plan; dual certifies its value
2. Complementary slackness closes the duality gap
3. Dual prices become local resource values
4. When capacity changes, reconnect all four ideas
References and optional follow-up