From 7dbf34cb0119dd9859cfeeec467d4f9366617975 Mon Sep 17 00:00:00 2001 From: Zoey Zheng Date: Mon, 18 May 2026 22:05:25 +1000 Subject: [PATCH 1/2] Clarify scipy linprog transformation description Clarifies that SciPy transforms the problem into standard form internally after presolve. --- lectures/lp_intro.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lectures/lp_intro.md b/lectures/lp_intro.md index 52504a5a..8fe94c98 100644 --- a/lectures/lp_intro.md +++ b/lectures/lp_intro.md @@ -487,9 +487,9 @@ The optimal plan tells the factory to produce $2.5$ units of Product 1 and $5$ We are using the `linprog` function as a *black box*. -Inside it, Python first transforms the problem into standard form. +Internally, after a presolve step, SciPy transforms the problem into a standard form before applying the selected solver. -To do that, for each inequality constraint it generates one slack variable. +In this transformation, one slack variable is added for each inequality constraint. Here the vector of slack variables is a two-dimensional NumPy array that equals $b_{ub} - A_{ub}x$. From 63172073bf164b614cff7f6bde113ed47aef1b30 Mon Sep 17 00:00:00 2001 From: Zoey Zheng Date: Mon, 25 May 2026 21:42:58 +1000 Subject: [PATCH 2/2] Revise linprog description after review Clarifies the description of SciPy's default highs method and the returned slack values. --- lectures/lp_intro.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lectures/lp_intro.md b/lectures/lp_intro.md index 8fe94c98..c8c3cadd 100644 --- a/lectures/lp_intro.md +++ b/lectures/lp_intro.md @@ -487,11 +487,11 @@ The optimal plan tells the factory to produce $2.5$ units of Product 1 and $5$ We are using the `linprog` function as a *black box*. -Internally, after a presolve step, SciPy transforms the problem into a standard form before applying the selected solver. +SciPy accepts inequality constraints in the form $A_{ub} x \leq b_{ub}$, equality constraints in the form $A_{eq} x = b_{eq}$, and variable bounds. -In this transformation, one slack variable is added for each inequality constraint. +In this lecture, `linprog` uses SciPy's default `highs` method, which calls the HiGHS optimization solver. -Here the vector of slack variables is a two-dimensional NumPy array that equals $b_{ub} - A_{ub}x$. +The slack value returned by `linprog` is a one-dimensional NumPy array whose entries measure the difference $b_{ub} - A_{ub}x$ for each inequality constraint. See the [official documentation](https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.linprog.html#scipy.optimize.linprog) for more details.