Optimal Control Strategy for Hybrid Automata