We use the Minority Game and some of its variants to show how efficiency depends on learning in models of agents competing for limited resources. Exact results from statistical physics give a clear understanding of the phenomenology, and opens the way to the study of reverse problems. What agents can optimize and how well is discussed in details.1 Evolutionary models (see for instance [2,5,6,7]) are very different in nature, and are not reviewed here, mostly because they are not exactly solvable.