Numerical direct methods for optimal control problems usually first discretize the controller u(t) piecewise from t_0 to t_f. Then the optimal control problem has been cast into the nonlinear programming problem. After that, various optimization approaches can be employed to solve such an optimization problem. But this is usually based on the terminal time t_f is fixed. So if t_f is not fixed, how to discretize u(t)? For intuition, a situation can be the missile-target engagement problem where we do not know when the interceptor will happen.