Title: Thermodynamic Optimization of Complex Energy Systems