Algorithm Search⌘K

Definitionadvanced

Affine maximizer

Also called weighted VCG mechanism.

A mechanism that maximizes a weighted sum of reported values, with positive weights per agent, plus a constant per outcome over a fixed range. Weighted VCG payments make it DSIC.

An affine maximizer chooses, from a fixed range of outcomes, one that maximizes a weighted sum of the agents' reported values plus a fixed bonus for each outcome. The weights are positive and the bonuses do not depend on the reports, so payments in the style of VCG make it DSIC. VCG itself is the affine maximizer with all weights 1, no bonuses and the full range, and a maximal-in-range mechanism is the case with weights 1 and a restricted range. Roberts' theorem says that on the unrestricted domain with at least three outcomes in the range, affine maximizers are the only deterministic DSIC rules.

Definition

Let OO be a finite set of outcomes and let there be nn agents with quasilinear utilities, each reporting a valuation bi:O→Rb_i : O \to \mathbb{R}. Fix

  • a nonempty range R⊆OR \subseteq O,
  • a weight wi>0w_i > 0 for each agent ii,
  • a constant c(o)∈Rc(o) \in \mathbb{R} for each o∈Ro \in R.

The affine maximizer with these parameters picks

x(b)∈arg⁡max⁡o∈R(∑i=1nwi bi(o)+c(o)),x(b) \in \arg\max_{o \in R} \Bigl( \sum_{i=1}^{n} w_i \, b_i(o) + c(o) \Bigr),

with a fixed tie-breaking order on RR. Its payments are

pi(b)=hi(b−i)−1wi(∑j≠iwj bj(x(b))+c(x(b))),p_i(b) = h_i(b_{-i}) - \frac{1}{w_i} \Bigl( \sum_{j \ne i} w_j \, b_j(x(b)) + c(x(b)) \Bigr),

where hih_i is any function that does not depend on bib_i. The Clarke-style choice is hi(b−i)=1wimax⁡o∈R(∑j≠iwjbj(o)+c(o))h_i(b_{-i}) = \frac{1}{w_i} \max_{o \in R} \bigl( \sum_{j \ne i} w_j b_j(o) + c(o) \bigr), the best score that the others and the constants can reach alone.

Why it is DSIC. An agent with true valuation viv_i who reports bib_i gets the utility

vi(x(b))−pi(b)=1wi(wi vi(x(b))+∑j≠iwj bj(x(b))+c(x(b)))−hi(b−i).v_i(x(b)) - p_i(b) = \frac{1}{w_i} \Bigl( w_i \, v_i(x(b)) + \sum_{j \ne i} w_j \, b_j(x(b)) + c(x(b)) \Bigr) - h_i(b_{-i}).

The term hi(b−i)h_i(b_{-i}) does not depend on the report, and wi>0w_i > 0. The bracket is the objective of the mechanism evaluated with viv_i in place of bib_i, at the outcome x(b)x(b). The truthful report makes xx maximize exactly this bracket over RR, so no report does better.

With the Clarke-style hih_i and nonnegative valuations, every payment is nonnegative and every truthful agent has utility at least 0. The utility of agent ii is 1wi\frac{1}{w_i} times the best total score minus the best score without ii, which is at least 0.

The procedure, with the Clarke-style payments:

  1. AFFINE-MAXIMIZER(R, w, c, b_1, ..., b_n)
  2. 1for each o in R: S(o) ← c(o) + w_1 b_1(o) + ... + w_n b_n(o)
  3. 2x ← the first o in R with the largest S(o)
  4. 3for i ← 1 to n:
  5. 4H_i ← max over o in R of (S(o) - w_i b_i(o)) ▷ best score without agent i
  6. 5p_i ← (H_i - (S(x) - w_i b_i(x))) / w_i
  7. 6return x, (p_1, ..., p_n)

With the valuations given as tables over RR, the procedure takes O(n ∣R∣)O(n \, |R|) arithmetic operations. Roberts' theorem allows some weights to be 0, as long as not all are. An agent with weight 0 has no influence on the outcome, and its payment must then be a function hi(b−i)h_i(b_{-i}) alone.

Examples and non-examples

A small example. One item, two bidders with values 1010 and 77, weights w=(1,2)w = (1, 2), no constants. The outcomes are "bidder 1 wins", "bidder 2 wins" and "nobody wins". The scores are 1010, 1414 and 00, so bidder 2 wins. Its payment is 12(10−0)=5\frac{1}{2}(10 - 0) = 5. Check: bidder 2 wins exactly when 2b2>102 b_2 > 10, so its threshold bid is 55, which is the payment that Myerson's lemma gives. Bidder 2 has utility 7−5=27 - 5 = 2, and bidder 1 pays nothing.

More affine maximizers:

  • VCG. All wi=1w_i = 1, all c(o)=0c(o) = 0, R=OR = O.
  • Vickrey auction with an anonymous reserve. One item, outcomes "bidder ii wins" for each ii and "nobody", with c(nobody)=rc(\text{nobody}) = r and c=0c = 0 otherwise, and all weights 1. The item goes to the highest bidder if its bid is at least rr, and the winner pays max⁡(second-highest bid,r)\max(\text{second-highest bid}, r). See reserve price.
  • Bidder-specific reserves, in affine form. With c(bidder i wins)=−ric(\text{bidder } i \text{ wins}) = -r_i and c(nobody)=0c(\text{nobody}) = 0, the item goes to the bidder with the largest bi−rib_i - r_i, if that is positive. This is not the same rule as "highest bidder among those above their own reserve". With reserves r=(0,5)r = (0, 5) and bids (6,10)(6, 10), the affine scores are 6−0=66 - 0 = 6 and 10−5=510 - 5 = 5, so bidder 1 wins. The other rule gives the item to bidder 2, the highest bidder, since both bids are above their reserves.
  • Maximal-in-range mechanisms. Weights 1, constants 0, and a range RR that is smaller than OO so that the maximization is fast. See maximal-in-range mechanism.
  • Weighted welfare. Weights that express the priority of agents, for example in a public decision where some agents represent more people.

Non-examples:

  • The optimal auction for different value distributions. Myerson's optimal auction with bidders of different distributions gives the item to the bidder with the largest virtual value, which is not an affine function of the bids. It is DSIC because the domain is single-parameter, which is far from unrestricted, so Roberts' theorem does not apply to it.
  • The greedy knapsack rule. The rule on the page monotone allocation rule is DSIC in its single-parameter domain, but it does not maximize any fixed affine function over a fixed range.
  • Makespan minimization. A scheduling rule that minimizes the largest load is a min-max rule, not the maximization of a weighted sum. This is why VCG, the natural affine maximizer for scheduling, only gets ratio nn; see truthful scheduling on unrelated machines.
  • Weights that depend on the bids. If wiw_i changes with bib_i, the argument above fails, and the rule is not DSIC in general.
  • Groves mechanisms. The payments of an affine maximizer are the Groves payments for the weighted objective, divided by wiw_i. With weights 1 and constants 0, they are exactly the Groves payments.
  • Roberts' theorem. On the unrestricted domain with a range of at least three outcomes, every deterministic DSIC rule is an affine maximizer, with weights wi≥0w_i \ge 0 not all 0.
  • Green-Laffont theorem. For the efficient rule, the payments are fixed up to hih_i. Roberts' theorem fixes the rule, and Green-Laffont fixes the payments.
  • Maximal-in-range mechanism. The special case used to build truthful approximation mechanisms. Maximal-in-distributional-range mechanisms are the randomized version, which is truthful in expectation.
  • Cycle monotonicity. Affine maximizers satisfy it, as every DSIC rule must.

Code

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.

affine_maximizer.pyI0RawGitHub
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/affine-maximizer/. The authors are listed in prov/P44K0N.jsonl.

"""An affine maximizer with Clarke-style payments.

The range is a finite list of outcomes. A bid is a dict from outcome to a number (int or
Fraction). The mechanism picks the first outcome of the range with the largest affine score
c(o) + w_1 b_1(o) + ... + w_n b_n(o), and charges agent i the amount
(H_i - (S(x) - w_i b_i(x))) / w_i, where H_i is the best score of the others alone.
A positive payment is paid by the agent. All arithmetic is exact.
"""

from fractions import Fraction
from typing import Hashable, Mapping, Sequence

Outcome = Hashable


def affine_score(o: Outcome, bids: Sequence[Mapping], weights: Sequence, constants: Mapping, skip: int | None = None) -> Fraction:
    """Return c(o) plus the sum of w_j b_j(o) over the agents j other than skip."""
    s = Fraction(constants.get(o, 0))
    for j, (w, b) in enumerate(zip(weights, bids)):
        if j != skip:
            s += Fraction(w) * Fraction(b[o])
    return s


def affine_maximizer(outcomes: Sequence[Outcome], bids: Sequence[Mapping], weights: Sequence, constants: Mapping | None = None):
    """Run the affine maximizer with positive weights. Return (x, payments)."""
    if not outcomes:
        raise ValueError("the range must not be empty")
    if len(weights) != len(bids) or any(Fraction(w) <= 0 for w in weights):
        raise ValueError("need one positive weight per agent")
    constants = constants or {}
    score = {o: affine_score(o, bids, weights, constants) for o in outcomes}  # @line L1
    x = outcomes[0]
    for o in outcomes:  # @line L2
        if score[o] > score[x]:
            x = o
    payments = []
    for i, (w, b) in enumerate(zip(weights, bids)):  # @line L3
        h_i = max(score[o] - Fraction(w) * Fraction(b[o]) for o in outcomes)  # @line L4
        payments.append((h_i - (score[x] - Fraction(w) * Fraction(b[x]))) / Fraction(w))  # @line L5
    return x, payments  # @line L6


def utility(value: Mapping, x: Outcome, payment) -> Fraction:
    """Quasilinear utility of an agent with valuation value for outcome x and payment."""
    return Fraction(value[x]) - Fraction(payment)
test_affine_maximizer.py 117 lines
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/affine-maximizer/. The authors are listed in prov/P44K0N.jsonl.

import random
from fractions import Fraction
from itertools import product

from affine_maximizer import affine_maximizer, utility

F = Fraction


def single_item(values, nobody="none"):
    """Bids for one item: outcome k means bidder k wins."""
    n = len(values)
    outcomes = list(range(n)) + [nobody]
    bids = [{o: (F(values[k]) if o == k else F(0)) for o in outcomes} for k in range(n)]
    return outcomes, bids


def test_weighted_example():
    outcomes, bids = single_item([10, 7])
    x, p = affine_maximizer(outcomes, bids, [1, 2])
    assert x == 1
    assert p == [F(0), F(5)]


def test_vickrey_with_reserve():
    rng = random.Random(1)
    for _ in range(200):
        n = rng.randint(1, 4)
        values = [rng.randint(0, 20) for _ in range(n)]
        r = rng.randint(0, 20)
        outcomes, bids = single_item(values)
        x, p = affine_maximizer(outcomes, bids, [1] * n, {"none": r})
        top = max(values)
        if top >= r:
            w = values.index(top)
            assert x == w
            second = max([v for k, v in enumerate(values) if k != w], default=0)
            assert p[w] == max(second, r)
            assert all(p[k] == 0 for k in range(n) if k != w)
        else:
            assert x == "none"
            assert p == [0] * n


def test_unit_weights_give_clarke_payments():
    rng = random.Random(2)
    outcomes = ["a", "b", "c", "d"]
    for _ in range(100):
        n = rng.randint(1, 4)
        bids = [{o: F(rng.randint(0, 9)) for o in outcomes} for _ in range(n)]
        x, p = affine_maximizer(outcomes, bids, [1] * n)
        total = {o: sum(b[o] for b in bids) for o in outcomes}
        assert total[x] == max(total.values())
        for i in range(n):
            others_best = max(total[o] - bids[i][o] for o in outcomes)
            assert p[i] == others_best - (total[x] - bids[i][x])


def test_dsic_by_brute_force():
    rng = random.Random(3)
    outcomes = ["a", "b", "c"]
    grid = [dict(zip(outcomes, t)) for t in product([0, 1, 2], repeat=3)]
    for _ in range(25):
        n = rng.randint(2, 3)
        k = rng.randint(1, 3)
        rng_range = rng.sample(outcomes, k)
        weights = [F(rng.randint(1, 3), rng.randint(1, 2)) for _ in range(n)]
        constants = {o: F(rng.randint(-2, 2)) for o in outcomes}
        others = [rng.choice(grid) for _ in range(n)]
        for i in range(n):
            results = []
            for report in grid:
                bids = list(others)
                bids[i] = report
                x, p = affine_maximizer(rng_range, bids, weights, constants)
                results.append((x, p[i]))
            for t_index, true in enumerate(grid):
                honest = utility(true, *results[t_index])
                for x, pay in results:
                    assert honest >= utility(true, x, pay)


def test_individual_rationality_and_nonnegative_payments():
    rng = random.Random(4)
    outcomes = ["a", "b", "c", "d"]
    for _ in range(200):
        n = rng.randint(1, 4)
        k = rng.randint(1, 4)
        rng_range = rng.sample(outcomes, k)
        bids = [{o: F(rng.randint(0, 9)) for o in outcomes} for _ in range(n)]
        weights = [F(rng.randint(1, 4)) for _ in range(n)]
        constants = {o: F(rng.randint(-5, 5)) for o in outcomes}
        x, p = affine_maximizer(rng_range, bids, weights, constants)
        assert x in rng_range
        for i in range(n):
            assert p[i] >= 0
            assert utility(bids[i], x, p[i]) >= 0


def test_rejects_bad_input():
    outcomes, bids = single_item([3, 4])
    for weights in ([1, 0], [1, -1], [1]):
        try:
            affine_maximizer(outcomes, bids, weights)
        except ValueError:
            pass
        else:
            raise AssertionError("expected ValueError")
    try:
        affine_maximizer([], bids, [1, 1])
    except ValueError:
        pass
    else:
        raise AssertionError("expected ValueError")

References

  1. Kevin Roberts, The characterization of implementable choice rules, in Jean-Jacques Laffont (ed.), Aggregation and Revelation of Preferences, North-Holland, 1979, 321-348, affine maximizers as the only dominant-strategy implementable rules on unrestricted domains with at least three outcomes
  2. Ron Lavi, Ahuva Mu'alem and Noam Nisan, Two simplified proofs for Roberts' theorem, Social Choice and Welfare 32(3) (2009), 407-423, the definition of affine maximizers and their weighted VCG payments
  3. 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), the part on affine maximizers and Roberts' theorem; Chapter 12, Ron Lavi, Computationally efficient approximation mechanisms
  4. Noam Nisan and Amir Ronen, Computationally feasible VCG mechanisms, Journal of Artificial Intelligence Research 29 (2007), 19-47, VCG-based mechanisms and the result that truthful VCG-based allocation rules are maximal in range

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 proofH0 no proof
  • add a proof in proofs/ (06.5)
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)
WritingW4 complete
  • a review of the text: no review record reviews/P44K0N/text.yaml