Numerical methods for solving terminal optimal control problems