In Krivan (2006) bacterial growth on a mixture of two sugars is modeled. It is well know that in mixed substrates with glucose and lactose bacteria often utilize glucose first and then switch to lactose (or to some alternate source of energy). At the molecular level this switch is known as the lac operon. In this article I ask: Is this switch evolutionarily optimized? In other words, do bacteria switch between the resources at the time that maximizes their fitness? To answer this question I build a model of bacterial growth on two substrates. The model assumes adaptive bacterial switching that maximizes bacterial per capita population growth rate – a proxy for bacterial fitness. Using some data from the literature, this model allows me to predict the time at which bacteria should switch. Then I compare this predicted time with observed times of switching for different substrates and different initial sugar concentrations. The observed times of switching show a very good agreement with predicted times. This strongly supports the idea that the molecular mechanism regulating resource switching is evolutionarily optimized. This is also a test of an optimal foraging theory when populations undergo population dynamics. On contrary to the majority of experiments on the optimal foraging theory that do not consider population dynamics of foragers, this model considers all populations dynamics.