1. An apparatus for optimizing a hybrid power system with respect to long-term characteristics of said hybrid power system, said apparatus comprising: a real-time controller of said hybrid power system; and a processor cooperating with said real-time controller, said processor being structured to input current measurements of information from said hybrid power system and hybrid dynamics information including continuous dynamics and discrete time dynamics that model said hybrid power system, provide online optimization of said hybrid power system based upon said input, and output a power flow reference and a number of switch controls to said real-time controller based upon said online optimization, wherein said processor is further structured to provide at least one of: real-time forecasts or real-time prediction of future information operatively associated with said hybrid power system as part of said input, and real-time processing of said online optimization.