J
Class method.
- J(self, t, x, u, N)
Evaluate objective function of the OCP.
The objective function is assembled from the stage cost \(\ell(t,x,u)\) and optional terminal cost \(F(t,x)\) and has the form
\[J(t,x,u,N) = \sum_{k=0}^{N-1} \delta^k \ell(t_k,x(t_k),u(t_k)) + F(t_N,x(t_N)).\]Where \(\delta \in (0,1]\) is a possible discount factor, see
discount
.- Parameters:
t (array) – Times instant at which the stage costs and terminal cost are evaluated.
x (array) – State trajectory at which the stage cost and terminal cost are evaluated.
u (array) – Control sequence at which the stage cost is evaluated.
N (int) – Maximum index up to which the stage cost are summed. During the MPC iteration this index is equivalent to the MPC horizon.
- Returns:
J – Value of the objective function at the given input parameters.
- Return type: