# Bayesian-optimal mechanism

A Bayesian-optimal mechanism (BOM) is a mechanism in which the designer does not know the valuations of the agents for whom the mechanism is designed, but the designer knows that they are random variables and knows the probability distribution of these variables.
A typical application is a seller who wants to sell some items to potential buyers. The seller wants to price the items in a way that will maximize their profit. The optimal prices depend on the amount that each buyer is willing to pay for each item. The seller does not know these amounts, but assumes that they are drawn from a certain known probability distribution. The phrase "Bayesian optimal mechanism design" has the following meaning:$^{:335–338}$
* Bayesian means that we know the probability distribution from which the agents' valuations are drawn (in contrast to prior-free mechanism design, which do not assume any prior probability distribution).
* Optimal means that we want to maximize the expected revenue of the auctioneer, where the expectation is over the randomness in the agents' valuations.
* Mechanism means that we want to design rules that define a truthful mechanism, in which each agent has an incentive to report their true value.

## Example

There is one item for sale. There are two potential buyers. The valuation of each buyer is drawn i.i.d. from the uniform distribution on [0,1].
The Vickrey auction is a truthful mechanism and its expected profit, in this case, is 1/3 (the first-price sealed-bid auction is a non-truthful mechanism and its expected profit is the same).
This auction is not optimal. It is possible to get a better profit by setting a reservation price. The Vickrey auction with a reservation price of 1/2 achieves an expected profit of 5/12, which in this case is optimal.

## Notation

We assume that the agents have single-parameter utility functions, such as a single-item auction. Each agent $i$ has a value $v_{i}$ which represents the agent's "winning value" (e.g, the agent's valuation of the item). We do not know these values, but we do know that each $v_{i}$ is drawn i.i.d. from a certain probability distribution. We denote by $F_{i}$ the cumulative distribution function:
    $F_{i}(z)=\Pr[v_{i}<z]$
and by $f_{i}$ the probability distribution function:
    $f_{i}(z)=F_{i}'(z)$
An allocation is a vector $x$, such that for every $i$, $x_{i}$ is 1 if agent $i$ wins and 0 otherwise. Each allocation might have a cost to the auctioneer, $c(x)$.
The surplus of an allocation is defined as:
    $S(x)=\sum _{i}x_{i}\cdot v_{i}-c(x)$
This is the total gain of the agents, minus the cost of the auctioneer.
The surplus is the largest possible profit. If each winning agent $i$ pays exactly their value $v_{i}$, then the profit of the auctioneer is exactly the surplus $S(x)$; this means that the auctioneer takes all the surplus to themself and leaves zero utility to the agents.
This maximal profit cannot be attained because if the auctioneer will try to charge each winning agent their value $v_{i}$, the agents will lie and report a lower value in order to pay less. The Myerson mechanism comes to address this problem.

## The Myerson mechanism

Roger Myerson designed a Bayesian-optimal mechanism for single-parameter utility agents. The key trick in Myerson's mechanism is to use virtual valuations. For every agent $i$, define its virtual valuation as:
    $w_{i}(v_{i})=v_{i}-{\frac {1-F_{i}(v_{i})}{f_{i}(v_{i})}}$
Note that the virtual valuation is usually smaller than the actual valuation. It is even possible that the virtual valuation be negative while the actual valuation is positive.
Define the virtual surplus of an allocation $x$ as:
    $S^{*}(x)=\sum _{i}x_{i}\cdot w_{i}(v_{i})-c(x)$
Note that the virtual surplus is usually smaller than the actual surplus.
A key theorem of Myerson says that:$^{:336}$
          The expected profit of any truthful mechanism is equal to its expected virtual surplus.
(the expectation is taken over the randomness in the agents' valuations).
This theorem suggests the following mechanism:
* Ask each agent $i$ to report their valuation $v_{i}$
* Based on the answer and the known distribution functions $F_{i},f_{i}$, compute $w_{i}$.
* Compute an allocation x that maximizes the virtual surplus $S^{*}(x)$.
To complete the description of the mechanism, we should specify the price that each winning agent has to pay. One way to calculate the price is to use the VCG mechanism on the virtual valuations $w_{i}$. The VCG mechanism returns both an allocation that maximizes the virtual surplus and a price-vector. Since the price-vector corresponds to the virtual-valuations, we must convert it back to the real-valuation space. So the final step of the mechanism is:
* Take from each winning agent $i$ the price $p_{i}=w_{i}^{-1}(p'_{i})$, where $p'_{i}$ is the price determined by the VCG mechanism.

### Truthfulness

The Myerson mechanism is truthful whenever the allocation rule satisfies the weak monotonicity property, i.e, the allocation function is weakly increasing in the agents' valuations. The VCG allocation rule is indeed weakly-increasing in the valuations, but we use it with the virtual-valuations rather than the real valuations. Hence, the Myerson mechanism is truthful if the virtual-valuations are weakly-increasing in the real valuations. I.e, if for all $i$: $w_{i}$ is a weakly-increasing function of $v_{i}$.
If $w_{i}$ is not a weakly-increasing function of $v_{i}$, then Myerson ironing can be used.
Myerson's mechanism can be applied in various settings. Two examples are presented below.

### Single-item auction

Suppose we want to sell a single item, and we know that the valuations of all agents come from the same probability distribution, with functions $F,f$. Then, all bidders have the same virtual-valuation function, $w$. Suppose that this function is weakly-increasing. In this case, the VCG mechanism reduces to the Vickrey auction: it allocates the item to the agent with the largest valuation (highest bid). But Myerson's mechanism uses VCG with the virtual valuations, which may be negative. Hence, Myerson's mechanism, in this case, reduces to Vickrey auction with reservation price. It allocates the item to the agent with the largest valuation, but only if its virtual valuation is at least 0. This means that the reservation price of Myerson's mechanism is exactly:
    $w^{-1}(0)$
So, if we know the probability distribution functions $F,f$, we can calculate the function $w$, and from it, find the optimal reservation price.

### Digital-goods auction

In a digital goods auction, we have an unlimited supply of identical items. Each agent wants at most one item. The valuations of the agents to the item come from the same probability distribution, with functions $F,f$ and virtual-valuation function $w$. The VCG mechanism allocates an item to each agent with non-negative virtual-valuation, and charges the minimum winning price, which is:
    $w^{-1}(0)$
This exactly equals the optimal sale price - the price that maximizes the expected value of the seller's profit, given the distribution of valuations:
    $\arg \max _{z}{z\cdot (1-F(z))}$

## Alternatives

Bayesian-optimal mechanism design requires knowing the distributions from which agents' valuations are drawn. This requirement is not always feasible. There are some other alternatives:
* When the distribution is not known, a prior-independent mechanism can be used.
* When it cannot even be assumed that the agents are drawn from some probability distribution, a prior-free mechanism should be used.