Error in Function::call for ‘LUT’ [BSplineInterpolant] at …/casadi/core/function.cpp:370:
…/casadi/core/function_internal.cpp:2024: ‘eval_sx’ not defined for BSplineInterpolant
After searching for a bit I realized that casadi.interpolation only support MX variables. So I tried to rewrite my problem formulation using MX variables, but this seems to be a problem for ACADOS:
constraint detection only works for casadi.SX!
The two solution that I come up with are, first, to approximate the look-up talbe using a polynomial, but this leads to a non ideal solution and second, to manuale code a linear interpolation routine. This works, but then I always get a solver status == 2, when simulation the MPC.
Does anyone know of a better solution for the descriped problem?
no need to approximate the look-up table. Just use MX symbolics and set the constraint type to 'BGH' explicitly (The defualt type is 'AUTO' which results in acados trying to detect the constraint type. This only works for SX atm)
Maybe simply increasing nlp_solver_max_iter might fix it
As a first step you should check the residuals with solver.print_statistics() to check whether it’s the dynamics or inequality constraints that cause the problem.
Sorry, I should have mentioned in my previous post that increasing ocp.solver_options.nlp_solver_max_iter does not help, only the calculation time increases but solver status = 2 remains.
Currently I just use the generated s-function for simulation, but I will try to build a script-based simulation and check the solver statistics.
it could also be that full step SQP does not converge for your problem. In that case, you could try to use the new Funnel globalization which is available in acados. For an example on how to use it, you can consult:
Additionally, I would set the option ocp.solver_options.globalization_full_step_dual = true;
Looking at the statistics table always helps, you can also show the statistics, if you set ocp.solver_options.print_level = 1;
this is an example of printed solver stats for solver status = 2. I am not quite sure how to interpret these information and how it helps me to debug my solver.
thanks for sending the a log. Unfortunately, it is not very insightful for me at the moment. Could you share your code, then I can try to figure out a solution.
I have two ideas that you could try out and a question:
What Hessian matrix are you using? If you use the exact Hessian, you should use some kind of regularization. Here I recommend to use solver_options.regularize_method = 'MIRROR'
Use the funnel globalization: This means use the following options solver_options.nlp_solver_type = 'SQP' solver_options.globalization = 'FUNNEL_L1PEN_LINESEARCH' solver_options.globalization_full_step_dual = True solver_options.print_level = 1
Can you post the output here for the funnel method?
The res_ineq is always zero. Does this mean that you do not have constraints? If the only constraints are your dynamics, you could use DDP as solver. This can be done using the following options: ocp.solver_options.nlp_solver_type = 'DDP' ocp.solver_options.globalization = 'MERIT_BACKTRACKING'
I hope this helps. If it does not work, I would appreciate sending a minimal example such that I could try by myself to resolve your issue.
Adding to David’s suggestions, I recommend to solve the QP subproblems more accurately than the NLP, i.e. set the values of qp_solver_tol_stat to nlp_solver_tol_stat/10. and similarly for the equality, inequality and complementarity tolerances.
The inequality and complementarity residuals look indeed a bit weird. While the inequality constraints seem to be satisfied from the beginning, the complementarity residual is not really converging. What kind of inequalities did you impose? Are they active at the solution that you obtain?
I think you need to update acados. On current master, your example works also with funnel globalization (still running into maximum iterations though…)
Is there anything special about your model? The equality constraints are not converging. Did you try to simulate the system using an acados integrator separately?