Dense QP with an S-function in acados

Hello :wave:

I need to implement a Linear-time varying (LTV) MPC in Simulink, Windows, this leads to a quadratic optimization in the form 0.5*x'*H*x+f'*x subject to A*x<=b. I compute by myself the matrices, therefore, I would like to write a Simulink S-function which solves a dense quadratic problem as in hpipm/guide.pdf at master 路 giaf/hpipm 路 GitHub, such that the S-function can receive as input the matrices and provide as output the optimized variables.

Further, the controller will be implemented in MicroAutoBox on a dSPACE RCP Platform.

I went though all the Matlab examples but the dense QP structure is not used, so I would like to ask if this idea is feasible.
Besides, in case I embrace totally the acados_ocp structure as in the examples, is it possible to provide at each sampling time the linearized matrices around the optimal trajectory at the previous sample time and exploit them to avoid the nonlinear optimization? I have real-time constraints and I cannot afford a nonlinear optimization.

Thanks for your help,

Hi Gianmarco,

indeed there is no Simulink / Matlab interface for the dense QP solver in acados.
Only the OCP-NLP solver and the integrator have such interfaces.
I think you have the following options:

  1. use the OCP-NLP interface and formulate the problem in this form. It is definitely possible, using parameters.
  2. contribute a dense QP solver interface to acados. This would of course be welcome.
  3. Use / extend the HPIPM Simulink interface, see:
    Note: this is for OCP-QP and only viable if you want to use the HPIPM solver.