Mathematical Optimization for Efficient and Robust Energy Networks