Repository navigation
02: the simplex tableau by hand, and a barrier method through the middle - #8
Merged
Merged
Conversation
Folder 02 has been empty since the library was built, while both IE 3315 and IE 5301 spend two lectures on bases and the simplex method (decks 04 and 05) and IE 5301 adds interior point (deck 03, barrierShort.ipynb). simplex_by_hand.ipynb uses the course's own tableau example (deck 05): max 40x1 + 50x2, x1 + 2x2 <= 40, 4x1 + 3x2 <= 120. It enumerates all six bases (four feasible corners), then pivots the tableau by hand, each pivot written out as three row operations: (0, 0) -> (0, 20) -> (24, 8), z 1360, exactly the slides' path. Row 0's final entries under the slacks (16 and 6) equal Gurobi's duals; the notebook asks the reader to notice rather than saying so. No ties anywhere in the tableau, so the path is the problem's and is compared corner by corner. interior_point.ipynb replaces barrierShort.ipynb, which ran on a random instance redrawn every run, so none of its numbers could be quoted. Same LP: one equality-constrained Newton step written out (gradient, Hessian, KKT system, decrement), the backtracking line search, centering, then the central path as t grows from T0 = 0.001 by MU = 2. 32 centerings, 65 Newton steps; the path starts near the middle at (10.3, 7.3) and curves in to (24, 8). A figure draws it against the simplex's corners (line style and marker, plus a Figure line). Gurobi's barrier with crossover off is the cross-check. orteach.simplex: standard_form (refuses anything but max with <= rows and b >= 0, the case the tableau starts from), basic_solutions, tableau_path (Dantzig's rule, lowest index on ties), barrier_path. The agreement assertions compare all six bases and the path (40 comparisons), and every barrier iterate (132), to AGREEMENT_RTOL; the barrier's end against the simplex, and Gurobi's, to CROSS_METHOD_RTOL (6.8e-10 and 4.7e-12). The slides' exercise, Wyndor, ships as lp_wyndor.csv and its path is tested. Gate: 214 passed; 22 notebooks and 16 seeds clean; ruff clean. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Stacked on #7. Its base is
newsvendor/server-farm. Merge order: #4, #5, #6, #7, then this.Fills
02_simplex_and_bases, which has been empty since the library was built. Both notebooks use IE 3315's own tableau example: maximise 40x1 + 50x2 subject to x1 + 2x2 ≤ 40 and 4x1 + 3x2 ≤ 120.simplex_by_hand: lists all six bases (four are feasible corners), then pivots the tableau by hand from (0, 0) to (0, 20) to (24, 8), the same path as the slides. The final tableau's entries under the slacks equal Gurobi's dual values; the notebook asks students to spot that.interior_point: a barrier method on the same LP, with one Newton step written out, then the central path drawn against the simplex's corners. It replacesbarrierShort.ipynb, whose instance was regenerated randomly on every run.Package:
orteach.simplex. The notebook-versus-package checks match to 0; the barrier's end point matches the simplex optimum to within 6.8e-10.🤖 Generated with Claude Code