Change solver parameters

Hi,

I am using the matlab interface.

In this software, once I have generated the c code of the solver, if I want to change parameters such as the weight matrices or the prediction horizon in order to tune the MPC, do I have to change it from the high-level interface and generate c code again?

I think It would take a long time to tune the controller if every time I change something I have to re-regenerate c code.

Thanks in advance!!!

Hi @Antonio,

in Matlab, you can interact with the template based OCP solver, just like you can with the native one.
I.e. using the .set, .get routines.
A lot can be changed after generating the code and creating the solver. For the setter, see e.g. here:

However, some things (mainly dimensions and the choice of modules) cannot be changed after the creation of the solver, since they are needed in the memory allocation process.

Best,
Jonathan

Once I’ve generated C code, I suppose the number nodes of the prediction horizon can’t be change, but the sampling time of the nodes can be change using this function.

Am I right?
Thanks in advance

Yes, the dimensions can’t be changed after creating the solver.
In principle it is possible to change the time steps after creating the solver, but this is not tested really and I know that it won’t work properly for the GNSF-IRK integrator.
In principle it should work for the other modules though.

Cheers!