Techniqueadvanced
Ironing
Also called Myerson ironing.
Replaces the virtual valuation of an irregular distribution by the slope of the concave hull of its revenue curve. The result is monotone and keeps the optimal revenue.
Ironing turns the virtual valuation of a distribution that is not regular into a nondecreasing function, the ironed virtual valuation, without loss of optimal revenue. It draws the revenue curve in quantile space, replaces it by its least concave majorant , and uses the slope of in place of the slope of . On the intervals where lies above , the ironed value is constant, and an optimal mechanism treats all values in such an interval alike. Myerson's lemma says that a truthful allocation must be monotone in the value. Ironing is the step that makes the revenue-maximizing allocation of Myerson's optimal auction monotone when the raw virtual valuation is not.
In plain words
A seller wants to rank bidders by how much revenue each one brings. For most distributions of values, a bidder with a higher value brings more. For some distributions it does not: a value in a thin middle range can look worse to the seller than a lower value. But an auction cannot reward a lower bid over a higher one, or bidders would lie. Ironing fixes this by pooling. It finds the ranges where the ranking goes the wrong way and gives every value in such a range the same average score. The scores then never go down as the value goes up, and the seller loses nothing, because the best possible auction would treat these values alike anyway. The name comes from pressing out the bumps of a curve.
When it applies
- A revenue problem with independent single-parameter agents whose value distribution is not regular, for example a bimodal one or a discrete one with a small middle mass.
- Any problem that asks to maximize over nondecreasing , where is not monotone. Ironing gives the optimal value , attained by any that is optimal for and constant on the ironed intervals.
- One buyer with a constraint on the sale probability: the best revenue with sale probability is , reached by a random price between two hull vertices. This is the building block of sequential posted pricing.
The template
For a discrete distribution on , the revenue curve has the points and with .
IRON(s_1 < ... < s_K, f_1, ..., f_K)- 1
P ← (0, 0), then (q_k, s_k q_k) for k = K down to 1 ▷ increasing q - 2
H ← vertices of the upper concave hull of P (monotone chain) - 3
for each pair (a, b) of consecutive vertices of H: - 4
give every curve segment from a to b the slope of the chord from a to b - 5
if b ≥ a + 2: record the values of those segments as one ironed interval - 6
return the slopes, in increasing order of value, and the ironed intervals
The ironed value of is , the slope assigned to its segment. On an ironed interval it equals the -weighted mean of the raw virtual values of that interval. For a continuous distribution the same holds with the least concave function above and . The proof that the slopes are nondecreasing, that they keep the virtual surplus of every allocation that is constant on ironed intervals, and that they never lower it for monotone allocations is in proofs/correctness.md.
Classic examples
- A discrete irregular distribution. Values with probabilities have and revenue curve points , , and . The raw virtual values are . The point lies below the chord from to , of slope , so the values 2 and 3 form one ironed interval and . Check: .
- The optimal auction. With two bidders from the distribution above, Myerson's auction ranks by , so bids 2 and 3 tie, and the expected revenue is 3. The Vickrey auction earns . Ranking by the raw is not monotone: the value 3 has and never wins, while the value 2 can win, so no payment rule makes that ranking truthful.
- A single buyer. The best posted price is a hull vertex: for the distribution above, price 2 sells for sure and earns 2, price 5 earns , and price 3 earns only , the point below the hull. To sell with probability exactly , the best a seller can do is the price 5 or 2 with probability and , which earns , while the price 3 earns .
- A negative ironed value. Values with probabilities have and . A single buyer is offered the price 5, for revenue .
Variations
- Isotonic regression. The ironed values are the weighted isotonic regression of the raw virtual values with weights : the nondecreasing sequence closest to in weighted squared error. The pool adjacent violators algorithm computes it by merging adjacent blocks that are out of order into their weighted mean, which gives the same answer as the hull.
- Myerson's form. Myerson writes the quantile as and takes the convex hull of . This is the same construction seen from the other end of the quantile axis.
- Ironing in other mechanism design problems. The same pooling of types appears as bunching in monopoly screening and in nonlinear pricing, whenever a pointwise optimum violates the monotonicity that incentive compatibility needs.
- Ex ante relaxation. The concave hull is also the revenue curve of a seller who may randomize over prices. The ex ante relaxation of a multi-bidder problem uses for each bidder.
Pitfalls
- Ironing in value space. The hull must be taken of the revenue curve in quantile space, or of the integral of against the quantile. Taking the hull of as a function of the value, or averaging without the weights , gives wrong values.
- Tie rule inside an ironed interval. An optimal auction must treat all values in an ironed interval alike. A rule that breaks ties among equal ironed values in favor of the higher raw value is no longer constant on the interval, and its revenue drops below the ironed virtual surplus.
- "Convex" or "concave". The hull is concave in the revenue curve picture and convex in Myerson's picture. The two are the same object, but mixing the conventions flips the sign of the slopes.
- Exact arithmetic. For discrete distributions the hull test compares products of rationals. Floating point can merge or split ironed intervals by mistake.
- Regular distributions. If the distribution is regular, ironing changes nothing. A test that finds ironed intervals for a regular distribution has a bug.
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
# Part of https://algorithm.tamnd.com/ironing/. The authors are listed in prov/Y8ZAS3.jsonl.
"""Ironing of the virtual values of a discrete value distribution.
A distribution is a list of (value, probability) pairs with distinct values and positive
probabilities that sum to 1, as ints or Fractions. The revenue curve has the points (0, 0) and
(q_k, s_k q_k) with q_k = Pr[v >= s_k]. The virtual value of s_k is the slope of the curve on the
quantile interval of s_k, and the ironed virtual value is the slope of the concave hull there.
"""
from fractions import Fraction
from typing import Sequence
Dist = Sequence[tuple]
def normalize(dist: Dist):
"""Return (values, probs) sorted by value, as Fractions, after checking the input."""
pairs = sorted((Fraction(v), Fraction(p)) for v, p in dist)
values = [v for v, _ in pairs]
probs = [p for _, p in pairs]
if not pairs or len(set(values)) != len(values):
raise ValueError("the support must be nonempty with distinct values")
if any(p <= 0 for p in probs) or sum(probs) != 1:
raise ValueError("the probabilities must be positive and sum to 1")
return values, probs
def revenue_curve(dist: Dist):
"""Return the points (q, R) from (0, 0) to (1, s_1), in increasing order of q."""
values, probs = normalize(dist)
pts = [(Fraction(0), Fraction(0))]
q = Fraction(0)
for s, f in zip(reversed(values), reversed(probs)):
q += f
pts.append((q, s * q))
return pts
def concave_hull(pts):
"""Return the indices of the vertices of the upper concave hull of points sorted by q."""
hull = []
for k, (x, y) in enumerate(pts):
while len(hull) >= 2:
(x1, y1), (x2, y2) = pts[hull[-2]], pts[hull[-1]]
if (y2 - y1) * (x - x1) <= (y - y1) * (x2 - x1):
hull.pop()
else:
break
hull.append(k)
return hull
def virtual_values(dist: Dist):
"""Return the virtual values of the support values, in increasing order of value."""
pts = revenue_curve(dist)
slopes = [(pts[j][1] - pts[j - 1][1]) / (pts[j][0] - pts[j - 1][0]) for j in range(1, len(pts))]
return list(reversed(slopes))
def iron(dist: Dist):
"""Return (ironed virtual values, ironed intervals).
The ironed values are in increasing order of value. An ironed interval is a pair (lo, hi) of
value indices, lo < hi, such that one hull segment spans the values s_lo, ..., s_hi, so they
share one ironed virtual value. Inside the interval the revenue curve lies on or below the hull.
"""
pts = revenue_curve(dist) # @line L1
K = len(pts) - 1
hull = concave_hull(pts) # @line L2
slope = [None] * (K + 1)
intervals = []
for a, b in zip(hull, hull[1:]): # @line L3
m = (pts[b][1] - pts[a][1]) / (pts[b][0] - pts[a][0])
for j in range(a + 1, b + 1): # @line L4
slope[j] = m
if b - a >= 2:
# curve point j belongs to value index K - j; the segment covers points a + 1 .. b
intervals.append((K - b, K - (a + 1))) # @line L5
return list(reversed(slope[1:])), sorted(intervals) # @line L6
test_ironing.py 101 lines
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/ironing/. The authors are listed in prov/Y8ZAS3.jsonl.
import random
import unittest
from fractions import Fraction as F
from ironing import concave_hull, iron, revenue_curve, virtual_values
IRREGULAR = [(2, F(1, 2)), (3, F(1, 6)), (5, F(1, 3))]
def random_dist(rng, k, denom=12):
values = sorted(rng.sample(range(1, 20), k))
cuts = sorted(rng.sample(range(1, denom), k - 1))
parts = [b - a for a, b in zip([0] + cuts, cuts + [denom])]
return [(v, F(p, denom)) for v, p in zip(values, parts)]
def hull_height(pts, hull, q):
"""The value at q of the piecewise linear function through the hull vertices."""
for a, b in zip(hull, hull[1:]):
(x1, y1), (x2, y2) = pts[a], pts[b]
if x1 <= q <= x2:
return y1 + (y2 - y1) * (q - x1) / (x2 - x1)
raise AssertionError("q outside [0, 1]")
class TestIroning(unittest.TestCase):
def test_example(self):
self.assertEqual(virtual_values(IRREGULAR), [1, -1, 5])
self.assertEqual(iron(IRREGULAR), ([F(1, 2), F(1, 2), 5], [(0, 1)]))
def test_regular_is_unchanged(self):
d = [(1, F(1, 4)), (2, F(1, 4)), (3, F(1, 4)), (4, F(1, 4))]
self.assertEqual(iron(d), (virtual_values(d), []))
self.assertEqual(iron([(7, 1)]), ([7], []))
def test_long_ironed_interval(self):
d = [(1, F(3, 10)), (2, F(1, 10)), (3, F(1, 10)), (4, F(1, 10)), (6, F(2, 5))]
bar, intervals = iron(d)
self.assertEqual(bar, [F(-7, 3)] * 4 + [6])
self.assertEqual(intervals, [(0, 3)])
def test_hull_properties(self):
rng = random.Random(1)
for _ in range(300):
d = random_dist(rng, rng.randint(1, 7))
probs = [p for _, p in sorted(d)]
phi = virtual_values(d)
bar, intervals = iron(d)
pts = revenue_curve(d)
hull = concave_hull(pts)
# the hull lies on or above every point and touches the two end points
for q, r in pts:
self.assertGreaterEqual(hull_height(pts, hull, q), r)
self.assertEqual(hull[0], 0)
self.assertEqual(hull[-1], len(pts) - 1)
# ironed values are nondecreasing and equal the raw ones outside ironed intervals
self.assertTrue(all(a <= b for a, b in zip(bar, bar[1:])))
inside = {k for lo, hi in intervals for k in range(lo, hi + 1)}
for k in range(len(d)):
if k not in inside:
self.assertEqual(bar[k], phi[k])
# on each ironed interval the mean of phi equals the ironed value
for lo, hi in intervals:
mass = sum(probs[lo:hi + 1])
mean = sum(phi[k] * probs[k] for k in range(lo, hi + 1)) / mass
self.assertEqual(mean, bar[lo])
# both have mean equal to the lowest value
low = min(v for v, _ in d)
self.assertEqual(sum(f * x for f, x in zip(probs, phi)), low)
self.assertEqual(sum(f * x for f, x in zip(probs, bar)), low)
def test_virtual_surplus_inequality(self):
rng = random.Random(2)
for _ in range(300):
d = random_dist(rng, rng.randint(1, 6))
probs = [p for _, p in sorted(d)]
phi = virtual_values(d)
bar, intervals = iron(d)
# a random nondecreasing allocation x in [0, 1]
x = sorted(F(rng.randint(0, 6), 6) for _ in d)
self.assertGreaterEqual(sum(f * a * b for f, a, b in zip(probs, x, bar)),
sum(f * a * b for f, a, b in zip(probs, x, phi)))
# constant on ironed intervals gives equality
for lo, hi in intervals:
for k in range(lo, hi + 1):
x[k] = x[lo]
self.assertEqual(sum(f * a * b for f, a, b in zip(probs, x, bar)),
sum(f * a * b for f, a, b in zip(probs, x, phi)))
def test_bad_input(self):
with self.assertRaises(ValueError):
iron([])
with self.assertRaises(ValueError):
iron([(1, F(1, 3)), (2, F(1, 3))])
if __name__ == "__main__":
unittest.main()
Exercises
- Show that for any distribution on with , . (Both are the rise of a curve from to .)
- Iron the distribution with values and probabilities . (Answer: , with one ironed interval of four values.)
- Show that the optimal revenue from one buyer with sale probability at most is when is nondecreasing up to , and that a lottery over at most two prices attains it.
- Run the pool adjacent violators algorithm on the raw virtual values with weights and check that it gives .
Proof: Correctness of ironing by the concave hullfull
Let the distribution have values with probabilities . Write , so , and put and . Line L1 builds the revenue curve: the points and for , in increasing order of . The segment of value runs from to . It has length and slope , the virtual value. Let be the least concave function on that lies on or above all the points, and let be its slope on the segment of .
Claim 1: line L2 returns the vertices of
The scan keeps a stack of point indices. Invariant: after point is processed, the stack holds the vertices of the upper hull of points , in order, with strictly decreasing slopes between consecutive entries. This holds after point 0. When point arrives, the loop removes the top entry while lies on or below the chord from the entry under it to point . Such a cannot be a vertex of the hull of points , because it lies on or below a segment between two points of the set. When the loop stops, the last two entries and point make a strict right turn, so the slopes still decrease strictly. Entries below were vertices before and stay vertices, since the new point lies to their right and the slopes decrease. So the invariant holds. At the end, the stack holds the vertices of the upper hull of all the points, from to , and the piecewise linear function through them is concave and lies on or above every point, so it is . Each point enters and leaves the stack at most once, so the scan takes steps.
Claim 2: lines L3 to L6 give the slopes of , and they are nondecreasing in the value
Between consecutive vertices and , is the chord, so every segment of the curve from point to point gets the slope of the chord (line L4). The slopes of the hull decrease strictly from one chord to the next as grows. Since decreases as grows, . Line L6 reverses the list so that it is in increasing order of value.
If the chord from to spans one segment only (), then there. Otherwise line L5 records the value indices of points as an ironed interval. Curve point belongs to value index in increasing order, which is the conversion used in line L5. Every value outside the recorded intervals has its own chord, so there.
Claim 3: the mean of on an ironed interval is the ironed value
On an ironed interval with values , the curve and the hull meet at both ends, the vertices and . So , the rise of the curve over the interval, equals , the rise of the hull. Over all values, both sums telescope from to : , the lowest value.
Claim 4: ironing never lowers the virtual surplus of a monotone allocation, and keeps it when the allocation is flat on ironed intervals
Let and put . Write and , with . Summation by parts gives
Each factor is nonnegative, and because the hull lies above the curve. So the sum is at least 0. The term is 0, since is a vertex. For , only if the point lies strictly below the hull, and then it is an inner point of an ironed interval that contains both and . If is constant on each ironed interval, then for every such , and the sum is 0.
This is the step that lets Myerson's optimal auction replace by : its allocation depends on the value only through , so it is constant on ironed intervals, and its revenue is the expected ironed virtual surplus. For any other monotone allocation, the expected ironed virtual surplus is an upper bound on the revenue.
References
- Roger B. Myerson, Optimal auction design, Mathematics of Operations Research 6(1) (1981), 58-73, the ironing procedure, which replaces the integral of the virtual valuation in quantile space by its convex hull, for distributions that are not regular
- Jeremy Bulow and John Roberts, The simple economics of optimal auctions, Journal of Political Economy 97(5) (1989), 1060-1090, ironing as the use of the concave hull of the revenue curve of a monopolist, with marginal revenue in place of the virtual valuation
- Jason D. Hartline, Mechanism Design and Approximation, book draft, version with Chapters 1 to 7 revised in September 2021, https://jasonhartline.com/MDnA/, Chapter 3, Optimal mechanisms (revenue curves, the ironed revenue curve as a concave hull, and the optimality of ironed virtual surplus maximization)
- Noam Nisan, Tim Roughgarden, Eva Tardos and Vijay V. Vazirani (eds.), Algorithmic Game Theory, Cambridge University Press, 2007, Chapter 13, Jason D. Hartline and Anna R. Karlin, Profit maximization in mechanism design (the optimal mechanism for distributions that are not regular)
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 | H2 full proof |
|
| Lean | L0 no Lean part |
|
| Code (python) | I0 not checked yet |
|
| Visual | V0 none |
|
| Writing | W3 standard |
|
Tag Y8ZAS3 Edit this page History Report an error Markdown