Rewrite Linear Programming lecture: SciPy-only + duality#771
Merged
Conversation
Full rewrite of the Linear Programming lecture addressing the editorial suggestions in #514. - Drop OR-Tools (GLOP) entirely; solve everything with scipy.optimize.linprog (HiGHS), removing the ortools dependency and the dual-solver presentation. - Restructure the flow: pose both examples first (Example 1 solved graphically, motivating the need for a systematic method on the higher-dimensional Example 2), then introduce standard form, then solve both with SciPy. - Add a Duality section: derive the dual of the production problem, state weak/strong duality, interpret the dual variables as shadow prices, and verify the material shadow price by perturbation. - Note why we use real-valued (vs integer) decision variables. - Rewrite both exercise solutions using linprog. All code cells verified to execute via jupytext. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
✅ Deploy Preview for taupe-gaufre-c4e660 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #514.
Full rewrite of the Linear Programming lecture (
lp_intro), addressing the editorial suggestions in #514.What changed
Tooling
scipy.optimize.linprog(HiGHS), removing theortoolspip installand the parallel two-solver presentation that confused the narrative.Structure / flow
Duality (the main gap in the old lecture)
The Overview always promised a primal/dual pairing, but the dual was never developed. Now it is:
linprogand observe strong duality (both optimal values= 27.5).(0.625, 0.4375)as shadow prices, and verify the material shadow price by perturbation (relaxing the material constraint 30→31 raises revenue by exactly0.625).linprogreports shadow prices directly via.ineqlin.marginals.Other
linprog.Verification
All code cells were executed via
jupytext --to pyand run successfully; every numerical result quoted in the prose matches the solver output (production27.5, investment141018.24, dual27.5/ shadow prices(0.625, 0.4375), exercises23.33and297.5).🤖 Generated with Claude Code