Algorithm Search⌘K

Algorithmintro

Vickrey-Clarke-Groves mechanism

Also called VCG mechanism.

Picks the outcome of maximum reported welfare and charges each agent the welfare loss it causes the others. Truth telling is a dominant strategy for any valuations.

Time
O(n k) worst
Space
O(k) extra
Where
k = the number of outcomes, with each valuation given as a table of k numbers; n = the number of agents
Properties
comparison baseddeterministiciterative
Origin
William Vickrey, Edward H. Clarke, Theodore Groves, 1973

The Vickrey-Clarke-Groves (VCG) mechanism is a direct revelation mechanism for agents with quasilinear utility. It asks each agent for its valuation of every outcome, chooses an outcome that maximizes the sum of the reported values, and charges each agent the loss of welfare that its presence causes to the other agents. Truth telling is a dominant strategy for every agent, for any set of outcomes and any valuations (DSIC), and the chosen outcome maximizes the true welfare. The Vickrey auction is the case of one item. VCG is the member of the Groves mechanisms with the Clarke pivot rule as payment.

In plain words

A group must make one choice, for example who gets which items or whether to build a bridge. Each person says how much each possible choice is worth to them in money. The mechanism takes the choice with the largest total worth. Then it asks of each person: how much better off would the others be if this person had stayed at home? The answer is what the person pays. A person who changes nothing for the others pays nothing. A person who pushes the choice away from what the others would have taken pays for the harm. With these prices, each person gains most by telling the truth. A false report can change the choice only to one with a smaller total worth, counted with the person's true worth, and the payment follows the others' loss exactly, so a lie never pays.

The problem

There are nn agents and a finite set OO of kk outcomes. Agent ii has a private valuation vi:O→Rv_i : O \to \mathbb{R}, and each valuation in RO\mathbb{R}^O is possible. The mechanism receives reports b1,…,bnb_1, \ldots, b_n, chooses an outcome x(b)∈Ox(b) \in O, and charges payments p1(b),…,pn(b)p_1(b), \ldots, p_n(b). The payment pip_i goes from agent ii to the mechanism, and a negative pip_i is a transfer to the agent. Agent ii has the quasilinear utility ui=vi(x(b))−pi(b)u_i = v_i(x(b)) - p_i(b). The goal is a mechanism that is DSIC and whose outcome maximizes the welfare ∑ivi(x)\sum_i v_i(x) when the agents tell the truth.

The algorithm

Write T(o)=∑jbj(o)T(o) = \sum_{j} b_j(o) for the reported welfare of outcome oo. Then T(o)−bi(o)T(o) - b_i(o) is the welfare of the agents other than ii.

  1. VCG(O, b_1, ..., b_n)
  2. 1for each o in O: T(o) ← b_1(o) + ... + b_n(o)
  3. 2x ← the first o in O with the largest T(o)
  4. 3for i ← 1 to n:
  5. 4W_-i ← max over o in O of (T(o) - b_i(o)) ▷ best welfare of the others if i were absent
  6. 5p_i ← W_-i - (T(x) - b_i(x)) ▷ minus the welfare the others get at x
  7. 6return x, (p_1, ..., p_n)

Line L4 is the best welfare the others could reach without agent ii, and line L5 subtracts the welfare they actually get. So pip_i is the externality of agent ii. In the form of a Groves mechanism, pi(b)=hi(b−i)−∑j≠ibj(x(b))p_i(b) = h_i(b_{-i}) - \sum_{j \ne i} b_j(x(b)) with hi(b−i)=W−ih_i(b_{-i}) = W_{-i}, and W−iW_{-i} does not depend on bib_i. Line L2 breaks ties by the fixed order of OO. Any rule that picks some welfare-maximizing outcome gives the same guarantees.

Example

Two items AA and BB and three bidders. Bidder 1 wants both items together and values {A,B}\{A, B\} at 10, and each single item at 0. Bidder 2 values AA at 6, and bidder 3 values BB at 7, and neither wants the other item. An outcome gives each item to one bidder or keeps it, so there are 42=164^2 = 16 outcomes. The best one gives AA to bidder 2 and BB to bidder 3, with welfare 13. Giving both items to bidder 1 has welfare 10.

agent ii W−iW_{-i} (best without ii) others' welfare at xx pip_i utility
1 13 (AA to 2, BB to 3) 13 0 0
2 10 (both to 1) 7 3 6 - 3 = 3
3 10 (both to 1) 6 4 7 - 4 = 3

Bidder 2 pays 3, the least bid for AA that still wins it against the threat of bidder 1: with a bid below 3 for AA, the pair of bidders 2 and 3 would bid less than 10 in total. The revenue is 7, less than the bid 10 of bidder 1. So bidder 1 and the seller would both prefer a deal at a price between 7 and 10: the VCG outcome is not in the core here.

With one item and values (10,7,3)(10, 7, 3), the outcomes are "bidder ii wins". Bidder 1 wins. Without bidder 1 the others reach 7, and at xx they get 0, so bidder 1 pays 7. The losers pay 0. This is the Vickrey auction.

Correctness

Three facts hold for every input, and the proof is in proofs/correctness.md.

  • Welfare. Line L2 returns an outcome with the largest reported welfare. When the agents tell the truth, it maximizes the true welfare.
  • Dominant strategies. For every agent ii, true valuation viv_i, report bib_i and reports b−ib_{-i} of the others, vi(x(vi,b−i))−pi(vi,b−i)≥vi(x(bi,b−i))−pi(bi,b−i)v_i(x(v_i, b_{-i})) - p_i(v_i, b_{-i}) \ge v_i(x(b_i, b_{-i})) - p_i(b_i, b_{-i}). The utility of agent ii equals the reported welfare of the chosen outcome, with viv_i in place of bib_i, minus W−iW_{-i}, which agent ii cannot change. The truthful report makes the mechanism maximize exactly this welfare.
  • Payments. pi≥0p_i \ge 0 for every input, because W−iW_{-i} is a maximum over all outcomes. If every valuation is nonnegative, then ui≥0u_i \ge 0 for a truthful agent (individual rationality).
Proof: Correctness of the VCG mechanismfull

Let OO be a finite nonempty set of outcomes, and let b1,…,bn:O→Rb_1, \ldots, b_n : O \to \mathbb{R} be the reports. Write T(o)=∑jbj(o)T(o) = \sum_j b_j(o) and, for each agent ii, T−i(o)=T(o)−bi(o)=∑j≠ibj(o)T_{-i}(o) = T(o) - b_i(o) = \sum_{j \ne i} b_j(o). The algorithm returns xx and p1,…,pnp_1, \ldots, p_n with pi=W−i−T−i(x)p_i = W_{-i} - T_{-i}(x), where W−i=max⁡o∈OT−i(o)W_{-i} = \max_{o \in O} T_{-i}(o). Agent ii with true valuation viv_i has utility ui=vi(x)−piu_i = v_i(x) - p_i.

Claim 1: lines L1 and L2 return an outcome of maximum reported welfare

Line L1 computes T(o)T(o) for every oo. Line L2 starts with the first outcome and replaces the current xx by oo only when T(o)>T(x)T(o) > T(x). After it has seen a prefix of the list, xx is the first outcome of the prefix with the largest TT, by induction on the length of the prefix. At the end, T(x)=max⁡o∈OT(o)T(x) = \max_{o \in O} T(o). If every report is true, TT is the true welfare, so xx maximizes the true welfare.

Claim 2: lines L4 and L5 compute the Clarke pivot payment

Line L4 computes max⁡o(T(o)−bi(o))=max⁡oT−i(o)=W−i\max_o (T(o) - b_i(o)) = \max_o T_{-i}(o) = W_{-i}, and line L5 sets pi=W−i−(T(x)−bi(x))=W−i−T−i(x)p_i = W_{-i} - (T(x) - b_i(x)) = W_{-i} - T_{-i}(x). This is the Groves payment hi(b−i)−T−i(x)h_i(b_{-i}) - T_{-i}(x) with hi(b−i)=W−ih_i(b_{-i}) = W_{-i}. The value W−iW_{-i} is a function of b−ib_{-i} only, since T−iT_{-i} does not contain bib_i.

Claim 3: truth telling is a dominant strategy

Fix an agent ii, its true valuation viv_i, and any reports b−ib_{-i} of the others. Let xx be the outcome when ii reports viv_i, and let yy be the outcome when ii reports any bib_i. The term W−iW_{-i} is the same in both cases, by Claim 2. So

ui(truth)=vi(x)+T−i(x)−W−i,ui(bi)=vi(y)+T−i(y)−W−i.u_i(\text{truth}) = v_i(x) + T_{-i}(x) - W_{-i}, \qquad u_i(b_i) = v_i(y) + T_{-i}(y) - W_{-i}.

When ii reports viv_i, the reported welfare is vi(o)+T−i(o)v_i(o) + T_{-i}(o), and by Claim 1, xx maximizes it over OO. In particular vi(x)+T−i(x)≥vi(y)+T−i(y)v_i(x) + T_{-i}(x) \ge v_i(y) + T_{-i}(y), so ui(truth)≥ui(bi)u_i(\text{truth}) \ge u_i(b_i). The argument does not use the tie rule of line L2, only that xx is some maximizer, and it uses no assumption on viv_i or on b−ib_{-i}.

Claim 4: no positive transfers, and individual rationality for nonnegative valuations

Since W−iW_{-i} is the maximum of T−iT_{-i} over all of OO, W−i≥T−i(x)W_{-i} \ge T_{-i}(x), so pi≥0p_i \ge 0 for every input. No agent receives money.

Now let every report be true and let every valuation be nonnegative. Let zz maximize T−iT_{-i}, so W−i=T−i(z)W_{-i} = T_{-i}(z). Then

ui=vi(x)+T−i(x)−T−i(z)=T(x)−T(z)+vi(z)≥vi(z)≥0,u_i = v_i(x) + T_{-i}(x) - T_{-i}(z) = T(x) - T(z) + v_i(z) \ge v_i(z) \ge 0,

because T(x)≥T(z)T(x) \ge T(z) by Claim 1 and vi(z)≥0v_i(z) \ge 0. So a truthful agent never ends with negative utility. The bound vi(z)≥0v_i(z) \ge 0 is the only place where nonnegativity is used. With vi(z)<0v_i(z) < 0 the utility can be negative: for O={0,1}O = \{0, 1\}, v1=(0,5)v_1 = (0, 5) and v2=(0,−2)v_2 = (0, -2), the mechanism picks 1, W−2=5=T−2(1)W_{-2} = 5 = T_{-2}(1), so p2=0p_2 = 0 and u2=−2u_2 = -2.

Claim 5: the mechanism is weakly budget balanced

By Claim 4, each pi≥0p_i \ge 0, so ∑ipi≥0\sum_i p_i \ge 0 and the mechanism never runs a deficit. It is not strongly budget balanced in general. With one item and values (10,7,3)(10, 7, 3), the payments are (7,0,0)(7, 0, 0) and their sum is 7, not 0. By the Green-Laffont theorem on budget balance, no choice of hih_i makes the sum 0 on every input when the valuations are unrestricted.

Running time

Line L1 does nn additions for each of the kk outcomes. Line L2 does kk comparisons. For each of the nn agents, line L4 takes kk subtractions and a maximum over kk values, and line L5 takes constant time. The total is O(nk)O(nk) arithmetic operations and the table TT needs O(k)O(k) extra space.

Complexity

With each valuation given as a table of kk numbers, the input has nkn k numbers. Line L1 takes O(nk)O(nk) additions, line L2 takes O(k)O(k) comparisons, and each pass of lines L4 and L5 takes O(k)O(k). The total time is O(nk)O(nk), linear in the input, and the extra space is O(k)O(k) for the table TT. This assumes word-ram arithmetic on numbers of bounded size; the implementation uses exact fractions.

In most uses OO is not a list. It is a set of allocations of mm items, of paths in a graph or of schedules, and it has exponential size. Then VCG needs one welfare maximization for xx and one more for each W−iW_{-i}, so n+1n + 1 calls to an exact optimizer in total. For a combinatorial auction the optimization is the winner determination problem, which is NP-hard. VCG with an approximate optimizer is not truthful in general (Nisan and Ronen 2007). The ways around this are maximal-in-range mechanisms, which optimize exactly over a smaller range, and the single-parameter methods of Myerson's lemma.

Properties

  • DSIC and efficient. Truth telling is a dominant strategy, and the outcome maximizes welfare. This holds with no prior on the valuations.
  • No positive transfers. No agent is ever paid: pi≥0p_i \ge 0.
  • Ex post individually rational for nonnegative valuations. It can fail when an agent has a negative value for some outcome. With outcomes "no" and "yes" for a project, agent 1 values "yes" at 5 and agent 2 values it at −2-2. VCG builds, agent 2 pays 0 and ends at utility −2-2.
  • Weakly budget balanced, not budget balanced. The payments sum to at least 0, but in general not to 0, and the surplus cannot be returned without loss of DSIC or efficiency (budget balance, Green-Laffont theorem).
  • Payments depend on others only through W−iW_{-i} and the outcome. Agent ii influences its payment only through the choice of xx.

Variants and improvements

  • Groves mechanisms. Replace W−iW_{-i} by any function hi(b−i)h_i(b_{-i}). Every choice is DSIC and efficient. On the unrestricted domain these are the only DSIC efficient mechanisms (Groves mechanisms).
  • Weighted VCG and affine maximizers. Maximize ∑iwibi(o)+co\sum_i w_i b_i(o) + c_o with fixed weights wi>0w_i > 0 and constants coc_o, with the matching payments (affine maximizer). Roberts' theorem says that on unrestricted domains with at least 3 outcomes these are the only truthful mechanisms onto their range (Roberts' theorem).
  • Reverse auctions and procurement. The agents have costs, so their values are negative or zero. For a path in a graph whose edges are owned by agents, VCG picks the shortest path and pays each edge on it the length of the shortest path without that edge minus the length of the chosen path without that edge (Nisan, Section 9.3.5).
  • Public projects. Add the planner as one more agent with the value −C-C for building. The payments of the citizens then do not cover CC in general: with values 150, 120 and 60 and C=300C = 300, the project is built and the citizens pay 120, 90 and 30, in total 240.
  • Redistribution. Rebates that depend only on the others' reports return part of the surplus and keep DSIC (Groves mechanisms gives an example).

When to use it

Use VCG when the goal is welfare, the agents' values are private and can take any form, and an exact optimizer for the outcome is affordable. It needs no prior and no assumption on the valuations. It is a poor choice when revenue matters (use Myerson's optimal auction in single-parameter settings), when the budget must balance (use the AGV mechanism, which is only Bayesian incentive compatible), or when the optimization is too hard to solve exactly.

Pitfalls

  • An approximate optimizer. Lines L2 and L4 must solve the optimization exactly. With a heuristic, an agent can gain by a lie that steers the heuristic to a better outcome for it.
  • Low or zero revenue. With complements, revenue can be 0. Let bidder 1 value {A,B}\{A, B\} at 2, bidder 2 value AA at 2 and bidder 3 value BB at 2. VCG gives AA to bidder 2 and BB to bidder 3, and both pay 2−2=02 - 2 = 0. Adding bidders 2 and 3 lowered the revenue from 2 to 0, so revenue is not monotone in the set of bidders.
  • Collusion of losers. In the same auction, let the true values of bidders 2 and 3 be 1/21/2 each. Truthful bids give both items to bidder 1 at price 1. If bidders 2 and 3 both bid 2, they win, pay 0, and each gains 1/21/2. DSIC is about one agent at a time, not about groups.
  • False-name bids. A bidder can gain by bidding under several names in a combinatorial auction (Yokoo, Sakurai and Matsubara 2004); in the example above one bidder with two names plays the part of bidders 2 and 3.
  • Negative values and IR. The Clarke pivot rule gives IR only when all valuations are nonnegative.
  • Ties. A truthful agent can be indifferent between reports. The guarantees hold for any fixed tie rule, but a test of DSIC must compare utilities with ≥\ge, not >>, and must use exact arithmetic.

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.

vcg_mechanism.pyI0RawGitHub
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/vcg-mechanism/. The authors are listed in prov/SH7M6B.jsonl.

"""The Vickrey-Clarke-Groves mechanism with Clarke pivot payments.

The outcome set is a finite list. A valuation is a dict from outcome to a number (int or
Fraction). The mechanism takes the reported valuations, picks an outcome of maximum
reported welfare (the first one in the list on ties), and charges each agent the loss of
welfare that its presence causes to the others. A positive payment is paid by the agent.
"""

from fractions import Fraction
from itertools import product
from typing import Callable, Hashable, Sequence

Outcome = Hashable
Valuation = dict


def welfare(valuations: Sequence[Valuation], o: Outcome, skip: int | None = None) -> Fraction:
    """Return the sum of v_j(o) over the agents j other than skip."""
    return sum((Fraction(v[o]) for j, v in enumerate(valuations) if j != skip), Fraction(0))


def best_outcome(outcomes: Sequence[Outcome], valuations: Sequence[Valuation], skip: int | None = None):
    """Return (o, w): the first outcome of maximum welfare of the agents other than skip, and that welfare."""
    best, best_w = None, None
    for o in outcomes:
        w = welfare(valuations, o, skip)
        if best_w is None or w > best_w:
            best, best_w = o, w
    return best, best_w


def vcg(outcomes: Sequence[Outcome], valuations: Sequence[Valuation]):
    """Run VCG with the Clarke pivot rule. Return (x, payments), payments as Fractions."""
    if not outcomes:
        raise ValueError("the outcome set is empty")
    total = {o: welfare(valuations, o) for o in outcomes}  # @line L1
    x = outcomes[0]
    for o in outcomes:  # @line L2
        if total[o] > total[x]:
            x = o
    payments = []
    for i, v in enumerate(valuations):  # @line L3
        w_without = max(total[o] - Fraction(v[o]) for o in outcomes)  # @line L4
        payments.append(w_without - (total[x] - Fraction(v[x])))  # @line L5
    return x, payments  # @line L6


def groves(outcomes: Sequence[Outcome], valuations: Sequence[Valuation], h: Sequence[Callable]):
    """Run a Groves mechanism: the VCG outcome, and p_i = h_i(v_-i) - sum over j != i of v_j(x).

    h[i] is called with the list of the reports of the other agents (agent i removed), so it
    cannot depend on the report of agent i. With h_i(v_-i) = max over o of the welfare of the
    others, this is vcg().
    """
    x, _ = best_outcome(outcomes, valuations)
    payments = []
    for i in range(len(valuations)):
        others = [v for j, v in enumerate(valuations) if j != i]
        payments.append(Fraction(h[i](others)) - welfare(valuations, x, skip=i))
    return x, payments


def utility(v: Valuation, x: Outcome, p) -> Fraction:
    """The quasilinear utility v(x) - p."""
    return Fraction(v[x]) - Fraction(p)


# Combinatorial auctions: m items 0..m-1 and n bidders 0..n-1. An allocation is a tuple a of
# length m, where a[j] is the bidder that gets item j, or -1 if item j stays unsold.


def allocations(n: int, m: int) -> list[tuple]:
    """All (n + 1)^m allocations of m items to n bidders, the empty allocation first."""
    return list(product(range(-1, n), repeat=m))


def bundle(a: tuple, i: int) -> frozenset:
    """The set of items that allocation a gives to bidder i."""
    return frozenset(j for j, b in enumerate(a) if b == i)


def xor_value(bids: dict, s: frozenset) -> Fraction:
    """The value of bundle s for XOR bids {bundle: value}: the best bid inside s, or 0."""
    return max((Fraction(w) for t, w in bids.items() if t <= s), default=Fraction(0))


def auction_valuations(xor_bids: Sequence[dict], m: int) -> tuple[list, list]:
    """Turn XOR bids of n bidders on m items into (outcomes, valuations) for vcg()."""
    n = len(xor_bids)
    outs = allocations(n, m)
    vals = [{a: xor_value(b, bundle(a, i)) for a in outs} for i, b in enumerate(xor_bids)]
    return outs, vals


def single_item(values: Sequence) -> tuple[list, list]:
    """One item and n bidders. Outcome i means that bidder i wins."""
    n = len(values)
    outs = list(range(n))
    vals = [{o: (Fraction(values[i]) if o == i else Fraction(0)) for o in outs} for i in range(n)]
    return outs, vals
test_vcg_mechanism.py 264 lines
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/vcg-mechanism/. The authors are listed in prov/SH7M6B.jsonl.

import random
from fractions import Fraction
from itertools import combinations, product

from vcg_mechanism import (
    auction_valuations,
    best_outcome,
    bundle,
    groves,
    single_item,
    utility,
    vcg,
    welfare,
    xor_value,
)

F = Fraction


def random_valuations(rng, outcomes, n, lo, hi):
    return [{o: F(rng.randint(lo, hi)) for o in outcomes} for _ in range(n)]


def opt_by_dp(xor_bids, m, skip=None):
    """Best welfare of a combinatorial auction by a dynamic program over sets of items."""
    agents = [b for i, b in enumerate(xor_bids) if i != skip]
    items = frozenset(range(m))
    memo = {}

    def best(k, rest):
        if k == len(agents):
            return F(0)
        key = (k, rest)
        if key not in memo:
            r = sorted(rest)
            val = F(-1)
            for size in range(len(r) + 1):
                for t in combinations(r, size):
                    t = frozenset(t)
                    val = max(val, xor_value(agents[k], t) + best(k + 1, rest - t))
            memo[key] = val
        return memo[key]

    return best(0, items)


def random_xor_bids(rng, m, k, hi):
    bids = {}
    for _ in range(k):
        s = frozenset(j for j in range(m) if rng.random() < 0.6)
        if s:
            bids[s] = F(rng.randint(0, hi))
    return bids


def check_dsic(outcomes, type_sets, mech):
    """Every agent, every true type, every report of the others, every misreport: truth is best."""
    n = len(type_sets)
    for prof in product(*[range(len(t)) for t in type_sets]):
        truth = [type_sets[i][prof[i]] for i in range(n)]
        x, p = mech(outcomes, truth)
        for i in range(n):
            u_true = utility(truth[i], x, p[i])
            for lie in type_sets[i]:
                rep = truth[:i] + [lie] + truth[i + 1:]
                y, q = mech(outcomes, rep)
                if utility(truth[i], y, q[i]) > u_true:
                    return (i, prof, lie)
    return None


def test_vickrey_check_value():
    outs, vals = single_item([10, 7, 3])
    x, p = vcg(outs, vals)
    assert x == 0
    assert p == [7, 0, 0]


def test_single_item_is_second_price():
    rng = random.Random(1)
    for _ in range(300):
        n = rng.randint(1, 6)
        values = [rng.randint(0, 9) for _ in range(n)]
        x, p = vcg(*single_item(values))
        top = max(values)
        assert x == values.index(top)
        others = values[:x] + values[x + 1:]
        assert p[x] == (max(others) if others else 0)
        assert all(p[i] == 0 for i in range(n) if i != x)


def test_multi_unit_unit_demand_pays_the_next_bid():
    rng = random.Random(2)
    for _ in range(100):
        n = rng.randint(2, 5)
        k = rng.randint(1, n - 1)
        values = [rng.randint(0, 20) for _ in range(n)]
        outs = list(combinations(range(n), k))
        vals = [{s: F(values[i]) if i in s else F(0) for s in outs} for i in range(n)]
        x, p = vcg(outs, vals)
        price = sorted(values, reverse=True)[k]
        for i in range(n):
            assert p[i] == (price if i in x else 0)


def test_outcome_and_payments_match_a_second_method():
    rng = random.Random(3)
    for _ in range(60):
        n, m = rng.randint(1, 3), rng.randint(1, 3)
        bids = [random_xor_bids(rng, m, rng.randint(1, 3), 12) for _ in range(n)]
        outs, vals = auction_valuations(bids, m)
        x, p = vcg(outs, vals)
        opt = opt_by_dp(bids, m)
        assert welfare(vals, x) == opt
        for i in range(n):
            vi = xor_value(bids[i], bundle(x, i))
            # externality form: the best welfare of the others without i, minus what they get now
            assert p[i] == opt_by_dp(bids, m, skip=i) - (opt - vi)
            # the price is at most the value of i for its bundle (IR) and at least 0
            assert 0 <= p[i] <= vi


def test_dsic_on_general_outcome_sets_with_negative_values():
    rng = random.Random(4)
    for _ in range(8):
        outs = list(range(rng.randint(2, 4)))
        n = 3
        type_sets = [random_valuations(rng, outs, 3, -3, 3) for _ in range(n)]
        # add a type with a tie between two outcomes
        for t in type_sets:
            t.append({o: F(1) if o < 2 else F(0) for o in outs})
        assert check_dsic(outs, type_sets, vcg) is None


def test_dsic_in_a_combinatorial_auction():
    rng = random.Random(5)
    m = 2
    type_sets = []
    for _ in range(3):
        ts = [random_xor_bids(rng, m, 2, 6) for _ in range(3)]
        ts.append({frozenset([0, 1]): F(4)})
        type_sets.append(ts)
    outs, _ = auction_valuations([{} for _ in range(3)], m)

    def mech(outcomes, bids):
        _, vals = auction_valuations(bids, m)
        return vcg(outcomes, vals)

    def util(bids_i, x, p, i):
        return xor_value(bids_i, bundle(x, i)) - p[i]

    for prof in product(range(4), repeat=3):
        truth = [type_sets[i][prof[i]] for i in range(3)]
        x, p = mech(outs, truth)
        for i in range(3):
            for lie in type_sets[i]:
                y, q = mech(outs, truth[:i] + [lie] + truth[i + 1:])
                assert util(truth[i], y, q, i) <= util(truth[i], x, p, i)


def test_every_groves_mechanism_is_dsic():
    rng = random.Random(6)
    outs = [0, 1, 2]
    type_sets = [random_valuations(rng, outs, 3, -2, 4) for _ in range(3)]
    for c in range(3):
        h = [lambda others, c=c: c * sum(v[0] for v in others) + 5 for _ in range(3)]
        assert check_dsic(outs, type_sets, lambda o, v: groves(o, v, h)) is None
    zero = [lambda others: 0 for _ in range(3)]
    assert check_dsic(outs, type_sets, lambda o, v: groves(o, v, zero)) is None


def test_the_checker_finds_a_profitable_lie():
    # the same outcome with pay-your-bid payments is not DSIC, and the checker must see it
    def pay_your_bid(outcomes, vals):
        x, _ = best_outcome(outcomes, vals)
        return x, [vals[i][x] for i in range(len(vals))]

    outs = [0, 1]
    type_sets = [[{0: F(v), 1: F(0)} for v in (0, 2, 5)], [{0: F(0), 1: F(v)} for v in (0, 2, 5)]]
    assert check_dsic(outs, type_sets, pay_your_bid) is not None
    assert check_dsic(outs, type_sets, vcg) is None


def test_clarke_is_groves_with_the_pivot_term():
    rng = random.Random(7)
    outs = list(range(4))
    pivot = [lambda others: best_outcome(outs, others)[1] for _ in range(3)]
    for _ in range(200):
        vals = random_valuations(rng, outs, 3, -5, 5)
        assert vcg(outs, vals) == groves(outs, vals, pivot)


def test_ir_and_no_positive_transfers_for_nonnegative_values():
    rng = random.Random(8)
    for _ in range(300):
        outs = list(range(rng.randint(1, 5)))
        n = rng.randint(1, 4)
        vals = random_valuations(rng, outs, n, 0, 9)
        x, p = vcg(outs, vals)
        for i in range(n):
            assert p[i] >= 0
            assert utility(vals[i], x, p[i]) >= 0


def test_ir_can_fail_with_a_negative_value():
    # outcome 1 builds a project; agent 1 is hurt by it
    outs = [0, 1]
    vals = [{0: F(0), 1: F(5)}, {0: F(0), 1: F(-2)}]
    x, p = vcg(outs, vals)
    assert x == 1 and p == [2, 0]
    assert utility(vals[1], x, p[1]) == -2


def test_public_project_does_not_cover_its_cost():
    # citizens with values for a bridge of cost 300, and the government as one more agent
    c = F(300)
    values = [F(150), F(120), F(60)]
    outs = [0, 1]
    vals = [{0: F(0), 1: v} for v in values] + [{0: F(0), 1: -c}]
    x, p = vcg(outs, vals)
    assert x == 1
    assert p[:3] == [120, 90, 30]
    assert p[3] == 0  # the government has a single type and is never pivotal for itself here
    assert sum(p[:3]) == 240 < c
    for i, v in enumerate(values):
        rest = sum(values) - v
        assert p[i] == (c - rest if rest < c else 0)


def test_zero_revenue_and_collusion_with_complements():
    ab, a, b = frozenset([0, 1]), frozenset([0]), frozenset([1])
    outs, vals = auction_valuations([{ab: 2}, {a: 2}, {b: 2}], 2)
    x, p = vcg(outs, vals)
    assert x == (1, 2) and p == [0, 0, 0]
    # true values 1/2 for the two small bidders: the big bidder wins and pays 1
    outs, vals = auction_valuations([{ab: 2}, {a: F(1, 2)}, {b: F(1, 2)}], 2)
    x, p = vcg(outs, vals)
    assert x == (0, 0) and p == [1, 0, 0]
    # both small bidders overbid 2: they win, pay 0, and each gains 1/2
    _, lie = auction_valuations([{ab: 2}, {a: 2}, {b: 2}], 2)
    y, q = vcg(outs, lie)
    assert y == (1, 2) and q == [0, 0, 0]
    assert utility(vals[1], y, q[1]) == F(1, 2) and utility(vals[2], y, q[2]) == F(1, 2)


def test_no_groves_mechanism_is_budget_balanced():
    # binary project, values in {-1/2, 1/2}: the alternating sum of the total payment over
    # the four profiles does not depend on h and is never 0, so the total cannot be 0 always
    rng = random.Random(9)
    outs = [0, 1]
    pts = [F(-1, 2), F(1, 2)]
    for _ in range(50):
        table = [{t: F(rng.randint(-9, 9)) for t in pts} for _ in range(2)]
        h = [lambda others, i=i: table[i][others[0][1]] for i in range(2)]
        alt = F(0)
        for t1, t2 in product(pts, repeat=2):
            vals = [{0: F(0), 1: t1}, {0: F(0), 1: t2}]
            _, p = groves(outs, vals, h)
            sign = 1 if (t1 == t2) else -1
            alt += sign * sum(p)
        assert alt == -1

History

Vickrey (1961) studied the sealed-bid auction in which the highest bidder pays the second-highest bid, and showed that bidding the true value is dominant. Clarke (1971) proposed, for a public project, to charge each citizen only when its report changes the decision, by the amount of the change for the others. Groves (1973) gave the general scheme for a team: pay each member the reported value of the others, plus any term that does not depend on its own report. The name "VCG" for the combination with the pivot term became standard in the computer science literature, where Nisan and Ronen began the study of its computational side.

References

  1. William Vickrey, Counterspeculation, auctions, and competitive sealed tenders, Journal of Finance 16(1) (1961), 8-37, the second-price sealed-bid auction and the proof that bidding the true value is a dominant strategy
  2. Edward H. Clarke, Multipart pricing of public goods, Public Choice 11 (1971), 17-33, the pivot payment for a public project, which charges an agent only when its report changes the decision
  3. Theodore Groves, Incentives in teams, Econometrica 41(4) (1973), 617-631, the general payment scheme that makes truth telling dominant for any welfare-maximizing decision
  4. Noam Nisan, Tim Roughgarden, Eva Tardos and Vijay V. Vazirani (eds.), Algorithmic Game Theory, Cambridge University Press, 2007, Chapter 9, Noam Nisan, Introduction to mechanism design (for computer scientists), Sections 9.3.3 to 9.3.5 (VCG mechanisms, the Clarke pivot rule with its individual rationality and no positive transfers, and the examples)
  5. Tim Roughgarden, Twenty Lectures on Algorithmic Game Theory, Cambridge University Press, 2016, Lecture 7 (multi-parameter mechanism design, the VCG mechanism and its practical problems)
  6. Yoav Shoham and Kevin Leyton-Brown, Multiagent Systems, Algorithmic, Game-Theoretic, and Logical Foundations, Cambridge University Press, 2009, Sections 10.4.1 to 10.4.4 (Groves mechanisms, the VCG mechanism, VCG and individual rationality, VCG and weak budget balance)
  7. Lawrence M. Ausubel and Paul Milgrom, The lovely but lonely Vickrey auction, in Peter Cramton, Yoav Shoham and Richard Steinberg (eds.), Combinatorial Auctions, MIT Press, 2006, Chapter 1, 17-40, low or zero revenue with complements, outcomes outside the core, collusion of losing bidders and shill bids
  8. Noam Nisan and Amir Ronen, Computationally feasible VCG mechanisms, Journal of Artificial Intelligence Research 29 (2007), 19-47, VCG payments with an approximate welfare optimizer are not truthful in general

Where this leads

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.

LadderLevelWhat the next level needs
Human proofH1 sketch
  • a full proof of time.worst
  • a full proof of space.extra
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
Code (python)I0 not checked yet
  • the tests did not run in this build
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW2 basic
  • a scene preset for the example