Algorithmadvanced
Sequential posted pricing
Also called posted price mechanism, sequential posted price mechanism.
Offers the buyers one at a time a take-it-or-leave-it price. With prices from the ex ante relaxation it earns at least a 1 - 1/e fraction of the optimal revenue for one item.
- Time
- O(N log N) worst
- Space
- O(N) extra
- Where
- N = the total support size of the value distributions; n = the number of buyers
- Model
- Word RAM
- Properties
- comparison basedrandomizediterative
- Evidence
- Proof sketchCode in 1 languages
- Origin
- Shuchi Chawla, Jason D. Hartline, David L. Malec, Balasubramanian Sivan, 2010
Sequential posted pricing sells one item to buyers with independent private values by offering them, one at a time, a take-it-or-leave-it price, and the first buyer who accepts gets the item at that price. The prices come from the ex ante relaxation, which bounds the optimal revenue, and are offered in decreasing order. The expected revenue is at least times the revenue of Myerson's optimal auction. The prophet inequality is a statement about stopping rules for a sequence of random rewards. This page is about the mechanism: how to choose prices from the value distributions, and why the result is truthful and earns a constant fraction of the optimal revenue.
In plain words
A seller has one item and a list of buyers. Instead of running an auction, the seller visits the buyers one by one and names a price to each. A buyer who likes the price buys and the sale ends. A buyer who does not like it walks away and the seller moves on. Each buyer sees one price and can only say yes or no, so no buyer has a reason to lie or to plan ahead. The seller picks the prices in advance from what it knows about the buyers. It asks how often it would like to sell to each buyer, with the chances adding up to at most one, and turns each chance into a price. Visiting the buyers from the highest price to the lowest loses at most about a third of the best possible revenue.
The problem
There are buyers and one item. Buyer has a private value drawn from a known distribution , independently of the others, and quasilinear utility. The seller wants a simple truthful mechanism whose expected revenue is close to the optimal revenue over all BIC and individually rational mechanisms.
For buyer the revenue curve maps a sale probability to the revenue of the posted price that sells with probability . Let be its concave hull, which is the best revenue of a random price with sale probability (ironing). The ex ante relaxation is
Any mechanism sells to buyer with some ex ante probability , with , and earns at most from it, so .
The algorithm
The implementation takes discrete distributions and computes in exact fractions.
SEQUENTIAL-POSTED-PRICING(F_1, ..., F_n, v_1, ..., v_n)- 1
for each buyer i: H_i ← vertices of the concave hull of the revenue curve of F_i, from (0, 0) - 2
S ← the hull segments of all buyers with positive slope, sorted by slope, largest first - 3
cap ← 1; q_i ← 0 for all i; for each segment (i, length ℓ) in S while cap > 0: - 4
t ← min(cap, ℓ); q_i ← q_i + t; cap ← cap - t - 5
for each buyer i: lottery_i ← the hull vertex at q_i, or a mix of the two vertices around q_i - 6
draw a price P_i from lottery_i for each buyer i - 7
for each buyer i in decreasing order of P_i: - 8
if v_i ≥ P_i: sell to i at price P_i and stop - 9
keep the item
Lines L1 to L5 depend only on the distributions. They solve the relaxation as a fractional knapsack: each hull segment is an item of size and value density equal to its slope. In line L5, a vertex of at means the price , and the vertex means no offer. If lies strictly between vertices with prices and quantiles , the lottery offers with probability and otherwise. At most one buyer gets such a lottery. Lines L6 to L9 run the mechanism, and a buyer accepts exactly when its value is at least its price.
Example
A discrete instance. Two buyers have values in with probabilities . The revenue curve has the points , , and , and its hull has the vertices , and , with slopes 5 and . The greedy rule takes the slope-5 segment of buyer 1, then that of buyer 2, and then of the slope- segment of buyer 1. So , and . Buyer 2 gets the price 5. Buyer 1 sits halfway between the vertices of prices 5 and 2, so it gets 5 or 2 with probability each.
- Prices : buyer 1 is first by the tie rule, and the revenue is .
- Prices : buyer 2 is first, and the revenue is .
The expected revenue is . Myerson's optimal auction earns here, and the guarantee is , so .
Uniform values. Two buyers have values uniform on (Chawla, Hartline, Malec and Sivan 2010, introduction). Here , and the relaxation sets , the price 150 for both, and . Offering 150 to both in turn earns , exactly of EAR. The optimal auction is the Vickrey auction here, with revenue . Better prices exist: 150 to the first buyer and then 100 to the second earn .
A tight case. Three buyers have values uniform on . The relaxation gives each buyer the price 3 with , and . The mechanism earns , which is exactly times EAR.
Correctness
The proof is in proofs/correctness.md.
- Truthful and IR. Each buyer faces one price that does not depend on its own value, so accepting exactly when is a dominant strategy, and no buyer pays more than its value.
- The plan. The greedy rule solves the fractional knapsack over hull segments, so . Each lottery sells to buyer with probability and earns from it.
- The guarantee. Write the revenue as . Because prices go in decreasing order, the sale price is at least exactly when some buyer with accepts, and these events are independent. With and , the probability is , and integrating gives the bound. With the mechanism earns at least .
Proof: Correctness and the revenue guarantee of sequential posted pricingfull
There are bidders with independent values, and bidder has a discrete distribution . For a price in the support of write . The revenue curve of bidder is the set of points and , and is the least concave function on above these points. The ex ante relaxation is
Claim 1: lines L1 to L4 solve the ex ante relaxation
Line L1 computes the vertices of each by the monotone chain method, as in ironing. The function is piecewise linear with nonincreasing slopes, and . So is the largest total of over amounts with , where segment of bidder has slope and length : filling the segments in order of decreasing slope is best, and this order is the order along the hull. Hence EAR is a fractional knapsack problem with capacity 1, items of size and value density . Segments with never help. The greedy rule of lines L2 to L4, which takes the segments in order of decreasing density and cuts the last one, is optimal for the fractional knapsack by the usual exchange argument. Because the slopes of one bidder decrease along its hull, the greedy rule takes the segments of each bidder in their hull order, so the amounts it takes for bidder form an initial part of its hull, of total length , and their value is . So line L4 ends with and .
Claim 2: line L5 gives each bidder a lottery that matches its share
If is a vertex of , the price sells with probability and earns . For the vertex the bidder gets no offer, with sale probability and revenue . Otherwise lies strictly between two consecutive vertices and with . Line L5 offers with probability and with probability . Then the sale probability is , and the expected revenue is , since is linear between the two vertices. In both cases, with the random price of bidder ,
Claim 3: the mechanism is truthful and individually rational
Each bidder sees one take-it-or-leave-it price that does not depend on its own value. Accepting gives and declining gives , so accepting exactly when is optimal for every value, and no bidder pays more than its value. If the prices were revealed only when offered, the same holds, since the offer to a bidder does not depend on its own behavior. Lines L7 to L9 sell to the first bidder in the order who accepts, so at most one bidder buys.
Claim 4: the revenue is at least
Let be the sale price, with if no one buys. Then . Fix . Line L7 offers the prices in decreasing order, so all bidders with get their offers before any bidder with . Hence exactly when some bidder has and . These events are independent across bidders, since the prices are drawn independently and the values are independent. With ,
By (1), , so . By the inequality of arithmetic and geometric means, . The function is concave with , so for . Therefore
using (1) and Claim 1 in the last step. Finally for every .
Claim 5: no BIC and interim IR mechanism earns more than EAR
Take any single-item mechanism that is BIC and interim IR. Let be the ex ante probability that bidder gets the item. Since at most one bidder gets it at each profile, . Fix bidder and let and be its interim allocation and payment at its value , as in the proof for Myerson's optimal auction. That proof shows that is nondecreasing, that with , and hence that
The weights are nonnegative and sum to . The right side is , and the sale probability is . So the pair lies on or below a combination, with total weight at most 1, of the points of the revenue curve, together with for the remaining weight. Every such combination lies on or below , so . Summing over , the revenue is at most .
Together, Claims 4 and 5 show that the mechanism earns at least , and so at least , of the optimal revenue.
Running time
Line L1 takes time linear in the support sizes, in total for sorted supports, and gives at most segments. Line L2 sorts them in and lines L3 and L4 scan them once. Line L5 finds each bidder's position on its hull in total. Running the mechanism sorts the prices in and makes at most offers. Only one bidder can end inside a segment, so at most one lottery has two prices, and the exact expected revenue needs at most two orderings, each in .
Complexity
The hulls take time for sorted supports, sorting the at most segments takes , and the greedy scan and the lotteries take . A run of the mechanism sorts prices and makes at most offers, . The extra space is for the hulls. Since only one buyer can have a two-price lottery, the exact expected revenue needs only two orderings of the prices.
Properties
- Dominant-strategy truthful and simple. Each buyer makes one yes or no decision and never needs to know the others' values or the prior.
- Randomized only at one buyer. The plan is deterministic except for at most one buyer, and for continuous regular distributions no randomization is needed at all.
- Factor depends on . The guarantee is for one buyer, for two, for three, and decreases to .
- Not optimal. Myerson's auction earns more in general, as in both examples above.
- The bound is against EAR. The analysis is tight against EAR (the tight case above), but EAR can be larger than OPT, so the true ratio to OPT can be better.
Variants and improvements
- Matroid and multi-unit settings. For identical items (uniform matroid) and for partition matroids the factor is still , and for a general matroid a sequential posted pricing earns half of the optimum (Chawla, Hartline, Malec and Sivan 2010, Table 1).
- Unit-demand buyers with several items. Chawla, Hartline, Malec and Sivan use sequential posted prices for multi-parameter unit-demand buyers, where the optimal mechanism is not known, and bound their revenue against a single-parameter relaxation.
- Order not chosen by the seller. In an order-oblivious posted pricing an adversary picks the order of the offers. Prices chosen as in the prophet inequality still give a constant factor, 2 for identical items (Chawla, Hartline, Malec and Sivan 2010, Table 1).
- The best order and prices. Better prices than those of the relaxation can be found by search or dynamic programming over a fixed order, as in the uniform example with 150 and 100.
- Anonymous prices. One price for all buyers loses more revenue when the buyers differ, but it is the natural choice when the seller cannot treat buyers differently.
When to use it
Use it when an auction is hard to run, for example when the buyers arrive one at a time, or when the seller cannot collect bids from all buyers at once, and the value distributions are known. It also gives a simple benchmark and a building block for multi-parameter settings, where the optimal mechanism is complex. When all bids can be collected and the prior is trusted, Myerson's auction earns more. When the prior is unknown but the buyers are i.i.d., a Vickrey auction with an extra buyer (Bulow-Klemperer theorem) needs no prior at all.
Pitfalls
- Offer order. The analysis needs the offers in decreasing order of price. In another order, a buyer with a low price can take the item before a buyer who would pay a high price.
- Irregular distributions. With the raw revenue curve instead of its concave hull, the relaxation is no longer an upper bound on OPT. A sale probability between two hull vertices needs a random price to earn .
- Correlated values. The independence of the acceptance events is essential. With correlated values the bound can fail.
- One offer per buyer. If a buyer who declines could come back later at a lower price, it would wait, and the analysis would fail. Each buyer must get exactly one offer.
- Floating point. Hull tests and comparisons of slopes decide the plan. With discrete distributions they should be done in 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.
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/sequential-posted-pricing/. The authors are listed in prov/MES401.jsonl.
"""Sequential posted pricing for one item, with prices from the ex ante relaxation.
A distribution is a list of (value, probability) pairs with distinct values and positive
probabilities that sum to 1, as ints or Fractions. Every computation is exact.
The plan solves the ex ante relaxation: maximize the sum of the concave hulls of the bidders'
revenue curves subject to a total sale probability of at most 1. Each bidder then gets a price
lottery whose sale probability and expected revenue match its share of the relaxation. The
mechanism draws all prices, offers them in decreasing order, and sells to the first bidder who
accepts. Its expected revenue is at least 1 - (1 - 1/n)^n >= 1 - 1/e times the relaxation, which
is at least the optimal revenue.
"""
from fractions import Fraction
from itertools import product
from typing import Sequence
Dist = Sequence[tuple]
NO_OFFER = None # a price of "infinity": the bidder is not offered the item
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 hull_vertices(dist: Dist):
"""Return the vertices (q, revenue, price) of the concave hull of the revenue curve.
The first vertex is (0, 0, NO_OFFER). A vertex with price s has q = Pr[v >= s].
"""
values, probs = normalize(dist)
pts = [(Fraction(0), Fraction(0), NO_OFFER)]
q = Fraction(0)
for s, f in zip(reversed(values), reversed(probs)):
q += f
pts.append((q, s * q, s))
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)
return hull
def sale_probability(dist: Dist, price) -> Fraction:
"""Return Pr[v >= price], or 0 for NO_OFFER."""
if price is NO_OFFER:
return Fraction(0)
return sum((Fraction(p) for v, p in dist if Fraction(v) >= price), Fraction(0))
def plan(dists: Sequence[Dist]):
"""Solve the ex ante relaxation and return (relaxation value, lotteries).
lotteries[i] is a list of (price, probability) pairs; the price may be NO_OFFER.
"""
hulls = [hull_vertices(d) for d in dists] # @line L1
segments = []
for i, h in enumerate(hulls):
for k in range(1, len(h)):
dq, dr = h[k][0] - h[k - 1][0], h[k][1] - h[k - 1][1]
if dr > 0:
segments.append((dr / dq, i, k))
segments.sort(key=lambda t: (-t[0], t[1], t[2])) # @line L2
cap = Fraction(1)
q = [Fraction(0)] * len(dists)
value = Fraction(0)
for slope, i, k in segments: # @line L3
if cap == 0:
break
h = hulls[i]
take = min(cap, h[k][0] - h[k - 1][0]) # @line L4
q[i] += take
value += slope * take
cap -= take
lotteries = []
for i, h in enumerate(hulls): # @line L5
k = next(k for k in range(len(h)) if h[k][0] >= q[i])
if h[k][0] == q[i]:
lotteries.append([(h[k][2], Fraction(1))])
else:
# q[i] lies strictly inside the segment from vertex k - 1 to vertex k
lam = (h[k][0] - q[i]) / (h[k][0] - h[k - 1][0])
lotteries.append([(h[k - 1][2], lam), (h[k][2], 1 - lam)])
return value, lotteries
def offer_order(prices):
"""Return the bidders in decreasing order of price (lower index first on ties), skipping NO_OFFER."""
live = [i for i, p in enumerate(prices) if p is not NO_OFFER]
return sorted(live, key=lambda i: (-prices[i], i))
def run(prices, values):
"""Offer the posted prices in decreasing order. Return (buyer, price), or (None, 0)."""
for i in offer_order(prices): # @line L7
if Fraction(values[i]) >= prices[i]: # @line L8
return i, prices[i]
return None, Fraction(0) # @line L9
def draw_prices(lotteries, rng):
"""Draw one price per bidder from its lottery with a random.Random instance."""
prices = []
for lot in lotteries: # @line L6
u = Fraction(rng.random())
acc = Fraction(0)
chosen = lot[-1][0]
for price, prob in lot:
acc += prob
if u < acc:
chosen = price
break
prices.append(chosen)
return prices
def expected_revenue(dists: Sequence[Dist], lotteries) -> Fraction:
"""Return the exact expected revenue of the sequential posted pricing with these lotteries."""
total = Fraction(0)
for combo in product(*lotteries):
weight = Fraction(1)
for _, prob in combo:
weight *= prob
prices = [price for price, _ in combo]
unsold = Fraction(1)
for i in offer_order(prices):
a = sale_probability(dists[i], prices[i])
total += weight * unsold * a * prices[i]
unsold *= 1 - a
return total
def sequential_posted_pricing(dists: Sequence[Dist], values, rng):
"""Plan, draw the prices and run the mechanism once. Return (buyer, price)."""
_, lotteries = plan(dists)
return run(draw_prices(lotteries, rng), values)
test_sequential_posted_pricing.py 130 lines
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/sequential-posted-pricing/. The authors are listed in prov/MES401.jsonl.
import random
import unittest
from fractions import Fraction as F
from itertools import product
from sequential_posted_pricing import (
NO_OFFER,
draw_prices,
expected_revenue,
hull_vertices,
plan,
run,
sale_probability,
sequential_posted_pricing,
)
IRREGULAR = [(2, F(1, 2)), (3, F(1, 6)), (5, F(1, 3))]
UNIFORM3 = [(1, F(1, 3)), (2, F(1, 3)), (3, F(1, 3))]
def random_dist(rng, k, denom=6):
values = sorted(rng.sample(range(1, 10), 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 ironed(dist):
"""Ironed virtual value of each support value: the hull slope over its quantile interval."""
h = hull_vertices(dist)
out = {}
for v, _ in dist:
q = sale_probability(dist, F(v))
j = next(j for j in range(1, len(h)) if h[j - 1][0] < q <= h[j][0])
out[F(v)] = (h[j][1] - h[j - 1][1]) / (h[j][0] - h[j - 1][0])
return out
def optimal_revenue(dists):
"""Myerson's optimal revenue E[max(0, max_i ironed phi_i(v_i))], by enumeration."""
bars = [ironed(d) for d in dists]
total = F(0)
for combo in product(*dists):
p = F(1)
for _, f in combo:
p *= f
total += p * max([F(0)] + [bars[i][F(v)] for i, (v, _) in enumerate(combo)])
return total
class TestPlan(unittest.TestCase):
def test_hull(self):
self.assertEqual(hull_vertices(IRREGULAR), [(0, 0, NO_OFFER), (F(1, 3), F(5, 3), 5), (1, 2, 2)])
def test_worked_example(self):
value, lotteries = plan([IRREGULAR, IRREGULAR])
self.assertEqual(value, F(7, 2))
self.assertEqual(lotteries, [[(5, F(1, 2)), (2, F(1, 2))], [(5, 1)]])
self.assertEqual(expected_revenue([IRREGULAR, IRREGULAR], lotteries), F(26, 9))
self.assertEqual(optimal_revenue([IRREGULAR, IRREGULAR]), 3)
def test_bound_is_tight_for_equal_prices(self):
dists = [UNIFORM3] * 3
value, lotteries = plan(dists)
self.assertEqual(value, 3)
self.assertEqual(lotteries, [[(3, 1)]] * 3)
self.assertEqual(expected_revenue(dists, lotteries), F(19, 9))
self.assertEqual(F(19, 9) / value, 1 - F(2, 3) ** 3)
def test_lotteries_match_the_relaxation(self):
rng = random.Random(1)
for _ in range(60):
dists = [random_dist(rng, rng.randint(1, 4)) for _ in range(rng.randint(1, 4))]
value, lotteries = plan(dists)
q_total, rev_total = F(0), F(0)
for d, lot in zip(dists, lotteries):
self.assertEqual(sum(p for _, p in lot), 1)
for price, p in lot:
a = sale_probability(d, price)
q_total += p * a
rev_total += p * a * (price if price is not NO_OFFER else 0)
self.assertLessEqual(q_total, 1)
self.assertEqual(rev_total, value)
def test_revenue_bounds(self):
rng = random.Random(2)
for _ in range(60):
n = rng.randint(1, 4)
dists = [random_dist(rng, rng.randint(1, 3)) for _ in range(n)]
value, lotteries = plan(dists)
spm = expected_revenue(dists, lotteries)
opt = optimal_revenue(dists)
self.assertGreaterEqual(value, opt)
self.assertGreaterEqual(opt, spm)
self.assertGreaterEqual(spm, (1 - (1 - F(1, n)) ** n) * value)
class TestRun(unittest.TestCase):
def test_decreasing_order(self):
self.assertEqual(run([F(3), F(5), NO_OFFER], [4, 4, 9]), (0, 3))
self.assertEqual(run([F(3), F(5), NO_OFFER], [4, 6, 9]), (1, 5))
self.assertEqual(run([F(3), F(3)], [3, 3]), (0, 3))
self.assertEqual(run([F(3), F(5)], [2, 4]), (None, 0))
def test_monte_carlo_matches_exact(self):
rng = random.Random(3)
dists = [IRREGULAR, IRREGULAR, UNIFORM3]
value, lotteries = plan(dists)
exact = float(expected_revenue(dists, lotteries))
trials, total = 20000, 0.0
supports = [([v for v, _ in d], [float(p) for _, p in d]) for d in dists]
for _ in range(trials):
values = [rng.choices(s, w)[0] for s, w in supports]
total += float(run(draw_prices(lotteries, rng), values)[1])
self.assertAlmostEqual(total / trials, exact, delta=0.06)
def test_one_shot_and_bad_input(self):
buyer, price = sequential_posted_pricing([IRREGULAR], [5], random.Random(4))
self.assertEqual((buyer, price), (0, 2))
with self.assertRaises(ValueError):
plan([[(1, F(1, 2))]])
with self.assertRaises(ValueError):
plan([[(1, F(1, 2)), (1, F(1, 2))]])
if __name__ == "__main__":
unittest.main()
History
Posted prices are the oldest selling method, and their revenue for one buyer is the starting point of Myerson's theory. Prophet inequalities, whose single-item form goes back to Krengel, Sucheston and Samuel-Cahn, are statements about stopping rules. Chawla, Hartline, Malec and Sivan (2010) used them to bound the revenue of posted prices. They bounded the optimal revenue by the ex ante relaxation, showed that sequential posted prices approximate it within for one item and for uniform and partition matroids and within 2 for general matroids, and used these single-parameter results to design approximately optimal mechanisms for multi-parameter unit-demand buyers. Posted prices have since become a standard tool for simple and approximately optimal mechanism design.
References
- Shuchi Chawla, Jason D. Hartline, David L. Malec and Balasubramanian Sivan, Multi-parameter mechanism design and sequential posted pricing, Proceedings of the 42nd ACM Symposium on Theory of Computing (STOC 2010), 311-320, Lemma 2 (the ex ante upper bound on the optimal revenue), Section 4.2 and Table 1 (the factor e/(e - 1) for uniform and partition matroids, and 2 for general matroids), and the example of two buyers with values uniform on [100, 200] in the introduction
- Tim Roughgarden, Twenty Lectures on Algorithmic Game Theory, Cambridge University Press, 2016, Lecture 6, Simple near-optimal auctions, Sections 6.2 and 6.3 (the prophet inequality and simple single-item auctions built on it)
- Jason D. Hartline, Mechanism Design and Approximation, book draft, version with Chapters 1 to 7 revised in September 2021, https://jasonhartline.com/MDnA/, Chapter 4, Bayesian approximation (the prophet inequality, posted pricings and the ex ante relaxation)
About this page
The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.
| Ladder | Level | What the next level needs |
|---|---|---|
| Human proof | H1 sketch |
|
| Lean | L0 no Lean part |
|
| Code (python) | I0 not checked yet |
|
| Visual | V0 none |
|
| Writing | W2 basic |
|
Tag MES401 Edit this page History Report an error Markdown