Hello all,

I am a new user of the library, trying to solve an MPC problem for a multi-agent system through acados’ Matlab interface. My lagrange objective term is the sum of nonlinear terms like this: f_1(x(t))^2+f_2(x(t))^2+f_3(x(t))^2.

First of all, is there any example about the use of the ‘nonlinear_ls’ cost type? Also, any reference for when and how to prefer ‘cost_expr_y’?

I have tried to implement my problem by adding the nonlinear terms to the ‘cost_expr_y’ vector, with zero reference ‘cost_yr’. I am using ‘nonlinear_ls’ as cost type. The C code is generated successfully. However, the result is not as expected and in ‘ocp.model_struct.cost_expr_y’ I do not find the same function I assigned to ‘cost_expr_y’: sums and multiplications seem to be messed up and some ‘sq’ appear. Any clue of why this happens? Does ‘sq’ stands for ‘sqrt’?

Many thanks,

Enrica