Techniqueadvanced
Automated mechanism design
Also called Conitzer-Sandholm automated mechanism design.
Computes an optimal mechanism for a given prior and objective by solving a linear or integer program over outcomes and payments.
Automated mechanism design (AMD) computes a mechanism for one concrete instance instead of deriving it by hand. The designer writes down the finite type sets, the prior, the outcomes, the agents' values and its own objective, and a solver finds the mechanism that maximizes the objective under incentive and participation constraints. By the revelation principle, it is enough to search over direct mechanisms that are truthful. Conitzer and Sandholm (2002) observed that if the mechanism may randomize, every constraint and the objective are linear in the outcome probabilities and payments, so the optimal mechanism is the solution of one linear program. If the mechanism must be deterministic, the problem becomes NP-complete in general.
In plain words
Usually an expert designs an auction or a voting rule with pen and paper, and the result works only for the cases the expert studied. Automated mechanism design lets a computer do the design for the case at hand. You list the possible kinds of participants, how likely each one is, what each one wants, and what you want. The computer then searches over all rules that make honesty the best plan and that people are willing to join, and picks the best one for you. If the rule is allowed to flip coins, this search is a standard optimization problem that computers solve fast. If the rule may not flip coins, the search can be very hard.
When it applies
- The type sets are finite and small, or can be discretized into a small grid, and the prior over type profiles is known. The prior may be correlated.
- The objective is linear in the outcome lottery and the payments: expected revenue, expected welfare, the designer's own utility for outcomes, or a weighted sum of these.
- The constraints are linear: Bayesian or dominant-strategy incentive compatibility, interim or ex post individual rationality, budget balance, or no payments at all.
- The designer accepts a randomized mechanism. If it must be deterministic, the same model with 0/1 outcome variables is an integer program, which may still be solved for small instances.
The method does not fit when the number of type profiles is huge, since it needs one block of variables per profile, or when types are continuous and a coarse grid would lose the structure of the optimal mechanism.
The template
There are agents with finite type sets , a prior on , outcomes and values for type . The objective has weight on each outcome, weight on the sum of values and weight on the payments. Write for the utility of agent of true type when it reports and the others report :
AUTOMATED-MECHANISM-DESIGN(T, π, O, v, g, a, b, IC, IR)- 1
make variables x(t, o) ≥ 0 and free p_i(t) for every profile t, outcome o and agent i - 2
for each profile t: add Σ_o x(t, o) = 1 - 3
for each agent i and types s ≠ r in T_i: add the IC constraint "s gains nothing by reporting r" - 4
for each agent i and type s: add the IR constraint "s gets utility at least 0" - 5
solve: maximize Σ_t π(t) [Σ_o x(t, o) (g(o) + a Σ_i v_i(t_i, o)) + b Σ_i p_i(t)] - 6
return the lottery x(t, ·) and the payments p(t) for every profile t
For Bayesian incentive compatibility (BIC), the constraint on line L3 is one row for each :
Multiplying by instead of dividing by keeps the row linear and handles correlated priors, where the belief of agent depends on . For dominant-strategy incentive compatibility (DSIC), the row is required separately for every . Interim individual rationality (IR) on line L4 is , and ex post IR asks for every .
Correctness. Every truthful randomized direct mechanism is a feasible point of the LP, with the same objective value, and every feasible point is such a mechanism. So an optimal LP solution is an optimal mechanism. By the revelation principle, no other mechanism, direct or not, does better in equilibrium.
Size. With types per agent, outcomes and profiles, the LP has variables, equations, BIC rows (each with up to terms) or about DSIC rows, and or IR rows. The size is polynomial in the size of the prior when the prior is given as a full table, but exponential in .
Classic examples
Randomization helps, worked by hand. One agent has type L or H with probability each. There are three outcomes and no payments. The values are and for , and the designer maximizes the agent's value plus , so its payoff is for type L and for type H. The designer would like L to get and H to get , for , but then L reports H, since it values at 4 and at 3. The best deterministic mechanism gives to both types, for . The LP gives to L and the lottery to H. Type L values that lottery at , exactly its value for , so it does not lie; type H values it at . The designer gets .
Optimal auctions. With outcomes "bidder wins" and "no sale", , , BIC and interim IR, the LP finds the revenue-optimal auction. For one buyer it returns the best posted price, with revenue . For independent bidders its value equals the expected maximum of the ironed virtual values in Myerson's optimal auction, with both BIC and DSIC constraints. The tests check both facts against direct formulas.
Correlated types. For two bidders with values 1 or 2 and the prior , , the same LP returns revenue , the full expected surplus, as the Cremer-McLean theorem predicts. The LP finds the side bets on the other bidder's report without being told about them.
Applications. In later papers, Conitzer and Sandholm applied the method to small instances such as a divorce settlement and auctions of a few items with complements, with a designer that may be self-interested.
Variations
- Deterministic mechanisms. Requiring gives an integer program. Without payments this problem is NP-complete, for both dominant-strategy and Bayes-Nash implementation (Conitzer and Sandholm, 2002). Later work showed hardness in some settings with payments too.
- Interim (reduced form) variables. For auctions with independent types, the incentive constraints depend only on the interim allocation and payment of each agent. An LP over these variables, plus Border's theorem or a separation oracle for the feasibility of the interim rule, avoids the blow-up. This is the approach of Cai, Daskalakis and Weinberg (2012).
- Incremental and search-based solvers. Branch-and-bound over deterministic mechanisms and constraint generation, which adds only the incentive constraints that the current solution violates, scale to larger instances.
- Learning the mechanism. When types are continuous or many, the mechanism can be a parameterized function trained on samples, as in deep learning for auction design. This trades the exactness of the LP for scale, and incentive compatibility then holds only approximately.
- Other solution concepts. Ex post IC, IR with outside options that depend on the type, budget balance and caps on payments are all linear constraints and fit the same template.
Pitfalls
- The result is only as good as the prior. The LP fits the prior exactly, and a mechanism that is BIC for one prior can fail to be BIC for a slightly different one. Full surplus extraction with correlated types is the extreme case: the side bets can be huge, and they rely on the exact conditional beliefs.
- Randomization may not be acceptable. The optimal LP solution may use lotteries, as in the example. If the setting forbids them, the LP value is only an upper bound, and the integer program can be hard.
- Free payments must be split. An LP solver with nonnegative variables needs . Forgetting this forbids subsidies and changes the answer.
- Exponential size. The number of profiles grows as . Three agents with ten types each already give 1000 profiles, and the BIC rows are dense.
- Zero-probability profiles. Profiles with do not enter the objective or the BIC rows, so their outcomes are arbitrary. Under DSIC they still matter, because a lie can lead to them.
- Discretization. A grid on continuous types gives a mechanism that is IC only on the grid points. Between them, an agent may want to lie, so the mechanism must be extended with care.
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.
# SPDX-License-Identifier: MIT
# Shared helper of the algorithmic game theory pages of https://algorithm.tamnd.com/. The authors are listed in prov/.
"""Exact linear programming in Fraction, by the two-phase simplex method with Bland's rule.
lp_max(c, A_ub, b_ub, A_eq=None, b_eq=None) maximizes c x subject to A_ub x <= b_ub,
A_eq x = b_eq and x >= 0. lp_min does the same for minimization. Free variables must be
split by the caller (x = x+ - x-). Every input number is converted to Fraction, so the
result is exact: there is no tolerance anywhere.
Both functions return (status, x, value, dual). status is "optimal", "infeasible" or
"unbounded". When status is not "optimal", x, value and dual are None. dual has one entry
per constraint, the A_ub rows first and then the A_eq rows. It is the vector of shadow
prices: the value is sum_i b_i dual_i (strong duality). For lp_max, dual_i >= 0 on the
A_ub rows and A^T dual >= c. For lp_min, dual_i <= 0 on the A_ub rows and A^T dual <= c.
The entries for the A_eq rows have no sign condition.
Bland's rule (the smallest improving column enters, and among the rows with the smallest
ratio the one with the smallest basic variable leaves) makes the method finite on every
input, degenerate inputs included. There is no game algorithm in this module.
"""
from fractions import Fraction
def _frac(v):
return v if isinstance(v, Fraction) else Fraction(v)
def _pivot(T, obj, basis, r, j):
p = T[r][j]
row = [v / p for v in T[r]]
T[r] = row
for k in range(len(T)):
f = T[k][j]
if k != r and f != 0:
T[k] = [a - f * b for a, b in zip(T[k], row)]
f = obj[j]
if f != 0:
obj[:] = [a - f * b for a, b in zip(obj, row)]
basis[r] = j
def _simplex(T, obj, basis, ncols):
"""Maximize. obj[j] is the reduced cost of column j and obj[-1] is minus the value."""
while True:
enter = next((j for j in range(ncols) if obj[j] > 0), None)
if enter is None:
return "optimal"
best = None
for r, row in enumerate(T):
a = row[enter]
if a > 0:
key = (row[-1] / a, basis[r])
if best is None or key < best[0]:
best = (key, r)
if best is None:
return "unbounded"
_pivot(T, obj, basis, best[1], enter)
def _objective_row(cost, T, basis):
obj = list(cost) + [Fraction(0)]
for r, j in enumerate(basis):
f = obj[j]
if f != 0:
obj = [a - f * b for a, b in zip(obj, T[r])]
return obj
def _any_solution(M, rhs, nvars):
"""Return one solution y of M y = rhs (a consistent system), with the free variables 0."""
rows = [list(M[k]) + [rhs[k]] for k in range(len(M))]
pivots = []
r = 0
for col in range(nvars):
p = next((k for k in range(r, len(rows)) if rows[k][col] != 0), None)
if p is None:
continue
rows[r], rows[p] = rows[p], rows[r]
pv = rows[r][col]
rows[r] = [v / pv for v in rows[r]]
for k in range(len(rows)):
f = rows[k][col]
if k != r and f != 0:
rows[k] = [a - f * b for a, b in zip(rows[k], rows[r])]
pivots.append(col)
r += 1
if r == len(rows):
break
y = [Fraction(0)] * nvars
for k, col in enumerate(pivots):
y[col] = rows[k][-1]
return y
def _matrix(A, width, name):
A = [[_frac(v) for v in row] for row in (A or [])]
if any(len(row) != width for row in A):
raise ValueError(name + " must have one column per variable")
return A
def lp_max(c, A_ub, b_ub, A_eq=None, b_eq=None):
"""Maximize c x subject to A_ub x <= b_ub, A_eq x = b_eq and x >= 0, exactly."""
c = [_frac(v) for v in c]
n = len(c)
A_ub = _matrix(A_ub, n, "A_ub")
A_eq = _matrix(A_eq, n, "A_eq")
b_ub = [_frac(v) for v in (b_ub or [])]
b_eq = [_frac(v) for v in (b_eq or [])]
if len(b_ub) != len(A_ub) or len(b_eq) != len(A_eq):
raise ValueError("b_ub and b_eq must have one entry per row")
m1, m2 = len(A_ub), len(A_eq)
m = m1 + m2
width = n + m1
# Rows in the original orientation, with a slack column for each A_ub row.
orig = [A_ub[i] + [Fraction(int(k == i)) for k in range(m1)] for i in range(m1)]
orig += [A_eq[i] + [Fraction(0)] * m1 for i in range(m2)]
rhs = b_ub + b_eq
# A row gets an artificial variable if it is an equation or if its right side is negative.
need = [i >= m1 or rhs[i] < 0 for i in range(m)]
nart = sum(need)
T, basis = [], []
a = 0
for i in range(m):
sign = -1 if rhs[i] < 0 else 1
row = [sign * v for v in orig[i]] + [Fraction(0)] * nart + [sign * rhs[i]]
if need[i]:
row[width + a] = Fraction(1)
basis.append(width + a)
a += 1
else:
basis.append(n + i)
T.append(row)
if nart:
# Phase 1: maximize minus the sum of the artificial variables.
obj = _objective_row([Fraction(0)] * width + [Fraction(-1)] * nart, T, basis)
_simplex(T, obj, basis, width + nart)
if obj[-1] != 0:
return "infeasible", None, None, None
keep = []
for r in range(m):
if basis[r] >= width:
j = next((j for j in range(width) if T[r][j] != 0), None)
if j is None:
continue # the row is a combination of the other rows
_pivot(T, [Fraction(0)] * (width + nart + 1), basis, r, j)
keep.append(r)
T = [T[r][:width] + [T[r][-1]] for r in keep]
basis = [basis[r] for r in keep]
# Phase 2: the original objective, without the artificial columns.
cost = c + [Fraction(0)] * m1
obj = _objective_row(cost, T, basis)
if _simplex(T, obj, basis, width) == "unbounded":
return "unbounded", None, None, None
x = [Fraction(0)] * n
for r, j in enumerate(basis):
if j < n:
x[j] = T[r][-1]
value = sum((ci * xi for ci, xi in zip(c, x)), Fraction(0))
# The dual solves y^T A_B = c_B, where A_B holds the basic columns of the original rows.
M = [[orig[i][j] for i in range(m)] for j in basis]
dual = _any_solution(M, [cost[j] for j in basis], m)
return "optimal", x, value, dual
def lp_min(c, A_ub, b_ub, A_eq=None, b_eq=None):
"""Minimize c x subject to A_ub x <= b_ub, A_eq x = b_eq and x >= 0, exactly."""
status, x, value, dual = lp_max([-_frac(v) for v in c], A_ub, b_ub, A_eq, b_eq)
if status != "optimal":
return status, None, None, None
return status, x, -value, [-v for v in dual]
automated_mechanism_design.py 136 lines
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/automated-mechanism-design/. The authors are listed in prov/JG4KT0.jsonl.
"""Automated mechanism design by linear programming, after Conitzer and Sandholm.
The setting is finite. Agent i has a list of types types[i]. The prior is a dict from type
profiles (tuples) to probabilities, so the types may be correlated. outcomes is a list, and
value[i][s][o] is the value of agent i of type s for outcome o. Utilities are quasilinear.
A randomized mechanism gives, for each reported profile t, a lottery x(t, o) over the
outcomes and a payment p_i(t) from each agent. The designer maximizes the expectation of
g[o] + a * (sum of the agents' values of o) + b * (sum of the payments)
under incentive constraints ic ("bic" or "dsic") and participation constraints ir
("interim", "ex_post" or "none"). With payments=False all payments are 0. Everything is
one linear program, solved exactly in Fraction by agtlp.
"""
from fractions import Fraction
from itertools import product
from agtlp import lp_max
def profiles(types):
"""All type profiles, in the order of itertools.product."""
return list(product(*types))
def _deviate(t, i, s):
return t[:i] + (s,) + t[i + 1:]
def design(types, prior, outcomes, value, g=None, a=0, b=1, ic="bic", ir="interim", payments=True):
"""Return (status, objective value, mechanism) of an optimal randomized mechanism.
mechanism maps each profile t to (lottery, pay), where lottery[j] is the probability of
outcomes[j] and pay[i] is the payment of agent i. status is the one of the LP.
"""
if ic not in ("bic", "dsic") or ir not in ("interim", "ex_post", "none"):
raise ValueError("unknown constraint type")
n, m = len(types), len(outcomes)
g = [Fraction(0)] * m if g is None else [Fraction(v) for v in g]
a, b = Fraction(a), Fraction(b)
prof = profiles(types)
pr = {t: Fraction(prior.get(t, 0)) for t in prof}
# Variables: x(t, o) for every t and o, then p_i(t) = plus - minus if there are payments.
xi = {} # @line L1
for t in prof:
for j in range(m):
xi[t, j] = len(xi)
pi = {}
if payments:
for t in prof:
for i in range(n):
pi[t, i] = (len(xi) + 2 * len(pi), len(xi) + 2 * len(pi) + 1)
nv = len(xi) + 2 * len(pi)
def utility(i, s, t, weight, row):
# Add weight * (utility of agent i of true type s when the report profile is t).
for j, o in enumerate(outcomes):
row[xi[t, j]] += weight * Fraction(value[i][s][o])
if payments:
plus, minus = pi[t, i]
row[plus] -= weight
row[minus] += weight
A_ub, b_ub, A_eq, b_eq = [], [], [], []
def at_least_zero(row):
A_ub.append([-v for v in row])
b_ub.append(Fraction(0))
for t in prof: # @line L2
row = [Fraction(0)] * nv
for j in range(m):
row[xi[t, j]] = Fraction(1)
A_eq.append(row)
b_eq.append(Fraction(1))
for i in range(n): # @line L3
for s in types[i]:
for r in types[i]:
if r == s:
continue
if ic == "bic":
row = [Fraction(0)] * nv
for t in prof:
if t[i] == s and pr[t] != 0:
utility(i, s, t, pr[t], row)
utility(i, s, _deviate(t, i, r), -pr[t], row)
at_least_zero(row)
else:
for t in prof:
if t[i] == s:
row = [Fraction(0)] * nv
utility(i, s, t, Fraction(1), row)
utility(i, s, _deviate(t, i, r), Fraction(-1), row)
at_least_zero(row)
if ir != "none": # @line L4
for i in range(n):
for s in types[i]:
if ir == "interim":
row = [Fraction(0)] * nv
for t in prof:
if t[i] == s and pr[t] != 0:
utility(i, s, t, pr[t], row)
at_least_zero(row)
else:
for t in prof:
if t[i] == s:
row = [Fraction(0)] * nv
utility(i, s, t, Fraction(1), row)
at_least_zero(row)
c = [Fraction(0)] * nv # @line L5
for t in prof:
for j, o in enumerate(outcomes):
welfare = sum((Fraction(value[i][t[i]][o]) for i in range(n)), Fraction(0))
c[xi[t, j]] += pr[t] * (g[j] + a * welfare)
if payments:
for i in range(n):
plus, minus = pi[t, i]
c[plus] += pr[t] * b
c[minus] -= pr[t] * b
status, x, val, _ = lp_max(c, A_ub, b_ub, A_eq, b_eq)
if status != "optimal":
return status, None, None
mech = {} # @line L6
for t in prof:
lottery = [x[xi[t, j]] for j in range(m)]
if payments:
pay = [x[pi[t, i][0]] - x[pi[t, i][1]] for i in range(n)]
else:
pay = [Fraction(0)] * n
mech[t] = (lottery, pay)
return status, val, mech
test_automated_mechanism_design.py 206 lines
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/automated-mechanism-design/. The authors are listed in prov/JG4KT0.jsonl.
import random
from fractions import Fraction
from itertools import product
from automated_mechanism_design import design, profiles
F = Fraction
SEED = 20251120
def auction(values_per_agent):
"""Single-item auction: outcome i means agent i gets the item, outcome n means no sale."""
n = len(values_per_agent)
outcomes = list(range(n + 1))
value = [{s: {o: (F(s) if o == i else F(0)) for o in outcomes} for s in values_per_agent[i]} for i in range(n)]
return outcomes, value
def independent_prior(types, probs):
prior = {}
for t in product(*types):
p = F(1)
for i, s in enumerate(t):
p *= probs[i][s]
prior[t] = p
return prior
def random_distribution(rng, k, low=1, high=12):
vals = sorted(rng.sample(range(low, high + 1), k))
weights = [rng.randint(1, 5) for _ in range(k)]
total = sum(weights)
return vals, {v: F(w, total) for v, w in zip(vals, weights)}
def utility(value, outcomes, mech, i, s, t):
lottery, pay = mech[t]
return sum((lottery[j] * F(value[i][s][o]) for j, o in enumerate(outcomes)), F(0)) - pay[i]
def interim(types, prior, value, outcomes, mech, i, s, r):
"""Expected utility times Pr(t_i = s) of agent i of type s who reports r."""
total = F(0)
for t in profiles(types):
if t[i] == s:
total += prior[t] * utility(value, outcomes, mech, i, s, t[:i] + (r,) + t[i + 1:])
return total
def ironed_reference(vals, probs):
"""Discrete ironed virtual values from the upper concave hull of the revenue curve."""
k = len(vals)
q = [sum(probs[vals[l]] for l in range(j, k)) for j in range(k)] + [F(0)]
pts = sorted([(F(0), F(0))] + [(q[j], vals[j] * q[j]) for j in range(k)])
hull = []
for p in pts:
while len(hull) >= 2:
(x1, y1), (x2, y2) = hull[-2], hull[-1]
if (y2 - y1) * (p[0] - x1) <= (p[1] - y1) * (x2 - x1):
hull.pop()
else:
break
hull.append(p)
def H(x):
for (x1, y1), (x2, y2) in zip(hull, hull[1:]):
if x1 <= x <= x2:
return y1 + (y2 - y1) * (x - x1) / (x2 - x1)
raise AssertionError
return {vals[j]: (H(q[j]) - H(q[j + 1])) / probs[vals[j]] for j in range(k)}
def myerson_revenue(types, probs):
phis = [ironed_reference(sorted(types[i]), probs[i]) for i in range(len(types))]
prior = independent_prior(types, probs)
return sum(prior[t] * max([F(0)] + [phis[i][s] for i, s in enumerate(t)]) for t in prior)
def test_single_buyer_posted_price():
rng = random.Random(SEED)
for _ in range(6):
vals, pr = random_distribution(rng, rng.randint(1, 4))
outcomes, value = auction([vals])
prior = {(v,): pr[v] for v in vals}
status, rev, _ = design([vals], prior, outcomes, value)
best_price = max(v * sum(pr[w] for w in vals if w >= v) for v in vals)
assert status == "optimal" and rev == best_price
def test_matches_myerson_two_bidders():
rng = random.Random(SEED + 1)
for trial in range(4):
types, probs = [], []
for _ in range(2):
vals, pr = random_distribution(rng, rng.randint(2, 3))
types.append(vals)
probs.append(pr)
outcomes, value = auction(types)
prior = independent_prior(types, probs)
ic, ir = ("bic", "interim") if trial % 2 == 0 else ("dsic", "ex_post")
status, rev, _ = design(types, prior, outcomes, value, ic=ic, ir=ir)
assert status == "optimal" and rev == myerson_revenue(types, probs)
def test_solution_meets_constraints_exactly():
rng = random.Random(SEED + 2)
for _ in range(3):
types = [[0, 1], [0, 1, 2]]
outcomes = ["x", "y", "z"]
value = [{s: {o: F(rng.randint(0, 6)) for o in outcomes} for s in types[i]} for i in range(2)]
weights = {t: rng.randint(1, 4) for t in product(*types)}
total = sum(weights.values())
prior = {t: F(w, total) for t, w in weights.items()}
g = [F(rng.randint(-2, 2)) for _ in outcomes]
status, val, mech = design(types, prior, outcomes, value, g=g, a=1, b=1)
assert status == "optimal"
for t, (lottery, pay) in mech.items():
assert all(p >= 0 for p in lottery) and sum(lottery) == 1
for i in range(2):
for s in types[i]:
assert interim(types, prior, value, outcomes, mech, i, s, s) >= 0
for r in types[i]:
assert interim(types, prior, value, outcomes, mech, i, s, s) >= interim(types, prior, value, outcomes, mech, i, s, r)
objective = F(0)
for t, (lottery, pay) in mech.items():
for j, o in enumerate(outcomes):
objective += prior[t] * lottery[j] * (g[j] + sum(value[i][t[i]][o] for i in range(2)))
objective += prior[t] * sum(pay)
assert objective == val
def test_cremer_mclean_full_extraction():
types = [[1, 2], [1, 2]]
outcomes, value = auction(types)
prior = {(1, 1): F(1, 3), (2, 2): F(1, 3), (1, 2): F(1, 6), (2, 1): F(1, 6)}
status, rev, _ = design(types, prior, outcomes, value)
assert status == "optimal" and rev == F(5, 3) # the full expected surplus
half = {1: F(1, 2), 2: F(1, 2)}
status, rev_ind, _ = design(types, independent_prior(types, [half, half]), outcomes, value)
assert rev_ind == myerson_revenue(types, [half, half]) and rev_ind < F(7, 4)
def deterministic_best(types, prior, outcomes, value, g, a):
"""Brute force over every deterministic rule without payments for one agent."""
best = None
for choice in product(range(len(outcomes)), repeat=len(types[0])):
rule = dict(zip(types[0], choice))
if all(value[0][s][outcomes[rule[s]]] >= value[0][s][outcomes[rule[r]]] for s in types[0] for r in types[0]):
v = sum(prior[(s,)] * (g[rule[s]] + a * value[0][s][outcomes[rule[s]]]) for s in types[0])
best = v if best is None else max(best, v)
return best
def test_randomization_helps():
types = [["L", "H"]]
prior = {("L",): F(1, 2), ("H",): F(1, 2)}
outcomes = ["a", "b", "c"]
value = [{"L": {"a": 3, "b": 4, "c": 0}, "H": {"a": 1, "b": 5, "c": 0}}]
g = [0, -3, -1]
status, val, mech = design(types, prior, outcomes, value, g=g, a=1, b=0, ic="dsic", ir="none", payments=False)
assert status == "optimal" and val == F(17, 8)
assert mech[("L",)][0] == [1, 0, 0] and mech[("H",)][0] == [0, F(3, 4), F(1, 4)]
assert deterministic_best(types, prior, outcomes, value, g, 1) == 2
def test_lp_at_least_deterministic_without_payments():
rng = random.Random(SEED + 3)
for _ in range(8):
types = [["s0", "s1", "s2"][: rng.randint(2, 3)]]
weights = [rng.randint(1, 4) for _ in types[0]]
prior = {(s,): F(w, sum(weights)) for s, w in zip(types[0], weights)}
outcomes = ["a", "b", "c"]
value = [{s: {o: rng.randint(0, 5) for o in outcomes} for s in types[0]}]
g = [rng.randint(-3, 3) for _ in outcomes]
a = rng.randint(0, 1)
status, val, mech = design(types, prior, outcomes, value, g=g, a=a, b=0, ic="dsic", ir="none", payments=False)
assert status == "optimal" and val >= deterministic_best(types, prior, outcomes, value, g, a)
for s in types[0]:
for r in types[0]:
assert utility(value, outcomes, mech, 0, s, (s,)) >= utility(value, outcomes, mech, 0, s, (r,))
def test_outcome_only_objective_pools():
rng = random.Random(SEED + 4)
for _ in range(3):
types = [[0, 1], [0, 1]]
outcomes = ["a", "b", "c"]
value = [{s: {o: rng.randint(0, 4) for o in outcomes} for s in types[i]} for i in range(2)]
prior = independent_prior(types, [{0: F(1, 3), 1: F(2, 3)}, {0: F(1, 2), 1: F(1, 2)}])
g = [F(rng.randint(-3, 3)) for _ in outcomes]
status, val, _ = design(types, prior, outcomes, value, g=g, a=0, b=0, ir="none", payments=False)
assert status == "optimal" and val == max(g)
def test_bad_arguments():
outcomes, value = auction([[1]])
for kwargs in ({"ic": "nash"}, {"ir": "always"}):
try:
design([[1]], {(1,): F(1)}, outcomes, value, **kwargs)
except ValueError:
continue
raise AssertionError("expected ValueError")
Exercises
- Write the LP for one buyer, one item and types with equal probability, and show that its optimum is the posted price with revenue .
- In the worked example, show that every lottery with keeps type L honest, and that is optimal.
- Prove that if the objective depends only on the outcome () and there are no payments, then giving the best outcome to every profile is optimal, so randomization never helps.
- Show that for a single agent, BIC and DSIC are the same constraints, and so are interim and ex post IR.
- Count the variables and BIC rows of the LP for three bidders with four types each and four outcomes.
References
- Vincent Conitzer and Tuomas Sandholm, Complexity of mechanism design, Proceedings of the 18th Conference on Uncertainty in Artificial Intelligence (UAI 2002), 103-110 (arXiv:cs/0205075), the linear program for randomized mechanisms, and NP-completeness for deterministic mechanisms without payments under dominant-strategy and Bayes-Nash implementation
- Roger B. Myerson, Optimal auction design, Mathematics of Operations Research 6(1) (1981), 58-73, the optimal single-item auction, used here as a reference answer for the linear program
- Yang Cai, Constantinos Daskalakis and S. Matthew Weinberg, An algorithmic characterization of multi-dimensional mechanisms, STOC 2012, 459-478, linear programs over interim (reduced form) variables with a separation oracle, which avoid one variable per type profile
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 | H0 no proof |
|
| Lean | L0 no Lean part |
|
| Code (python) | I0 not checked yet |
|
| Visual | V0 none |
|
| Writing | W2 basic |
|
Tag JG4KT0 Edit this page History Report an error Markdown