1. A method of controlling a water heater, comprising: evaluating the fitness of solutions associated with a plurality of individuals in a population for a current operating environment of the water heater, each of the plurality of individuals comprising a dominant genotype and a recessive genotype, wherein each of the genotypes represents a solution for controlling the water heater, wherein a fitness function is applied to the dominant genotype of each individual, wherein the fitness function is based on at least one of water flow demand data and energy price data; storing previously encountered genotypes in the recessive genotypes of the individuals; and selecting a solution for controlling operation of the water heater based on the fitness evaluation.