  In this paper, we consider the problem of a Principal aiming at designing a
reward function for a population of heterogeneous agents. We construct an
incentive based on the ranking of the agents, so that a competition among the
latter is initiated. We place ourselves in the limit setting of mean-field type
interactions and prove the existence and uniqueness of the equilibrium
distribution for a given reward, for which we can find an explicit
representation. Focusing first on the homogeneous setting, we characterize the
optimal reward function using a convex reformulation of the problem and provide
an interpretation of its behaviour. We then show that this characterization
still holds for a sub-class of heterogeneous populations. For the general case,
we propose a convergent numerical method which fully exploits the
characterization of the mean-field equilibrium. We develop a case study related
to the French market of Energy Saving Certificates based on the use of
realistic data, which shows that the ranking system allows to achieve the
sobriety target imposed by the European commission.
