There is controversy about what fitness measure to maximize in life-history models: the Malthusian parameter r; or net reproductive rate R, which is equivalent to lifetime production of offspring. Neither of these can be considered universal: R is a proper measure only at population equilibrium, and r cannot remain positive and constant for long. If we wish to make quantitative predictions of life-history parameters, density dependence should be incorporated directly into the model. The paper gives numerical examples of optimal allocation of energy to growth and reproduction. For annual plants, the density dependence of seed or seedling mortality does not affect age and size at maturity. This means that the same clone is optimal under low and high densities. But the density dependence or biomass dependence of the production rate does affect age and size at maturity. Although clones adapted to low density can achieve ecological equilibrium, they can be invaded by any clone better adapted to crowding. Such invasions can be repeated until the ESS (evolutionarily stable strategy) clone invades and outcompetes other clones. This last state can be called ''evolutionary equilibrium'' as opposed to the ''ecological equilibrium'' that can be achieved by any clone. Invasion of a population of annuals by biennials is unlikely at low density when generation time is crucial. But biennials can invade a population of annuals at equilibrium if a rare biennial surrounded by annuals has R at least slightly greater than one. The paper discusses why the concept of r- and K-selection is vague, and how it can be translated to optimal allocation models.