Hi,
I need to define a terminal cost that depends on the entire predicted state trajectory (x_0, x_1, …, x_N)
simultaneously.
For example: nx = 3, N = 5 I would like something like: x_seq = ca.MX.sym(“x_seq”, nx*(N+1))
cost = my_function(x_seq)
ocp.model.cost_expr_ext_cost_e = cost
But as far as I understood the x symbol in
ocp.model always represents only the local state at a single stage, and there is no symbolic access
to the whole sequence inside the optimization problem. If someone had a similar problem and has some advice it’d be very much appreciated. Thank you in advance.
Best regards,
Jamila
Hi,
this is not possible in acados as it does not fit the OCP structured problem formulation that we are solving.
To fit into the OCP structure you need to decouple your cost function into a summation of terms that only depend on local state and control variables.
Best,
Jonathan