Theory and Applications of Bang-Bang and Singular Control Problems