Event-driven optimal control of integral continuous-time hybrid automata