Essentials of optimal control