Algorithmadvanced
Lehmann-O'Callaghan-Shoham mechanism
Also called LOS mechanism, greedy mechanism for single-minded bidders.
A greedy mechanism for single-minded bidders: sort by value over the square root of bundle size, accept disjoint bundles, charge critical values. Truthful and a sqrt(m) approximation.
- Time
- O(n^2 m) worst
- Space
- O(n + m) extra
- Where
- m = the number of items; n = the number of bidders
- Model
- Word RAM
- Properties
- not comparison baseddeterministiciterative
- Evidence
- Proof sketchCode in 1 languages
- Origin
- Daniel Lehmann, Liadan Ita O'Callaghan, Yoav Shoham, 2002
The Lehmann-O'Callaghan-Shoham mechanism (LOS) is a truthful combinatorial auction for single-minded bidders. Each such bidder wants one fixed bundle of items and values every set that contains it at the same amount, and every other set at 0. Even for these bidders, choosing the best allocation is the weighted set packing problem, which is NP-hard, so the VCG mechanism cannot run in polynomial time. LOS replaces the optimum with a greedy choice: rank the bids by value over the square root of the bundle size, and accept each bid whose bundle does not meet an accepted one. Each winner pays its critical value, the smallest bid that would still win. The result is DSIC, and the welfare is at least of the optimum, for items.
In plain words
Each bidder wants one particular group of items and says how much the group is worth to it. Groups that share an item cannot both be sold. The auction ranks the bids by worth per item, but measured gently: it divides by the square root of the group size, so that one big group does not beat many small ones too easily. Then it walks down the ranking and accepts every group that does not clash with groups it has already accepted. A winner does not pay its bid. It pays the lowest bid that would still have won, given the other bids. So bidding the truth is always best, and the result is never too far from the best possible.
The problem
There are items and bidders. Bidder is single-minded: it has a bundle and a value , and its value for a set is if and 0 otherwise. Its utility is quasilinear. Each bidder reports a bundle and a value. The mechanism picks a set of winners whose bundles are pairwise disjoint, and a payment for each winner. The aims are: truthful reporting of both the bundle and the value is a dominant strategy, the mechanism runs in polynomial time, and the welfare is close to the optimum.
The algorithm
LOS((S_1, v_1), ..., (S_n, v_n))- 1
order the bidders by v_i / sqrt(|S_i|), highest first; ties go to the smaller index - 2
W ← GREEDY(order), where GREEDY keeps a set of used items and: - 3
for each bidder i in the order - 4
if S_i does not meet the used items: accept i and add S_i to the used items - 5
for each winner i in W - 6
run GREEDY on the order without i; let j be the first accepted bidder whose bundle meets S_i - 7
p_i ← v_j · sqrt(|S_i|) / sqrt(|S_j|) if j exists, else 0 - 8
return W and the payments p
Losers pay 0. The payment of line L7 is the bid at which the key of equals the key of : . It is usually irrational, so the code returns it exactly as with a rational and a square-free integer .
Example
Four bidders bid for the items .
| bidder | bundle | value | key |
|---|---|---|---|
| 0 | 6 | ||
| 1 | 5 | ||
| 2 | 4 | ||
| 3 | 9 |
The order is . Bidder 3 takes all four items, and every other bundle meets it. Without bidder 3, the greedy run accepts bidder 0 first, and meets , so and . This is at most the bid 9, and bidder 3 would lose with any bid below . The welfare is 9, while bidders 0 and 2 together give 10.
Correctness
The proof is in proofs/correctness.md. It shows these facts.
- Feasibility. The accepted bundles are pairwise disjoint.
- Approximation. Every bundle of an optimal solution meets the bundle of a winner that comes before it in the order, or is a winner itself. Charging each optimal bundle to such a winner and using the Cauchy-Schwarz inequality gives .
- Monotonicity. If wins with , it also wins with a higher value or a smaller bundle, because both raise its key and can only remove bidders that come before it.
- Critical value. For a fixed bundle, wins exactly when its value is at least the payment of line L7, with ties broken as in line L1.
- Truthfulness. A monotone allocation rule with critical-value payments is truthful for single-minded bidders: lying about the value is handled as in Myerson's lemma, and asking for a larger bundle cannot lower the critical value, while a bundle that misses an item of is worth 0. Truthful bidders never pay more than their value.
- Tightness. One bidder that wants all items with value beats bidders that each want one item with value 1, so the ratio cannot be improved for this order.
Proof: The greedy mechanism for single-minded bidders is feasible, truthful and a square root of m approximationfull
We use the pseudocode of the page. Bidder reports a nonempty bundle and a value , and . The key of a bid is . Line L1 orders the bidders by key, highest first, with ties to the smaller index; the code compares exactly, which gives the same order. We say precedes if comes before in this order. The greedy run of lines L2 to L4 accepts a bidder when its bundle is disjoint from the bundles accepted before it. Let be the set of accepted bidders.
Claim 1 (feasibility). The bundles of the bidders in are pairwise disjoint.
Proof. Line L4 accepts a bidder only if its bundle is disjoint from the union of the bundles accepted before it.
Claim 2 (the approximation). Let be a set of bidders with pairwise disjoint bundles. Then .
Proof. Take . If , put . Otherwise line L4 rejected , so some accepted bidder that precedes has a bundle that meets ; let be the first such bidder in the order. In both cases , meets , and precedes or equals it, so its key is at least the key of : .
For , let . The bundles for are disjoint and each meets , so . They are also subsets of , so . By the Cauchy-Schwarz inequality,
The sets for partition , so summing over gives the claim.
The bound uses only items that appear in some bundle, so can be the size of the union of the bundles.
Claim 3 (monotonicity). Fix the bids of all bidders except . If bidder wins with the bid , it also wins with every bid with , and .
Proof. The key of is at least the key of , so bidder moves to the same place or earlier in the order, and the relative order of the other bidders does not change. Line L4 treats the bidders before in the same way in every run, because their treatment does not depend on bids that come later. So the set of bidders accepted before with the bid is the set of bidders accepted before in the run with that precede the new place of , a subset of the old set. The old set has no bundle that meets . So no bundle in meets , and is accepted.
Claim 4 (the payment is the critical value). Fix the bids of the others and a bundle reported by bidder . Run the greedy algorithm without , and let be the first bidder accepted in this run whose bundle meets . Put , and if no such exists. Then bidder wins with if and loses if . Lines L6 and L7 charge a winner exactly .
Proof. As in Claim 3, the bidders that precede are treated the same as in the run without . So bidder is accepted if and only if no bidder accepted before it in the run without has a bundle that meets , that is, if and only if precedes (or does not exist). Bidder precedes when , that is, , and does not precede when . At the tie rule decides. Line L6 finds this for the reported bundle, and line L7 charges .
Claim 5 (truthful bidding is a dominant strategy, and it is individually rational). A single-minded bidder with the true bundle and value gets value from every bundle that contains and 0 from all others. For every report of bidder and every report of the others, the utility of is at least the utility of and at least 0.
Proof. By Claim 4, the truthful report gives when it wins, which happens if and fails if . So its utility is , or 0 when . In every case it is , which is at least 0.
Now take a report . If it loses, its utility is 0. If it wins and , the bidder gets value 0 and pays , so its utility is at most 0. If it wins and , its utility is . By Claim 3, every makes win, so by Claim 4 . Hence .
Claim 6 (the bound of Claim 2 is tight for this algorithm). Let , with one bidder for all of with value , and bidders for the single items with value 1. The first bidder has key , so it is accepted first and blocks all the others. The welfare is , while the single items give . The ratio tends to as .
Complexity
Line L1 takes time. One greedy run with a table of used items takes time, and lines L5 to L7 make one run per winner. So the total time is and the extra space is . With large and bundles small, the bound is .
Properties
- DSIC and individually rational for single-minded bidders, for misreports of both the value and the bundle.
- A approximation of the optimal welfare. For general single-minded bids, no polynomial algorithm does better than unless , by the hardness of independent set, so the bound is close to the best possible.
- Deterministic and polynomial.
- Not VCG payments. Its truthfulness comes from a monotone allocation with critical prices, not from the VCG payment rule, which is a different route from maximal-in-range mechanisms.
Variants and improvements
- Other ranking keys. Any key that increases in the value and decreases in the bundle size gives a truthful mechanism with critical payments. Ranking by gives an approximation, and ranking by also gives ; the square root balances the two failure modes.
- Known single-minded bidders. If the bundles are public, only the values are private. This is a single-parameter environment, and any monotone algorithm with threshold payments is truthful.
- Small bundles. If every bundle has at most items, greedy by value gives a approximation.
- Multi-unit and general bidders. For bidders with general valuations, truthful polynomial mechanisms use maximal-in-range or randomized (truthful in expectation) designs, and the best known ratios are weaker.
When to use it
Use it for a combinatorial auction where each bidder wants one specific package, the instance is too large for exact winner determination, and the bidders must not need to strategize. If exact winner determination is feasible, VCG gives the optimal welfare and is also truthful.
Pitfalls
- Payments with a greedy rule that is not monotone. Critical-value payments are only truthful when the allocation is monotone. Adding a local improvement step after the greedy pass can break monotonicity.
- VCG payments with greedy allocation. Charging VCG-style payments computed with the greedy allocation is not truthful.
- Exact arithmetic. The keys and payments involve square roots. Floating point can change the order at ties and break truthfulness, so compare keys by in exact arithmetic.
- Bidders who are not single-minded. If a bidder values two different bundles, the mechanism cannot express it, and truthfulness may fail.
Implementations
Each implementation follows the pseudocode above. A comment @line links a line of code to a line of the pseudocode. Point at a line of the pseudocode to see the matching code. The build runs the native tests of each language.
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/single-minded-bidder-mechanism/. The authors are listed in prov/Z6TN8C.jsonl.
from fractions import Fraction
from typing import Sequence, Union
Number = Union[int, Fraction]
Bid = tuple[frozenset, Number]
# A payment c * sqrt(r) is stored as the pair (c, r), with c a Fraction and r
# a square-free positive integer, so that every payment is exact.
Payment = tuple[Fraction, int]
def _order(bids: Sequence[Bid]) -> list[int]:
"""Bidders by v / sqrt(|S|), highest first, compared exactly as v^2 / |S|."""
for bundle, value in bids:
if not bundle:
raise ValueError("every bundle must be nonempty")
if value < 0:
raise ValueError("values must be nonnegative")
return sorted(range(len(bids)), key=lambda i: (-Fraction(bids[i][1]) ** 2 / len(bids[i][0]), i))
def _greedy(bids: Sequence[Bid], order: Sequence[int], skip: int = -1) -> list[int]:
winners: list[int] = []
used: set = set()
for i in order: # @line L3
if i == skip:
continue
if used.isdisjoint(bids[i][0]): # @line L4
winners.append(i) # @line L4
used |= bids[i][0] # @line L4
return winners
def _surd(c: Fraction, r: int) -> Payment:
"""Write c * sqrt(r) with a square-free radicand."""
f = 1
d = 2
while d * d <= r:
while r % (d * d) == 0:
r //= d * d
f *= d
d += 1
return Fraction(c) * f, r
def single_minded_mechanism(bids: Sequence[Bid]) -> tuple[list[int], list[Payment]]:
"""The truthful greedy mechanism of Lehmann, O'Callaghan and Shoham.
bids[i] = (S_i, v_i): bidder i asks for the nonempty bundle S_i (a
frozenset of items) and reports the value v_i. Bidders are taken in the
order of v_i / sqrt(|S_i|), highest first, ties to the smaller index, and
a bidder wins if its bundle is disjoint from the bundles already won.
A winner i pays v_j * sqrt(|S_i| / |S_j|), where j is the first bidder
that wins in the same greedy run without i and whose bundle meets S_i,
and 0 if there is no such j. Return (winners in greedy order, payments),
with payments[i] = (c, r) meaning c * sqrt(r); losers pay (0, 1).
"""
order = _order(bids) # @line L1
winners = _greedy(bids, order) # @line L2
payments: list[Payment] = [(Fraction(0), 1)] * len(bids)
for i in winners: # @line L5
bundle = bids[i][0]
blocker = None
for j in _greedy(bids, order, skip=i): # @line L6
if not bundle.isdisjoint(bids[j][0]): # @line L6
blocker = j # @line L6
break
if blocker is not None: # @line L7
size_j = len(bids[blocker][0])
payments[i] = _surd(Fraction(bids[blocker][1]) / size_j, len(bundle) * size_j) # @line L7
return winners, payments # @line L8
def payment_float(p: Payment) -> float:
"""The payment c * sqrt(r) as a float, for display only."""
return float(p[0]) * p[1] ** 0.5
def sign_surd(a: Number, b: Number = 0, x: int = 0, c: Number = 0, y: int = 0) -> int:
"""Exact sign of a + b * sqrt(x) + c * sqrt(y) for rationals a, b, c and x, y >= 0."""
def sgn(t) -> int:
return (t > 0) - (t < 0)
def two(a, b, x) -> int:
# sign of a + b * sqrt(x)
sa, sb = sgn(a), sgn(b) if x else 0
if sb == 0 or sa == sb:
return sa or sb
if sa == 0:
return sb
d = sgn(a * a - b * b * x)
return sa if d > 0 else (sb if d < 0 else 0)
first = two(a, b, x)
sc = sgn(c) if y else 0
if sc == 0 or first == sc:
return first or sc
if first == 0:
return sc
# Signs differ: compare (a + b sqrt x)^2 with c^2 y.
d = two(a * a + b * b * x - c * c * y, 2 * a * b, x)
return first if d > 0 else (sc if d < 0 else 0)
test_single_minded_bidder_mechanism.py 168 lines
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/single-minded-bidder-mechanism/. The authors are listed in prov/Z6TN8C.jsonl.
import itertools
import random
from fractions import Fraction
from math import isqrt
from single_minded_bidder_mechanism import sign_surd, single_minded_mechanism
def fs(*items):
return frozenset(items)
ALL_BUNDLES = [frozenset(c) for r in (1, 2, 3) for c in itertools.combinations(range(3), r)]
def optimum(bids):
best = 0
for r in range(len(bids) + 1):
for chosen in itertools.combinations(range(len(bids)), r):
items = [x for i in chosen for x in bids[i][0]]
if len(items) == len(set(items)):
best = max(best, sum(bids[i][1] for i in chosen))
return best
def welfare(bids, winners):
return sum(bids[i][1] for i in winners)
def random_bids(rng, n, m, top):
out = []
for _ in range(n):
size = rng.randrange(1, m + 1)
out.append((frozenset(rng.sample(range(m), size)), rng.randrange(0, top)))
return out
def test_example() -> None:
bids = [(fs(0, 1), 6), (fs(1, 2), 5), (fs(2, 3), 4), (fs(0, 1, 2, 3), 9)]
winners, pay = single_minded_mechanism(bids)
assert winners == [3]
# Without bidder 3, bidder 0 wins first and meets {0, 1, 2, 3}: 6 sqrt(4 / 2).
assert pay[3] == (Fraction(6), 2)
assert pay[0] == pay[1] == pay[2] == (0, 1)
assert optimum(bids) == 10
bids = [(fs(0), 3), (fs(0, 1), 4), (fs(1), 1)]
winners, pay = single_minded_mechanism(bids)
assert winners == [0, 2]
# Bidder 0 is blocked by bidder 1 without it: 4 sqrt(1 / 2) = 2 sqrt(2).
assert pay[0] == (Fraction(2), 2)
# Without bidder 2, bidder 0 wins first and blocks bidder 1, so no winner
# meets item 1 and bidder 2 pays 0.
assert pay[2] == (0, 1)
def test_edges() -> None:
assert single_minded_mechanism([]) == ([], [])
assert single_minded_mechanism([(fs(0), 5)]) == ([0], [(0, 1)])
# Equal keys: the smaller index wins and pays exactly its own value.
assert single_minded_mechanism([(fs(0), 2), (fs(0), 2)]) == ([0], [(Fraction(2), 1), (0, 1)])
# Keys 1 and 9/4: the big bundle wins and pays 1 * sqrt(4 / 1) = 2.
winners, pay = single_minded_mechanism([(fs(0), 1), (fs(0, 1, 2, 3), 3)])
assert winners == [1] and pay[1] == (Fraction(2), 1)
for bad in ([(fs(), 1)], [(fs(0), -1)]):
try:
single_minded_mechanism(bad)
except ValueError:
pass
else:
raise AssertionError("bad input must be rejected")
def test_feasible_and_sqrt_m_approximation() -> None:
rng = random.Random(1)
for _ in range(1500):
n, m = rng.randrange(1, 7), rng.randrange(1, 6)
bids = random_bids(rng, n, m, 10)
winners, pay = single_minded_mechanism(bids)
items = [x for i in winners for x in bids[i][0]]
assert len(items) == len(set(items))
opt, w = optimum(bids), welfare(bids, winners)
used = len(set().union(*[b[0] for b in bids]))
assert opt * opt <= used * w * w
for i in range(n):
if i not in winners:
assert pay[i] == (0, 1)
else:
# Individual rationality: v_i - c sqrt(r) >= 0.
assert sign_surd(bids[i][1], -pay[i][0], pay[i][1]) >= 0
def test_tight_example() -> None:
for m in (4, 9, 16):
k = isqrt(m)
big = k + Fraction(1, 100)
bids = [(frozenset(range(m)), big)] + [(fs(j), 1) for j in range(m)]
winners, _ = single_minded_mechanism(bids)
assert winners == [0]
if m <= 9:
assert optimum(bids) == m
# The ratio m / (sqrt(m) + 1/100) of the optimum to the greedy welfare.
assert m / big > k - Fraction(1, 10)
def wins(bids, i, value):
trial = list(bids)
trial[i] = (bids[i][0], value)
return i in single_minded_mechanism(trial)[0]
def test_payment_is_critical_value() -> None:
rng = random.Random(2)
scale = 10 ** 6
for _ in range(400):
bids = random_bids(rng, rng.randrange(1, 6), rng.randrange(1, 6), 10)
winners, pay = single_minded_mechanism(bids)
for i in winners:
c, r = pay[i]
# lo <= c sqrt(r) <= hi, with hi - lo = 1 / scale.
lo = Fraction(isqrt(int(c * c * r * scale * scale)), scale)
hi = lo + Fraction(1, scale)
assert sign_surd(hi, -c, r) > 0
assert wins(bids, i, hi)
if sign_surd(lo, -c, r) < 0:
assert not wins(bids, i, lo)
def utility(true_bundle, true_value, bids, i):
winners, pay = single_minded_mechanism(bids)
if i not in winners:
return 0, 0, 1
gain = true_value if true_bundle <= bids[i][0] else 0
return gain, pay[i][0], pay[i][1]
def test_truthful_is_dominant() -> None:
rng = random.Random(3)
for _ in range(80):
bids = random_bids(rng, 3, 3, 5)
for i in range(3):
bundle, value = bids[i]
a, c, r = utility(bundle, value, bids, i)
for lie_bundle in ALL_BUNDLES:
for lie_value in range(0, 6):
trial = list(bids)
trial[i] = (lie_bundle, lie_value)
a2, c2, r2 = utility(bundle, value, trial, i)
# (a - c sqrt r) - (a2 - c2 sqrt r2) >= 0
assert sign_surd(a - a2, -c, r, c2, r2) >= 0
def test_sign_surd() -> None:
rng = random.Random(4)
for _ in range(3000):
a, b, c = (Fraction(rng.randrange(-20, 21), rng.randrange(1, 5)) for _ in range(3))
x, y = rng.randrange(0, 30), rng.randrange(0, 30)
approx = float(a) + float(b) * x ** 0.5 + float(c) * y ** 0.5
s = sign_surd(a, b, x, c, y)
if abs(approx) > 1e-9:
assert s == (1 if approx > 0 else -1)
assert sign_surd(0, 1, 2, -1, 2) == 0
assert sign_surd(3, -1, 9) == 0
assert sign_surd(-5, 1, 2, 1, 8) == -1
assert sign_surd(Fraction(-3), 1, 2, 1, 2) == -1
assert sign_surd(Fraction(-3), 1, 3, 1, 3) == 1
History
Lehmann, O'Callaghan and Shoham presented the mechanism at the ACM Conference on Electronic Commerce in 1999, and the journal version appeared in 2002. They identified the conditions under which a greedy allocation with critical payments is truthful for single-minded bidders, and they proved the bound for the square root key. Their work was one of the first to combine a polynomial approximation algorithm with dominant-strategy incentives for a hard allocation problem.
References
- Daniel Lehmann, Liadan Ita O'Callaghan and Yoav Shoham, Truth revelation in approximately efficient combinatorial auctions, Journal of the ACM 49(5) (2002), 577-602, the greedy mechanism for single-minded bidders, the sufficient conditions for truthfulness (exactness and monotonicity with critical payments), and the sqrt(m) approximation bound
- Noam Nisan, Tim Roughgarden, Éva Tardos and Vijay V. Vazirani (eds.), Algorithmic Game Theory, Cambridge University Press, 2007, Chapter 11 (Blumrosen and Nisan, Combinatorial auctions), Section 11.2 (single-minded bidders)
About this page
The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.
| Ladder | Level | What the next level needs |
|---|---|---|
| Human proof | H1 sketch |
|
| Lean | L0 no Lean part |
|
| Code (python) | I0 not checked yet |
|
| Visual | V0 none |
|
| Writing | W2 basic |
|
Tag Z6TN8C Edit this page History Report an error Markdown