Optimization Methods for Gas and Power Markets