Optimal control of hybrid systems using statistical learning