qpsolvers-eigen icon indicating copy to clipboard operation
qpsolvers-eigen copied to clipboard

Provide solver-agnostic way to set warm_start/MPC friendly setting

Open traversaro opened this issue 1 year ago • 1 comments

After https://github.com/ami-iit/qpsolvers-eigen/pull/15 , if a user is using a solver in a warm start setting, it needs to call the following code:

    // Set osqp-specific parameters
    if (solver.getSolverName() == "osqp")
    {
        // solver.setBooleanParameter("verbose", false);
        solver.setBooleanParameter("warm_starting", true);
    }

    // Set proxqp-specific parameters
    if (solver.getSolverName() == "proxqp")
    {
        solver.setStringParameter("initial_guess", "WARM_START_WITH_PREVIOUS_RESULT");
    }

This is objectively a bit ugly, perhaps we could support plugin-defined setting presets, so we could have something like:

solver.setSettingsPreset("warm_start") 

that under the hood sets the correct parameter in the solver, leaving all the other parameters set to their current values. Having such a flexible method, then the semantics of a given settings preset can be either defined at the qpsolvers-eigen level, or even just for a subset of the solvers plugin.

fyi @LoreMoretti @GiulioRomualdi

I think it could be worth to understand how to integrate this and https://github.com/ami-iit/qpsolvers-eigen/issues/8 .

traversaro avatar Nov 12 '24 12:11 traversaro

Another thing that we may want to abstract in general are common settings such as:

  • Max iterations
  • Absolute primal tolerance
  • Relative primal tolerance

In osqp and proxqp these settings have the same name (max_iter, eps_abs, eps_rel) so this is already working fine, but we should also double check if the definition of the tolerance is consistent.

traversaro avatar Nov 13 '24 12:11 traversaro