  The paper describes a continuous second-variation algorithm to solve optimal
control problems where the control is defined on a closed set. A second order
expansion of a Lagrangian provides linear updates of the control to construct a
locally feedback optimal control of the problem. Since the process involves a
backward and a forward stage, which require storing trajectories, a method has
been devised to accurately store continuous solutions of ordinary differential
equations. Thanks to the continuous approach, the method adapts implicitly the
numerical time mesh. The novel method is demonstrated on bang-bang optimal
control problems, showing the suitability of the method to identify
automatically optimal switching points in the control.
