Unified Model for Synthesis and Optimization of Discrete Event and Hybrid Systems