Coder Social home page Coder Social logo

isri-aist / qpsolvercollection Goto Github PK

View Code? Open in Web Editor NEW
40.0 6.0 5.0 1.06 MB

Unified C++ interface for quadratic programming solvers

Home Page: https://isri-aist.github.io/QpSolverCollection/

License: BSD 2-Clause "Simplified" License

CMake 13.61% C++ 84.78% Shell 1.61%
quadratic-programming optimization qp cpp ros

qpsolvercollection's Introduction

Unified C++ interface for quadratic programming solvers

CI Documentation

Features

  • Unified C++ interface to many QP solvers
  • Can be built as a standalone package or ROS package
  • High portability decoupled from each QP solver by Pimpl technique

Supported QP solvers

Installation

Installation procedure

It is assumed that ROS is installed.

  1. Install the QP solver you wish to use according to this section. You can skip installing QP solvers that you do not use.

  2. Setup catkin workspace.

$ mkdir -p ~/ros/ws_qp_solver_collection/src
$ cd ~/ros/ws_qp_solver_collection
$ wstool init src
$ wstool set -t src isri-aist/QpSolverCollection [email protected]:isri-aist/QpSolverCollection.git --git -y
$ wstool update -t src
  1. Install dependent packages.
$ source /opt/ros/${ROS_DISTRO}/setup.bash
$ rosdep install -y -r --from-paths src --ignore-src
  1. Build a package.
$ catkin build -DCMAKE_BUILD_TYPE=RelWithDebInfo <qp-solver-flags> --catkin-make-args all tests

See this section for <qp-solver-flags>.

QP solver installation

As all supported QP solvers are installed in CI, please refer to the installation procedure.
Please refer to the license specified in each QP solver when using it.

QLD

Install eigen-qld.
Add -DENABLE_QLD=ON to the catkin build command (i.e., <qp-solver-flags>).

QuadProg

Install eigen-quadprog.
Add -DENABLE_QUADPROG=ON to the catkin build command (i.e., <qp-solver-flags>).

JRLQP

Install master branch of jrl-qp. Add -DENABLE_JRLQP=ON to the catkin build command (i.e., <qp-solver-flags>).

qpOASES

Install master branch of qpOASES with -DBUILD_SHARED_LIBS=ON cmake option.
Add -DENABLE_QPOASES=ON to the catkin build command (i.e., <qp-solver-flags>). Also, add -DQPOASES_INCLUDE_DIR=<path to qpOASES.hpp> and -DQPOASES_LIBRARY_DIR=<path to libqpOASES.so> to the catkin build command.

OSQP

Install master branch of osqp and osqp-eigen.
Add -DENABLE_OSQP=ON to the catkin build command (i.e., <qp-solver-flags>).

NASOQ

Install cmake-install branch of nasoq.
Add -DENABLE_NASOQ=ON to the catkin build command (i.e., <qp-solver-flags>).

HPIPM

Install master branch of blasfeo and hpipm.
Add /opt/blasfeo/lib and /opt/hpipm/lib to the environment variable LD_LIBRARY_PATH.
Add -DENABLE_HPIPM=ON to the catkin build command (i.e., <qp-solver-flags>).

ProxQP

Install main branch of proxsuite.
Add -DENABLE_PROXQP=ON to the catkin build command (i.e., <qp-solver-flags>).

qpmad

Install master branch of qpmad.
Add -DENABLE_QPMAD=ON to the catkin build command (i.e., <qp-solver-flags>).

LSSOL (private)

Install eigen-lssol.
Add -DENABLE_LSSOL=ON to the catkin build command (i.e., <qp-solver-flags>).

How to use

See documentation and test for examples of solving QP problems.

The following is a simple sample.

// sample.cpp

#include <qp_solver_collection/QpSolverCollection.h>

int main()
{
  int dim_var = 2;
  int dim_eq = 1;
  int dim_ineq = 0;
  QpSolverCollection::QpCoeff qp_coeff;
  qp_coeff.setup(dim_var, dim_eq, dim_ineq);
  qp_coeff.obj_mat_ << 2.0, 0.5, 0.5, 1.0;
  qp_coeff.obj_vec_ << 1.0, 1.0;
  qp_coeff.eq_mat_ << 1.0, 1.0;
  qp_coeff.eq_vec_ << 1.0;
  qp_coeff.x_min_.setZero();
  qp_coeff.x_max_.setConstant(1000.0);

  auto qp_solver = QpSolverCollection::allocateQpSolver(QpSolverCollection::QpSolverType::Any);
  Eigen::VectorXd solution = qp_solver->solve(qp_coeff);
  std::cout << "solution: " << solution.transpose() << std::endl;

  return 0;
}

In addition to building a sample in a catkin package, you can also build it standalone as follows.

$ g++ sample.cpp `pkg-config --cflags qp_solver_collection` `pkg-config --libs qp_solver_collection`

qpsolvercollection's People

Contributors

gergondet avatar mmurooka avatar traversaro avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

qpsolvercollection's Issues

Build failure in osqp-eigen

https://github.com/isri-aist/QpSolverCollection/actions/runs/5166259421/jobs/9306237589

...
2023-06-04T00:07:18.4057886Z /home/runner/work/QpSolverCollection/QpSolverCollection/robotology/osqp-eigen/src/Data.cpp:143:84: error: template argument 3 is invalid
2023-06-04T00:07:18.4068722Z /home/runner/work/QpSolverCollection/QpSolverCollection/robotology/osqp-eigen/src/Data.cpp:144:58: error: ‘c_float’ was not declared in this scope; did you mean ‘float’?
2023-06-04T00:07:18.4069258Z   144 |                                 Eigen::Ref<Eigen::Matrix<c_float, Eigen::Dynamic, 1>> upperBound)
2023-06-04T00:07:18.4069575Z       |                                                          ^~~~~~~
2023-06-04T00:07:18.4069827Z       |                                                          float
2023-06-04T00:07:18.4070385Z /home/runner/work/QpSolverCollection/QpSolverCollection/robotology/osqp-eigen/src/Data.cpp:144:83: error: template argument 1 is invalid
2023-06-04T00:07:18.4070848Z   144 |                                 Eigen::Ref<Eigen::Matrix<c_float, Eigen::Dynamic, 1>> upperBound)
2023-06-04T00:07:18.4071165Z       |                                                                                   ^
2023-06-04T00:07:18.4071723Z /home/runner/work/QpSolverCollection/QpSolverCollection/robotology/osqp-eigen/src/Data.cpp:144:84: error: template argument 1 is invalid
2023-06-04T00:07:18.4072184Z   144 |                                 Eigen::Ref<Eigen::Matrix<c_float, Eigen::Dynamic, 1>> upperBound)
2023-06-04T00:07:18.4072712Z       |                                                                                    ^~
2023-06-04T00:07:18.4073271Z /home/runner/work/QpSolverCollection/QpSolverCollection/robotology/osqp-eigen/src/Data.cpp:144:84: error: template argument 3 is invalid
2023-06-04T00:07:18.4489804Z make[2]: *** [CMakeFiles/OsqpEigen.dir/build.make:76: CMakeFiles/OsqpEigen.dir/src/Data.cpp.o] Error 1
2023-06-04T00:07:18.4496198Z make[1]: *** [CMakeFiles/Makefile2:101: CMakeFiles/OsqpEigen.dir/all] Error 2
2023-06-04T00:07:18.4518879Z make: *** [Makefile:136: all] Error 2
2023-06-04T00:07:18.4547986Z ##[error]The process '/usr/local/bin/cmake' failed with exit code 2

Maybe related to robotology/osqp-eigen#131

Option to disable ROS dependency?

Hello @mmurooka, and thanks a lot for your work in this repo, it is quite useful!

I was wondering if you would be open to PR that introduced a CMake option by default off, to permit to compile the library without roscpp and catkin? The option could be call something like QP_SOLVER_COLLECTION_STANDALONE or QP_SOLVER_COLLECTION_WITHOUT_ROS. This would be quite helpful in contexts where a ROS dependency is not desirable, for example because ROS is not available or use of the library in ROS2. If you are ok with this, I would be happy to provide such a PR.

Thanks again in any case.

JRL_QP cmake option makes build error...?

Hello, this is Tsuru.

I am trying to use JRL-QP, especially for differentiable_rmap,
and caught an error when I run catkin build.

Originally, I have been using QLD solver only with -DENABLE_QLD=ON for a long time.
Today, I wanted to try Murooka-sensei's reachability map, so that I enabled " JRL-QP" flag in catkin conf and I met this error.

I can see qp_solver_collection tried to find eigen-lssolConfig.
I thought it may be coming from benchmark comparison, then I tried with -DBUILD_TESTING=OFF -DBUILD_BENCHMARKS=OFF options. Even though, it didn't work...

Does anyone know why it always goes to find eigen lssol?

I will start to look into the codes from this noon by myself, but please let me rise this issue at the beginning.

Thank you in advance.

Screenshot from 2023-01-26 11-40-18

Errors     << qp_solver_collection:check /home/masato/src/catkin_motion6DoF_ws/logs/qp_solver_collection/build.check.1152.log                                                                              
- ENABLE_QLD: ON
- ENABLE_QUADPROG: OFF
- ENABLE_LSSOL: OFF
CMake Error at /usr/share/cmake-3.25/Modules/CMakeFindDependencyMacro.cmake:47 (find_package):
  By not providing "Findeigen-lssol.cmake" in CMAKE_MODULE_PATH this project
  has asked CMake to find a package configuration file provided by
  "eigen-lssol", but CMake did not find one.

  Could not find a package configuration file provided by "eigen-lssol" with
  any of the following names:

    eigen-lssolConfig.cmake
    eigen-lssol-config.cmake

  Add the installation prefix of "eigen-lssol" to CMAKE_PREFIX_PATH or set
  "eigen-lssol_DIR" to a directory containing one of the above files.  If
  "eigen-lssol" provides a separate development package or SDK, be sure it
  has been installed.
Call Stack (most recent call first):
  /home/masato/openrtp/lib/cmake/jrl-qp/jrl-qpConfig.cmake:109 (find_dependency)
  CMakeLists.txt:34 (find_package)
  CMakeLists.txt:50 (add_qp_solver)


make: *** [cmake_check_build_system] Error 1
cd /home/masato/src/catkin_motion6DoF_ws/build/qp_solver_collection; catkin build --get-env qp_solver_collection | catkin env -si  /usr/bin/make cmake_check_build_system; cd -

Two apt packages

There are two apt packages, libqpsolvercollection-dev and qpsolvercollection. Is this correct? For the other packages (nmpc, centroidalcontrolcollection) there is only one apt package for each.

root@f2827b5e3e34:~# aptitude search qpsolvercollection
i A libqpsolvercollection-dev                                                   - Unified C++ interface for quadratic programming solvers
p   qpsolvercollection                                                          - Unified C++ interface for quadratic programming solvers
root@f2827b5e3e34:~# aptitude search nmpc
i A libnmpc-dev                                                                 - Non-linear model predictive control (NMPC) library
root@f2827b5e3e34:~# aptitude search centroidal
i   libcentroidalcontrolcollection-dev

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.