The simplex method with Bland's rule #
This module formalizes Bland's smallest-subscript pivoting rule ([Bla77]; [Chv83],
Chapter 3) for the simplex method on the dictionaries of
CslibFrontier.Algorithms.Lean.Simplex.Dictionary, proves that it never cycles, and derives
termination and correctness of the simplex method started from a feasible dictionary.
Algorithm #
In a dictionary D (blandStep):
- if no nonbasic variable has a positive reduced cost,
Dis optimal; - otherwise the entering variable
sis the smallest nonbasic variable with a positive reduced cost (blandEntering); - if no basic variable has
coeff i s < 0, the objective is unbounded along the edge ofs; - otherwise the leaving variable is the smallest basic variable among those with
coeff i s < 0minimizing the ratiorhs i / -coeff i s(blandLeaving), and the method pivots.
runWith step D fuel iterates at most fuel pivots of a pivoting rule step. Its soundness
(runWith_eq_optimal, runWith_eq_unbounded) is proved once, from what the rule promises when it
stops and when it pivots. run D fuel is runWith with Bland's rule, and simplex D runs with
fuel (Fintype.card ι).choose #D.basis - 1.
Source mapping #
The rule is Bland's smallest-subscript rule ([Bla77]; [Chv83], Chapter 3), with
variables ordered by the linear order on ι. basis_ne_of_blandPivot is the theorem that the
rule does not cycle: along any sequence of Bland pivots from a feasible dictionary, no basis
repeats. The proof is the standard argument: in a cycle every pivot is degenerate, so all
dictionaries of the cycle share one basic solution and one objective value; let t be the
largest variable that is basic in some dictionary of the cycle and nonbasic in another, E p a
dictionary where t leaves with s entering, and E q one where t enters. Evaluating the
objective rows of E p and E q along the edge of s in E p, where they agree because the
two dictionaries are equivalent, produces a variable v < t that ties with t in the ratio test
of E p, contradicting the choice of t as the leaving variable. Since pivots preserve the
number of basic variables, at most N.choose m bases occur, where N = Fintype.card ι and
m = #D.basis (add_one_le_choose_of_blandPivot).
Main definitions #
Cslib.Algorithms.Lean.Simplex.minOpt: the smallest element of a finite set, as anOption.Cslib.Algorithms.Lean.Simplex.Step,Cslib.Algorithms.Lean.Simplex.Outcome: the decision of one simplex step and the result of a run.Cslib.Algorithms.Lean.Simplex.Dictionary.runWith: the simplex method with a given pivoting rule and at mostfuelpivots.Cslib.Algorithms.Lean.Simplex.Dictionary.blandEntering,Cslib.Algorithms.Lean.Simplex.Dictionary.blandLeaving,Cslib.Algorithms.Lean.Simplex.Dictionary.blandStep: Bland's rule.Cslib.Algorithms.Lean.Simplex.Dictionary.BlandPivot: one pivot by Bland's rule.Cslib.Algorithms.Lean.Simplex.Dictionary.run,Cslib.Algorithms.Lean.Simplex.Dictionary.simplex: the simplex method with Bland's rule.
Main results #
Dictionary.runWith_eq_optimal,Dictionary.runWith_eq_unbounded: soundness of the simplex method with any pivoting rule that stops only when the answer is correct and otherwise makes pivots that preserve feasibility, equivalence and a nondecreasing objective value.Dictionary.basis_ne_of_blandPivot: Bland's rule does not cycle.Dictionary.add_one_le_choose_of_blandPivot: at mostN.choose m - 1Bland pivots occur.Dictionary.run_ne_outOfFuel,Dictionary.simplex_ne_outOfFuel: termination.Dictionary.simplex_spec: started from a feasible dictionary, the simplex method returns an equivalent feasible dictionary whose basic solution is optimal, or detects that the objective is unbounded on the feasible set.
Limitations #
A feasible starting dictionary is assumed; Phase I (finding one, or detecting infeasibility) is not formalized. The method is a pure Lean function over an exact field; no machine-level running time or bit complexity is certified.
References #
The smallest element of a finite set, if any. This is Mathlib's Finset.min with the result
in Option ι rather than WithTop ι; the simplex step matches on it directly, and the worked
examples evaluate it with decide +kernel.
Instances For
The result of a run of the simplex method: an optimal dictionary, a dictionary with an
unbounded entering variable s, or the dictionary reached when the fuel ran out.
- optimal {ι : Type u_1} {K : Type u_2} (D : Dictionary ι K) : Outcome ι K
- unbounded {ι : Type u_1} {K : Type u_2} (D : Dictionary ι K) (s : ι) : Outcome ι K
- outOfFuel {ι : Type u_1} {K : Type u_2} (D : Dictionary ι K) : Outcome ι K
Instances For
The simplex method with a pivoting rule #
The simplex method with the pivoting rule step and at most fuel pivots: stop when step
says so, otherwise pivot as it says.
Instances For
A run that runs out of fuel fuel makes fuel + 1 pivots of its rule.
Soundness of a pivoting rule, optimal case. If the rule stops only at dictionaries with no
positive reduced cost, and its pivots from a feasible dictionary give an equivalent feasible
dictionary with no smaller objective value, then a run that stops at an optimal dictionary D'
returns an equivalent feasible dictionary with no positive reduced cost and an objective value at
least that of D.
Soundness of a pivoting rule, unbounded case. If the rule reports an unbounded entering
variable s only when s is nonbasic with a positive reduced cost and no row bounds its
increase, and its pivots from a feasible dictionary give an equivalent feasible dictionary, then a
run that stops with an unbounded entering variable s returns an equivalent feasible dictionary
in which this holds.
Bland's rule #
The nonbasic variables with a positive reduced cost.
Instances For
The basic variables whose rows decrease along the edge of s.
Instances For
The leaving candidates of minimal ratio.
Instances For
Bland's entering rule ([Bla77]): the smallest nonbasic variable with a positive reduced cost.
Instances For
Bland's leaving rule ([Bla77]): among the rows passing the ratio test for the
entering variable s, the smallest basic variable.
Instances For
One step of the simplex method with Bland's rule.
Instances For
D' arises from D by one pivot of Bland's rule.
Instances For
Bland's rule does not cycle ([Bla77]; [Chv83], Chapter 3): along any sequence of Bland pivots from a feasible dictionary, no basis repeats.
At most N.choose m - 1 Bland pivots: along a sequence of n Bland pivots from a
feasible dictionary with m basic variables among N variables, n + 1 ≤ N.choose m.
The simplex method with Bland's rule #
The simplex method with Bland's rule and at most fuel pivots.
Instances For
The simplex method with Bland's rule ([Bla77]; [Chv83], Chapter 3), with the
fuel N.choose m - 1 that suffices from a feasible dictionary (simplex_ne_outOfFuel).
Instances For
Termination of Bland's rule: from a feasible dictionary, N.choose m - 1 pivots of fuel
suffice.
A pivot of Bland's rule preserves feasibility, equivalence and does not decrease the objective.
Bland's rule reports an unbounded entering variable s only when s is nonbasic with a
positive reduced cost and no row bounds its increase.
A run that stops at an optimal dictionary D' returns an equivalent feasible dictionary
with no positive reduced cost and an objective value at least that of D.
A run that stops with an unbounded entering variable s returns an equivalent feasible
dictionary in which s is nonbasic with a positive reduced cost and no row bounds its
increase.
Correctness of the simplex method with Bland's rule ([Chv83], Chapter 3): from a
feasible dictionary D it either stops at an equivalent feasible dictionary whose basic solution
attains the maximum D'.objConst of the objective over the feasible set, or detects that the
objective is unbounded above on the feasible set.