This document list the changes that you need to do to migrate from osqp-eigen
to qpsolvers-eigen
.
Change any instance of find_package(OsqpEigen)
to find_package(QpSolversEigen)
and any instance of OsqpEigen::OsqpEigen
to QpSolversEigen::QpSolversEigen
.
Remove any line that include OsqpEigen headers:
#include <OsqpEigen/...>
and instead include:
#include <QpSolversEigen/QpSolversEigen.hpp>
With osqp-eigen, the solver was instantiated as:
OsqpEigen::Solver solver;
while for qpsolvers-eigen you need to instantiate the solver with:
QpSolversEigen::Solver solver;
// Change "osqp" to any solver you want to use
solver.instantiateSolver("osqp");
All calls to methods like:
solver.data()->setHessianMatrix(hessian)
solver.data()->setGradient(gradient)
Need to be changed by removing data()->
, i.e. converted to:
solver.setHessianMatrix(hessian)
solver.setGradient(gradient)
As QpSolversEigen
has a generic solver-agnostic interface, to set parameters you need to specify the parameter to set by name, so you need to port code such as:
solver.settings()->setVerbosity(true);
solver.settings()->setAlpha(1.0);
to
// verbose is an option common to all
solver.setBooleanParameter("verbose", false);
// alpha is a osqp specific parameter, so we only set if the solver used is indeed osqp
if (solver.getSolverName() == "osqp")
{
REQUIRE(solver.setRealNumberParameter("alpha", 1.0));
}
Change any instance of OsqpEigen::INFTY
to QpSolversEigen::INFTY
, OsqpEigen::Status
to QpSolversEigen::Status
and OsqpEigen::ErrorExitFlag
to QpSolversEigen::ErrorExitFlag
.