Text this: Optimal control of controllable switched systems