Bertsekas's auction algorithm for the assignment problem #
This module implements the Gauss–Seidel auction algorithm of [Ber79] and [Ber88]
for the square, complete assignment problem with integer costs c : Fin n × Fin n → ℤ, and proves
its correctness: ε-complementary slackness is invariant, the algorithm terminates within an
explicit pseudo-polynomial number of bids, its output is within n * ε of optimal, and it is
exactly optimal when the costs are scaled by n + 1 and ε = 1.
Algorithm #
The state (AuctionState) records the owner of each object, integer object prices, a stack of
unassigned persons and a bid counter. Starting from the empty assignment and zero prices
(auctionInit), each step (bidStep) lets the unassigned person i on top of the stack bid:
ipicks an objectjof least reduced costv = c (i, j) + p j(bestObject, the first minimiser), and the second least reduced costwover the objectsk ≠ j(secondBest);- the price of
jrises tow - c (i, j) + ε, i.e. byw - v + ε ≥ ε(bidPrice; ifn = 1there is no second object and the price rises byε); jis assigned toi, and its previous owner (if any) is pushed onto the stack.
This is the cost form (c = -a) of [Ber98], §7.1.1, (7.2)–(7.5), with bidding set I a
single unassigned person (the Gauss–Seidel version). Bertsekas sets w = -∞ (in benefit form)
when the bidder has a single object; we raise the price by ε instead, which also preserves
ε-complementary slackness. The loop (auctionLoop) runs until the stack is empty, with fuel
bidBound n (costSpread c) ε computed from the data (auction).
Cost model and limitations #
- The resource measure here is the number of bids (
AuctionState.bids); machine-levelO(n² (C / ε + 1))and scaledO(n³ C + n²)running-time bounds on the word RAM live inCslibFrontier.Algorithms.WordRAM.Auction. - The bid bound
bids_auction_leis pseudo-polynomial: at mostn (C + ε) / ε + 1bids when every row has cost range at mostC; it comes from the measuren (C + ε) - ∑ j, p j, which every bid lowers by at leastεand which stays nonnegative while some person is unassigned. With anO(n)scan per bid this givesO(n² C / ε)operations, consistent with (and, on complete instances withA = n²arcs, sharper than) the pure (unscaled) auction'sO(n A C / ε)running time of [Ber88], §1. ThereC = max |a i j|; hereCbounds the row cost ranges, soC = 2 max |c (i, j)|is always admissible. Theε-scaling version and itsO(n A log (n C))bound ([Ber98], Prop. 7.3) are not formalized. - Integer costs and prices, complete bipartite instances (every person may take every object),
and square instances (
npersons,nobjects) only. The Jacobi (parallel bidding), reverse and asymmetric auctions of [Ber98], §7.1–7.2 are not covered.
Main definitions #
AuctionState,bestObject,secondBest,bidPrice,bidStep,auctionInit,auctionLoop: the auction as a Lean program.bidBound,costSpread,auction: the fuel bound and the complete algorithm.auctionPerm c hε: the computed assignment, as a permutation ofFin n.scaledAuction c,scaledAuctionPerm c: the exact auction, run on(n + 1) • cwithε = 1, and its assignment.AuctionInv: the invariant (partial matching, exact free list, unassigned objects at price0,ε-complementary slackness).
Main results #
AuctionInv.bidStep: a bid preserves the invariant, in particularε-complementary slackness ([Ber98], Prop. 7.1).sum_price_bidStep,AuctionInv.price_le: the termination measure.auction_free,bids_auction_le: termination with a complete assignment withinbidBound n C εbids ([Ber98], Prop. 7.2, with an explicit bound).isEpsCompSlack_auctionPerm,sum_auctionPerm_le,sum_auctionPerm_le_rowPotential: the output satisfiesε-complementary slackness with the final prices, costs at mostn * εmore than every assignment, and the final prices give a dual certificate of this ([Ber98], Props. 1.4 and 7.2).sum_scaledAuctionPerm_le,bids_scaledAuction_le: exact optimality for integer costs after scaling byn + 1withε = 1([Ber88], §3; [Ber98], §7.1.4), withinn ((n + 1) C + 1) + 1bids.price_nonneg_bidStep,auction_add_const,auctionPerm_add_const: nonnegativity of object prices and invariance of the auction trajectory under uniform cost shiftsc + d.
References #
The auction algorithm #
State of the Gauss–Seidel auction: the current owner of each object (if any), object prices, the stack of unassigned persons (the next bidder first), and the number of bids so far.
The bid of person i for its best object j: the price w - c (i, j) + ε at which j's
reduced cost becomes ε more than the second least reduced cost w, i.e. p j + (w - v) + ε
where v is the least reduced cost ([Ber98], (7.4)); p j + ε if j is the only
object.
One bid: the first unassigned person i bids for its best object j, raising its price to
bidPrice; j is assigned to i and its previous owner (if any) becomes unassigned. A state
with no unassigned person is fixed.
The initial state: nothing assigned, all prices 0.
The bid bound n (C + ε) / ε + 1 for a row cost range C.
A computable bound on the row cost ranges: 2 ∑ᵢ ∑ⱼ |c (i, j)| bounds every
c (i, k) - c (i, j) (sub_le_costSpread).
The auction algorithm with bidding increment ε, run for bidBound n (costSpread c) ε
bids, which suffices for termination when 0 < ε (auction_free).
The object of person i in a state (i itself if i is unassigned).
The owner of object j in a state (j itself if j is unassigned).
The invariant #
Invariant of the auction ([Ber98], §7.1.1): the owner table is a partial matching,
the stack of unassigned persons is exact and duplicate-free, unassigned objects keep price 0,
and every assigned pair satisfies ε-complementary slackness (7.1).
No person owns two objects.
The stack of unassigned persons has no duplicates.
The stack lists exactly the persons owning no object.
Objects never bid for keep their initial price
0.- epsCS (j i : Fin n) : s.owner j = some i → ∀ (k : Fin n), c (i, j) + s.price j ≤ c (i, k) + s.price k + ε
ε-complementary slackness for every assigned pair.
The initial state satisfies the invariant.
A bid preserves the invariant; in particular it preserves ε-complementary slackness
([Ber98], Prop. 7.1).
While some person is unassigned, every price is at most C + ε, where C bounds the row
cost ranges: the owner of an object prefers it, up to ε, to an unassigned object of price 0
(cf. [Ber98], §7.1.1, observation (a)).
Termination by the measure n (C + ε) - ∑ j, p j, which every bid lowers by at least ε
and which is nonnegative while some person is unassigned: if the measure is below fuel * ε,
then fuel bids complete the assignment.
Extra fuel does not change a completed run.
A run with fuel makes at most fuel bids.
With fuel bidBound n C ε for any bound C on the row cost ranges, the auction completes the
assignment and maintains the invariant.
Bid bound: if c (i, k) - c (i, j) ≤ C for all i, j, k, the auction makes at most
n (C + ε) / ε + 1 bids. This is pseudo-polynomial: it is linear in C / ε.
The output permutation #
The assignment computed by the auction with increment ε > 0: person i is assigned object
auctionPerm c hε i.
Dual certificate: the final prices p give feasible dual potentials
(rowPotential c p, -p) (rowPotential_add_neg_le) whose total is within n * ε of the cost of
the computed assignment.
The exact auction: the auction on the costs scaled by n + 1, with ε = 1.
The assignment computed by the exact auction scaledAuction.
scaledAuctionPerm c reads the assignment off the final state scaledAuction c.
Exact optimality for integer costs ([Ber98], Prop. 7.2 with integer data and
ε < 1 / n; scaling by n + 1 as in [Ber88], §3): on the costs scaled by n + 1 and with
ε = 1, the auction returns a minimum-cost assignment.
Bid bound for the exact algorithm: if every row cost range is at most C, the exact
auction scaledAuction makes at most n ((n + 1) C + 1) + 1 bids.
Price nonnegativity and shift invariance #
Shifting every cost by a constant d leaves auctionLoop unchanged.
Shifting every cost by a constant d leaves auctionPerm unchanged.