Documentation

CslibFrontier.Algorithms.Lean.Assignment.Basic

The assignment problem: duality and ε-complementary slackness #

The (square, complete) assignment problem asks for a permutation σ of a finite type ι minimising the total cost ∑ i, c (i, σ i); person i receives object σ i. Its linear-programming dual maximises ∑ i, u i + ∑ j, v j over potentials with u i + v j ≤ c (i, j).

This module records the duality facts used by the auction algorithm of [Ber88] (CslibFrontier.Algorithms.Lean.Assignment.Auction), in the cost-minimisation form (Bertsekas maximises benefits a = -c). Object prices p play the role of the column potentials -p. A complete assignment σ and prices p satisfy ε-complementary slackness ([Ber98], (7.1)) if each person's object is within ε of a least reduced cost c (i, k) + p k.

Everything is stated over an arbitrary finite index type and a linearly ordered additive commutative group, so the lemmas apply to integer, rational and real costs alike.

Main definitions #

Main results #

References #

def Cslib.Algorithms.Lean.Assignment.IsEpsCompSlack {ι : Type u_1} {α : Type u_2} [AddCommGroup α] [LinearOrder α] (c : ι × ι → α) (ε : α) (σ : Equiv.Perm ι) (p : ι → α) :

A complete assignment σ (person i gets object σ i) and object prices p satisfy ε-complementary slackness for the cost c if every person's object has reduced cost c (i, σ i) + p (σ i) within ε of every other reduced cost c (i, k) + p k ([Ber98], (7.1), stated for costs c = -a).

theorem Cslib.Algorithms.Lean.Assignment.sum_add_sum_le_sum_perm {ι : Type u_1} {α : Type u_2} [Fintype ι] [AddCommGroup α] [LinearOrder α] [IsOrderedAddMonoid α] {c : ι × ι → α} {u v : ι → α} (h : ∀ (i j : ι), u i + v j ≤ c (i, j)) (τ : Equiv.Perm ι) :
∑ i : ι, u i + ∑ j : ι, v j ≤ ∑ i : ι, c (i, τ i)

Weak duality for the assignment problem: the total of potentials u, v with u i + v j ≤ c (i, j) is at most the cost of every assignment.

theorem Cslib.Algorithms.Lean.Assignment.IsEpsCompSlack.sum_le_sum_add {ι : Type u_1} {α : Type u_2} [Fintype ι] [AddCommGroup α] [LinearOrder α] [IsOrderedAddMonoid α] {c : ι × ι → α} {ε : α} {σ : Equiv.Perm ι} {p : ι → α} (h : IsEpsCompSlack c ε σ p) (τ : Equiv.Perm ι) :
∑ i : ι, c (i, σ i) ≤ ∑ i : ι, c (i, τ i) + Fintype.card ι • ε

nε-optimality ([Ber98], Prop. 1.4): a complete assignment satisfying ε-complementary slackness with some prices costs at most card ι • ε more than every assignment.

def Cslib.Algorithms.Lean.Assignment.rowPotential {ι : Type u_1} {α : Type u_2} [Fintype ι] [AddCommGroup α] [LinearOrder α] (c : ι × ι → α) (p : ι → α) (i : ι) :
α

The row potentials of prices p: the least reduced cost min_k (c (i, k) + p k) of row i. Together with the column potentials -p they are feasible for the dual of the assignment problem (rowPotential_add_neg_le).

theorem Cslib.Algorithms.Lean.Assignment.rowPotential_add_neg_le {ι : Type u_1} {α : Type u_2} [Fintype ι] [AddCommGroup α] [LinearOrder α] [IsOrderedAddMonoid α] (c : ι × ι → α) (p : ι → α) (i j : ι) :
rowPotential c p i + -p j ≤ c (i, j)

Prices give feasible dual potentials: rowPotential c p i + -p j ≤ c (i, j).

theorem Cslib.Algorithms.Lean.Assignment.IsEpsCompSlack.sum_le_rowPotential {ι : Type u_1} {α : Type u_2} [Fintype ι] [AddCommGroup α] [LinearOrder α] [IsOrderedAddMonoid α] {c : ι × ι → α} {ε : α} {σ : Equiv.Perm ι} {p : ι → α} (h : IsEpsCompSlack c ε σ p) :
∑ i : ι, c (i, σ i) ≤ ∑ i : ι, rowPotential c p i + ∑ j : ι, -p j + Fintype.card ι • ε

Approximate dual certificate: if σ and p satisfy ε-complementary slackness, the feasible potentials rowPotential c p and -p have total within card ι • ε of the cost of σ. With sum_add_sum_le_sum_perm this certifies IsEpsCompSlack.sum_le_sum_add.