Finding the most cost-effective way to generate and distribute electricity while meeting grid constraints.