Online, Time-Varying And Multi-Period Optimization With Applications In Electric Power Systems