Neural Network as Terminal Cost

Hi Katrin,

Thank you for the clarification and advice. If I were to expand on your first solution which is more straightforward.

Let’s say I have an example terminal cost which I am trying to imitate through supervised learning/imitation learning. I will refer to the ground truth terminal cost as Creal, and its associated state x. Therefore, since acados will take the output of my network and perform 0.5 * squared L2 norm, I would then need to perform the inverse on Creal to √(2 Creal), such that the final terminal cost will be the same assuming the training is perfect? Am I correct to say this?

And code wise:

ocp.cost.cost_type_e = 'NONLINEAR_LS'   # Terminal cost
ocp.model.cost_y_expr_e = y_sym
ocp.solver_options.hessian_approx = 'GAUSS_NEWTON'

Thanks
Nico