Documentation

CslibFrontier.Algorithms.Lean.Simplex.KleeMinty

The Klee–Minty lower bound for Dantzig's rule #

This module proves that the simplex method with Dantzig's largest-coefficient rule (CslibFrontier.Algorithms.Lean.Simplex.Dantzig) makes exactly 2 ^ n - 1 pivots on the n-dimensional Klee–Minty program ([KM72]; the form below is the one presented in [Chv83], Chapter 4), started from its slack dictionary, for every n and over every linearly ordered field.

The program #

With 0-based indices, the n-dimensional Klee–Minty program is

maximize ∑_{j<n} 10 ^ (n - 1 - j) * x_j subject to 2 * ∑_{j<i} 10 ^ (i - j) * x_j + x_i ≤ 100 ^ i for i < n, and x ≥ 0

(kleeMintyMatrix, kleeMintyRhs, kleeMintyObj). [Chv83] writes it with 1-based indices, 10 ^ (n - j) and 100 ^ (i - 1). For n ≥ 1 its optimum is 100 ^ (n - 1), attained at x = (0, …, 0, 100 ^ (n - 1)).

Proof #

The variables are those of slackDictionary: x_k and its slack w_k form pair k. The run visits the vertices N = 0, 1, …, 2 ^ n - 1 in order, and the dictionary at vertex N is given in closed form (KleeMinty.dict): x_k is basic iff bits k and k + 1 of N differ (so the basic original variables form the reflected binary Gray code of N), and the row constants, coefficients and reduced costs are explicit functions of the bits of N. If j is the lowest zero bit of N < 2 ^ n - 1, then

At N = 2 ^ n - 1 no reduced cost is positive (KleeMinty.dantzigStep_dict_top). The objective strictly increases along the run and the 2 ^ n bases are pairwise distinct, so the run visits every vertex of the deformed cube. The entering and leaving variables are the unique maximizer and minimizer at every step, so the tie-breaking conventions of dantzigStep play no role.

Main definitions #

Main results #

Limitations #

The lower bound counts pivots of this particular rule (Dantzig's entering rule with the smallest-index ratio test); no machine-level running time is certified. Bland's rule also takes more than polynomially many pivots on suitable programs, but that is not formalized here; the worked examples only compare the two rules for n = 3, 4.

References #

The constraint matrix of the n-dimensional Klee–Minty program ([Chv83], Chapter 4): 2 * 10 ^ (i - j) below the diagonal, 1 on it and 0 above it.

The right-hand side 100 ^ i of the n-dimensional Klee–Minty program.

The objective 10 ^ (n - 1 - j) of the n-dimensional Klee–Minty program.

-1 if bit k of N is set, 1 otherwise.

Pair k is flipped at vertex N when bits k and k + 1 of N differ.

The value at vertex N of z_k = ∑_{j<k} 10^{k-1-j} x_j.

The constant of row k at vertex N.

The coefficient of the nonbasic variable of pair p in the row of pair k.

The reduced cost of the nonbasic variable of pair p.

The pair of a variable: x_k and the slack w_k form pair k.

Whether a variable is an original variable x_k rather than a slack w_k.

The variable of pair k that is an original variable iff b.

v is basic at vertex N: x_k is basic iff pair k is flipped.

Instances For

    The dictionary at vertex N of the n-dimensional Klee–Minty program. The variables are those of slackDictionary: x_k = Fin.castAdd n k and its slack w_k = Fin.natAdd n k form pair k. Exactly one variable of each pair is basic, x_k iff bits k and k + 1 of N differ (Basic). Writing t_p for the nonbasic variable of pair p, the row of the basic variable of pair k is rowConst N k + ∑_{p<k} rowCoeff N k p * t_p - t_k, and the objective is zVal N n + ∑_p cost n N p * t_p. Entries outside these ranges are 0, as in Dictionary.pivot.

    Bits #

    Signs, values and coefficients #

    From vertex N to vertex N + 1 #

    Variables #

    The dictionaries #

    theorem Cslib.Algorithms.Lean.Simplex.KleeMinty.mem_dict_basis {K : Type u_1} [Field K] {n N : ℕ} {v : Fin (n + n)} :
    v ∈ (dict n N).basis ↔ Basic N v
    theorem Cslib.Algorithms.Lean.Simplex.KleeMinty.dict_rhs {K : Type u_1} [Field K] {n N : ℕ} {v : Fin (n + n)} (h : Basic N v) :
    (dict n N).rhs v = rowConst N ↑(pair v)
    theorem Cslib.Algorithms.Lean.Simplex.KleeMinty.dict_coeff {K : Type u_1} [Field K] {n N : ℕ} {v u : Fin (n + n)} (hv : Basic N v) (hu : ¬Basic N u) :
    (dict n N).coeff v u = rowCoeff N ↑(pair v) ↑(pair u)
    theorem Cslib.Algorithms.Lean.Simplex.KleeMinty.dict_objCoeff {K : Type u_1} [Field K] {n N : ℕ} {u : Fin (n + n)} (hu : ¬Basic N u) :
    (dict n N).objCoeff u = cost n N ↑(pair u)
    theorem Cslib.Algorithms.Lean.Simplex.KleeMinty.pivot_dict {K : Type u_1} [Field K] {n N : ℕ} {j : Fin n} (hj : N.testBit ↑j = false) (hlow : ∀ l < ↑j, N.testBit l = true) :
    (dict n N).pivot (var j (flipped N ↑j)) (var j !flipped N ↑j) = dict n (N + 1)

    The pivot step: at the lowest zero bit j of N, pivoting dict n N on the leaving basic variable of pair j and the entering nonbasic variable of pair j yields dict n (N + 1).

    Dantzig's rule on the dictionaries #

    theorem Cslib.Algorithms.Lean.Simplex.KleeMinty.dantzigEntering_dict {K : Type u_1} [Field K] {n : ℕ} [LinearOrder K] [IsStrictOrderedRing K] {N : ℕ} (hN : N < 2 ^ n) {j : Fin n} (hj : N.testBit ↑j = false) (hlow : ∀ l < ↑j, N.testBit l = true) :

    At vertex N < 2 ^ n - 1 with lowest zero bit j, Dantzig's rule enters the nonbasic variable of pair j: its reduced cost 10 ^ (n - 1 - j) is the unique largest one.

    theorem Cslib.Algorithms.Lean.Simplex.KleeMinty.blandLeaving_dict {K : Type u_1} [Field K] {n : ℕ} [LinearOrder K] [IsStrictOrderedRing K] {N : ℕ} {j : Fin n} (hj : N.testBit ↑j = false) :
    (dict n N).blandLeaving (var j !flipped N ↑j) = some (var j (flipped N ↑j))

    At vertex N with lowest zero bit j, the ratio test leaves the basic variable of pair j: its ratio is strictly smallest.

    theorem Cslib.Algorithms.Lean.Simplex.KleeMinty.dantzigStep_dict {K : Type u_1} [Field K] {n : ℕ} [LinearOrder K] [IsStrictOrderedRing K] {N : ℕ} (hN : N < 2 ^ n - 1) :
    ∃ (r : Fin (n + n)) (s : Fin (n + n)), (dict n N).dantzigStep = Step.pivot r s ∧ (dict n N).pivot r s = dict n (N + 1)

    Below the last vertex, one step of Dantzig's rule moves from vertex N to vertex N + 1.

    At the last vertex 2 ^ n - 1 no reduced cost is positive, so Dantzig's rule stops.

    theorem Cslib.Algorithms.Lean.Simplex.KleeMinty.dantzigRun_dict {K : Type u_1} [Field K] {n : ℕ} [LinearOrder K] [IsStrictOrderedRing K] {N : ℕ} (hN : N ≤ 2 ^ n - 1) (f : ℕ) :
    (dict n N).dantzigRun f = if N + f < 2 ^ n - 1 then Outcome.outOfFuel (dict n (N + f)) else Outcome.optimal (dict n (2 ^ n - 1))

    The run of Dantzig's rule from vertex N: after f pivots it is at vertex N + f, and it stops at the last vertex 2 ^ n - 1.

    Every dictionary dict n N is feasible.

    theorem Cslib.Algorithms.Lean.Simplex.KleeMinty.objConst_dict_lt_of_lt {K : Type u_1} [Field K] {n : ℕ} [LinearOrder K] [IsStrictOrderedRing K] {N M : ℕ} (hNM : N < M) (hM : M ≤ 2 ^ n - 1) :

    The objective strictly increases along the run: the vertices 0, …, 2 ^ n - 1 have distinct objective values.

    theorem Cslib.Algorithms.Lean.Simplex.KleeMinty.eq_of_dict_basis_eq {K : Type u_1} [Field K] {n N M : ℕ} (hN : N < 2 ^ n) (hM : M < 2 ^ n) (h : (dict n N).basis = (dict n M).basis) :
    N = M

    The bases of the dictionaries dict n N, N < 2 ^ n, are pairwise distinct.

    The Klee–Minty program #

    theorem Cslib.Algorithms.Lean.Simplex.KleeMinty.objConst_dict_top {K : Type u_1} [Field K] {n : ℕ} :
    (dict (n + 1) (2 ^ (n + 1) - 1)).objConst = 100 ^ n

    The objective value at the last vertex of the (n + 1)-dimensional program is 100 ^ n.

    Klee–Minty: on the n-dimensional Klee–Minty program, started from its slack dictionary, the simplex method with Dantzig's rule runs out of fuel after f < 2 ^ n - 1 pivots and stops at an optimal dictionary after exactly 2 ^ n - 1 pivots.

    Dantzig's rule makes exactly 2 ^ n - 1 pivots on the n-dimensional Klee–Minty program: a run with fuel f runs out of fuel iff f < 2 ^ n - 1; otherwise it stops at an optimal dictionary (dantzigRun_kleeMinty).

    theorem Cslib.Algorithms.Lean.Simplex.isGreatest_kleeMinty {K : Type u_1} [Field K] [LinearOrder K] [IsStrictOrderedRing K] (n : ℕ) :
    IsGreatest ((fun (x : Fin (n + 1) → K) => kleeMintyObj (n + 1) ⬝ᵥ x) '' {x : Fin (n + 1) → K | 0 ≤ x ∧ (kleeMintyMatrix (n + 1)).mulVec x ≤ kleeMintyRhs (n + 1)}) (100 ^ n)

    The Klee–Minty optimum: the maximum of the (n + 1)-dimensional Klee–Minty program is 100 ^ n, as certified by the final dictionary of the run of Dantzig's rule.