Mathematical methods of optimal control