Documentation

CslibFrontier.Algorithms.WordRAM.Auction.SumCost

Accumulating and signed-encoding the optimal assignment cost #

Reads the scattered optimal permutation from ws.outBase and the (n + 1)-scaled shifted costs from ws.bC, sums the unscaled shifted costs cScaled / ws.scale, subtracts the shift total n * M, and emits Signed.encode inst.minCost in ≤ 2 * n memory steps.

Main definitions #

Main results #

Sum the unscaled shifted costs along the assignment written at ws.outBase and emit Signed.encode inst.minCost.

theorem Cslib.Algorithms.WordRAM.Auction.sumScaledCostProg_spec {w : ℕ} (inst : Instance) (ws : AuctionWS) (s₀ : DataStructure.Memory.State) (hws : ValidWS ws s₀) (hn : ws.n = inst.n) (hscale : ws.scale = inst.n + 1) (hM_le : ws.M ≤ inst.maxMag) (hM_ge : ∀ (i j : Fin inst.n), (inst.cost (i, j)).natAbs ≤ ws.M) (hC_mem : ∀ (i j : Fin inst.n), s₀.mem (ws.bC + (↑i * inst.n + ↑j)) = (inst.n + 1) * (inst.cost (i, j) + ↑ws.M).toNat) (hout : WordRAM.outputList s₀.mem ws.outBase = inst.assignment) (hw : WordRAM.Fits w inst.wordBound) (hfit_ws : WordRAM.Fits w (ws.outBase + ws.n + 1)) :

Specification of sumScaledCostProg: computes inst.encodedMinCost in at most 2 * inst.n memory steps.