A principle of evolutionary adaptation is applied to the Lotka-Volterra models, in particular to the food webs. We present a relatively simple computational algorithm of optimization with respect to a given criterion. This algorithm boils down to a sequence of easy to solve linear programming problems. As a criterion for the optimization we use the total weighted population size of the given community and an ecological fitness, which is an analogue of the potential energy in physics. We show by computational experiments that it is almost always possible to substantially increase the total weighed population size for an especially simple food web -food chain; we also show that food chains are evolutionary unstable under the given optimization criteria and, if allowed, evolve into more complicated structures of food webs.