Energy management using genetic algorithms