Lena wants a second-hand cargo bike sold by sealed bids. To her it is worth value dollars (her value: the most she would pay). The other bidders have already sealed their envelopes: their bids are others. Lena is the last to hand in her envelope, so on a tie with the highest other bid, the earlier bidder wins and Lena loses.
Lena considers each bid b in the list bids. With bid b she wins exactly when b > max(others). Her payoff is what the bike is worth to her minus what she pays, and 0 if she loses:
- Second-price rule: the winner pays the highest other bid, so a win pays Lena
value - max(others). - First-price rule: the winner pays their own bid, so a win pays Lena
value - b.
A payoff can be negative: winning at a price above your value is a loss.
Write bid_payoffs(value, others, bids) that returns the tuple (second, first) of two lists: second[k] and first[k] are Lena's payoffs from bidding bids[k] under the second-price and the first-price rule.
Try it with value = 100, others = [70, 85] and bids = list(range(0, 151)), then plot(bids, second, label="second price") and plot(bids, first, label="first price"): which bids earn the most in each chart?
Examples
Input: value = 100, others = [70, 85], bids = [60, 85, 90, 100, 120]
Output: ([0, 0, 15, 15, 15], [0, 0, 10, 0, -20])
Explanation: bids 60 and 85 lose (85 ties with the earlier bidder). Any winning bid pays
100 - 85 = 15 under the second-price rule, but 100 - b under the first-price rule.
Input: value = 50, others = [80], bids = [40, 50, 80, 81, 100]
Output: ([0, 0, 0, -30, -30], [0, 0, 0, -31, -50])
Explanation: to win, Lena must outbid 80, which is more than the bike is worth to her.
Goals
- Compute a bidder's payoff from a bid when the other bids are fixed, under both sealed-bid rules
- See that in a second-price auction no bid ever beats bidding your true value
- See that in a first-price auction bidding your value earns nothing, so bidders shade their bids