The mathematical modeling of ecosystems began in the 70s, and brought initially to conclusions which were completely at odds with empirical observations. In fact, while field ecologists were basically sure that biodiversity brings stability in an ecosystem, Robert May showed, using random matrix theory, that this was not the case: a randomly constructed ecosystem (i.e. characterized only by its diversity) becomes unstable if it is populated by a large enough number of species. This gave birth to the so-called “diversity-stability debate”, which still continues to date and still hasn’t brought to a final answer to the question “what is the relationship between the diversity of an ecosystem and its stability?”. Furthermore, the so-called “competitive exclusion principle” (which in turn gave rise to another intense debate) predicts that in a single trophic level the number of coexisting species cannot be greater than the number of resources. There are however many cases where this principle is clearly violated, the most famous one being the so-called “paradox of the plankton”: while the available nutrients for phytoplankton in the oceans are less than a dozen, the number of coexisting phytoplankton species in a single environment can be of the order of several hundreds, even in the periods of the year when nutrients are less abundant. Numerous ecological mechanisms and models have been proposed in order to solve these paradoxes, but none of them is flawless. Recently a possible solution has been proposed: Posfai et al. Introduced a model inspired by the paradox of the plankton, which consists of a system of different species competing for a common pool of nutrients, supplied constantly to the system. The main hypothesis of the model is the “metabolic trade-off” condition: every species has a fixed amount of energy budget to use in order to assimilate the resources. With this assumption it is possible to show that under some simple conditions the system can reach an equilibrium where an arbitrary number of species can coexist. In this thesis, after re-deriving the already known properties of this model, we have obtained many original results, like the study of the rank-abundance curves, a more thorough study of the stability of the equilibrium of the system, and the comparison between this equilibrium and May’s stability criterion. The most exciting result pertains an extension of the model where the metabolic strategies of the species are allowed to evolve in time in order to maximize the fitness of their relative species; in other words we have promoted the species-resource “interactions” to become dynamical variables themselves and whose evolution satisfy a variational principle. We have found that the metabolic strategies evolve cooperatively in order to allow all species to survive even though the initial conditions would have not allowed for their coexistence. This result should open new perspectives in ecosystem modeling and at the same time to new paradigms in statistical mechanics itself.