Stochastic Hybrid Systems for Control Learning and Optimization