Optimal Control Strategy for Hybrid System