Skip to content

02: the simplex tableau by hand, and a barrier method through the middle - #8

Merged
yamierick merged 1 commit into
mainfrom
simplex/bases-and-barrier
Oct 27, 2026
Merged

yamierick merged 1 commit into
mainfrom
simplex/bases-and-barrier

Conversation

@yamierick

Copy link
Copy Markdown
Contributor

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 replaces barrierShort.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

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>
@yamierick
yamierick changed the base branch from newsvendor/server-farm to main October 27, 2026 14:32
@yamierick
yamierick merged commit fcf54c8 into main Oct 27, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant