Can I create two OCP objects in one program?

Hi :wave:

Can I create two OCP objects in one program(MATLAB)?

ocp1 = acados_ocp(ocp_model, ocp_opts);
ocp2 = acados_ocp(ocp_model, ocp_opts);

Because I’m working on multi-agents, each with different initial location, destination, and even constraints, I want to set up multiple OCPs.But when I do this, I get an error

Misused ocp_generate_casadi_ext_fun
Compilation of model functions failed! Please check the compile command above and the flags therein closely. Compile command was:
gcc -O2 -fPIC -shared -IC:\Users\zhanghengde\Desktop\RRT_MPC\demo\MATLAB\acados\acados\examples\acados_matlab_octave\..\..
-IC:\Users\zhanghengde\Desktop\RRT_MPC\demo\MATLAB\acados\acados\examples\acados_matlab_octave\..\..\external\blasfeo\include
C:\Users\zhanghengde\Desktop\RRT_MPC\demo\MATLAB\acados\acados\examples\acados_matlab_octave\getting_started\build\myModel_dyn_expl_ode_fun.c
C:\Users\zhanghengde\Desktop\RRT_MPC\demo\MATLAB\acados\acados\examples\acados_matlab_octave\getting_started\build\myModel_dyn_expl_ode_hess.c
C:\Users\zhanghengde\Desktop\RRT_MPC\demo\MATLAB\acados\acados\examples\acados_matlab_octave\getting_started\build\myModel_dyn_expl_vde_adj.c
C:\Users\zhanghengde\Desktop\RRT_MPC\demo\MATLAB\acados\acados\examples\acados_matlab_octave\getting_started\build\myModel_dyn_expl_vde_forw.c
-o C:\Users\zhanghengde\Desktop\RRT_MPC\demo\MATLAB\acados\acados\examples\acados_matlab_octave\getting_started\build\libmyModel.lib

Does Python have the same problem ?
Thanks :pray:

It should work if you give the solvers different names.

Hi,
You mean the name here?

%% acados ocp model
ocp_model.set('name', model_name);
ocp_model.set('T', T);

Yes, Exactly! :ok_hand: