casadi / casadi

CasADi is a symbolic framework for numeric optimization implementing automatic differentiation in forward and reverse modes on sparse matrix-valued computational graphs. It supports self-contained C-code generation and interfaces state-of-the-art codes such as SUNDIALS, IPOPT etc. It can be used from C++, Python or Matlab/Octave.
http://casadi.org
GNU Lesser General Public License v3.0
1.58k stars 357 forks source link

ipopt warm start #3666

Open fp018 opened 1 month ago

fp018 commented 1 month ago

Hi! I am using CASADi and ipopt to solve an NMPC in matlab, how can I correctly warm start the ipopt solver? I am currently setting

opts.ipopt.hessian_approximation = 'limited-memory'; opts.ipopt.warm_start_init_point = 'yes'; opts.ipopt.warm_start_same_structure = 'yes'; opts.ipopt.mu_strategy = 'adaptive'; and:

sol = solver('x0', w0, 'lbx', lbw, 'ubx', ubw,...
                'lbg', lbg, 'ubg', ubg,'p', p, 'lam_g0',sol.lam_g,'lam_x0', sol.lam_x);

With the _samestructure option to "no" it works but seems quite slow , if I set it to "yes" it does not work anymore and it gives me the error "augmented system is not initialized". Any suggestions on how to fix it, or to speed up the solution?

Thanks a lot!