GithubHelp home page GithubHelp logo

liuq / quadprogpp Goto Github PK

View Code? Open in Web Editor NEW
271.0 9.0 85.0 46 KB

A C++ library for Quadratic Programming which implements the Goldfarb-Idnani active-set dual method.

License: MIT License

CMake 1.15% C++ 98.85%

quadprogpp's Introduction

QuadProg++

A C++ library for Quadratic Programming which implements the Goldfarb-Idnani active-set dual method.

At present it is limited to the solution of strictly convex quadratic programs.

Previous versions of the project were hosted on sourceforge.

Install

To build the library simply go through the cmake .; make; make install cycle.

In order to use it, you will be required to include in your code file the Array.hh header, which contains a handy C++ implementation of Vectors and Matrices.

Contribution

Contributions and bug fixes are welcome.

Copyright (C) 2007-2016 Luca Di Gaspero, MIT License.

References

D. Goldfarb, A. Idnani. A numerically stable dual method for solving strictly convex quadratic programs. Mathematical Programming 27 (1983) pp. 1-33.

quadprogpp's People

Contributors

esquires avatar harrysummer avatar hlindberg avatar huelj avatar liuq avatar yuki-koyama 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  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  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  avatar  avatar  avatar

quadprogpp's Issues

Optimal Solution Found Exit

Seldom coming across ss >= 0.0 's exit judgement is not satisfied.
And ss is about -e-13 about. and could not converge anymore.
For anyone who has strucked in the loop for that, Change ss >= threshould (any number can satisfy your need, like -1e-6) would work.

function call issue

Everything works fine but when trying to call solve_quadprog(with the arguments) an error pops up “unidentified reference to...”, even in the example code uploaded. Any solution for this?

Using QuadProgpp with Eigen?

Hi!

I'm hoping to use this solver with matrix algebra through the Eigen library. Has anyone given any thought to doing something like this (using an alternate matrix algebra library)?

Do you foresee any problems with doing this by replacing references to vectors/matrices with the Eigen defs?

How does this solver perform on large sparse problems?

I'm interested in solving trajectory optimization problems. In general, these problems are reduced to large sparse constrained optimization problems. Question: How does your code perform on large sparse problems? The problems that I'm interested in have:

  • x is of length 50 - 300 (decision variables)
  • g0 is [0]
  • G is diagonal (least squares)
  • CE has a maximum of 2-4 non-zero elements per row (collocation constraints)
  • CI has a maximum of 1 non-zero element per row (limits on decision variables)
min 0.5 * x G x + g0 x
s.t.
    CE^T x + ce0 = 0
    CI^T x + ci0 >= 0

Please make the default build type "Release"

Please add following lines to CMakeLists.txt.

if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
  set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build type (default Release)" FORCE)
endif()

error in cholesky decomposition

A:
317.581, -1111.92, 1335.92, -559.314, 2.60613, -0.871816, 0.158151, 15.8451,
-1111.92, 186.374, -559.36, 464.094, 4.41254, -1.00695, -189.075, 94.5768,
1335.92, -559.36, 146.708, -366.74, 4.43254, 720.777, -721.521, 216.315,
-559.314, 464.094, -366.74, 209.297, -839.967, 1263.82, -844.813, 211.691,
2.60613, 4.41254, 4.43254, -839.967, 3.18509, -7.06707, 5.73606, -1.61993,
-0.871816, -1.00695, 720.777, 1263.82, -7.06707, 4.86313e-05, -6.33977e-05, 1.81698e-05,
0.158151, -189.075, -721.521, -844.813, 5.73606, -6.33977e-05, 1.49813e-05, -1.12109e-06,
15.8451, 94.5768, 216.315, 211.691, -1.61993, 1.81698e-05, -1.12109e-06, 100804
terminate called after throwing an instance of 'std::logic_error'
what(): Error in cholesky decomposition, sum: -1.80194e-11

Process finished with exit code 134 (interrupted by signal 6: SIGABRT)

i need help

I want to know the meaning of each argument passed in the solve_quadprog function. Especially with matlab in X = quadprog (H, f, A, b, Aeq, beq, LB, UB, X0, OPTIONS) for comparison

apt package

Could you make this great repository an apt package? This would make it much easier to use for Linux users.

getting wrong result

some times i get the wrong result with quadprog++.
to be specific, the result doesn't satisfy the inequality constraints.

through debug, i found that the reason may be as bellows:
the checking code(line 246-250):

if (fabs(psi) <= m * std::numeric_limits::epsilon() * c1 * c2* 100.0)
{
/* numerically there are not infeasibilities anymore */
return f_value;
}

when I got a matrix G whose c1c2 is very large, after add equality constraints, first run to the checking code, psi = -70, as c1c2 is very large, it directly returns the f_value. but the result doesn't satisfy the inequality constraints.

My question is why use "m * std::numeric_limits::epsilon() * c1 * c2* 100.0" as the threshold, instead of "m * std::numeric_limits::epsilon()".
In fact, we just want to check whether CI[i]*X < 0 or not.

i add my data here, in case you want to debug it.
input data.zip

is this library supports multithreading?

I'm trying to solve multiple qp problems at same time (using openmp and quadprogpp),

when trying to solve 4 qp problems at same time,
one (first initiailized) problem solves perfectly,
but other's are not

  • fval is 0(solve_quadprog's return value)
  • fval is exploding

(sometimes it solve two qp. but no more)

so My question is,
quadprog is not support multithread?

The operator "*" of matrix is not correct, in Array.h

i'm confusing about the following code.
"template
Matrix operator*(const Matrix& lhs, const Matrix& rhs)
{
if (lhs.ncols() != rhs.ncols() || lhs.nrows() != rhs.nrows())
throw std::logic_error("Operator*: matrices have different sizes");
Matrix tmp(lhs.nrows(), lhs.ncols());
for (unsigned int i = 0; i < lhs.nrows(); i++)
for (unsigned int j = 0; j < lhs.ncols(); j++)
tmp[i][j] = lhs[i][j] * rhs[i][j];

return tmp;
}"
The operator "*" of matrix is not correct.

code stuck in loop

Hello, I am using your code to solve a big problem of which matrix size is more than 20. Could you let me know where I have to modify the macro in your file? can you explain how to change the matrix size in detail?
Also, I iteratively solve the QP multiple times on my code. Suddenly it seems that QP code stuck in the loop without any response. Have you experienced this issue on your side? Do you have any suspicious problems regarding this issue?

wrong value and Cholesky decomposition

I did some tests about the solver and found out that the accuracy of the solution is low .What is more, because of Cholesky decomposition, a lot of quadprog problem can not be solved. Maybe it is only useful for symmetrical positive determined matrix problem.

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.