Text this: Mathematical Optimization Applied to Thermal and Electrical Energy Systems