Optimize energy generation