Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a quadratic programming library in C++? [closed]

The only Google search result I found is QuadProg++ but it can not solve the quadratic programming problem whose matrix is not applicable for Cholesky decomposition.

So can anyone give me some suggestion on other library? Thanks.

like image 763
Daniel Gao Avatar asked Nov 06 '11 07:11

Daniel Gao


People also ask

How does quadratic programming problem differ from the linear programming problem?

Quadratic Programming (QP) Problems A widely used QP problem is the Markowitz mean-variance portfolio optimization problem, where the quadratic objective is the portfolio variance (sum of the variances and covariances of individual securities), and the linear constraints specify a lower bound for portfolio return.

Which method belongs to quadratic programming?

augmented Lagrangian, conjugate gradient, gradient projection, extensions of the simplex algorithm.

Who invented quadratic programming?

3,4 The problem was first explored in the early 1950s, most notably by Princeton University's Wolfe and Frank, who developed its theoretical background,1 and by Markowitz, who applied it to portfolio optimization, a subfield of finance.

What is MIQP?

Mixed-integer quadratic programming (MIQP) is the problem of optimizing a quadratic function over points in a polyhedral set where some of the components are restricted to be integral.


2 Answers

CGAL looks great for quadratic programming. There is even a manual.

  // by default, we have a nonnegative QP with Ax <= b
  Program qp (CGAL::SMALLER, true, 0, false, 0); 

  // now set the non-default entries: 
  const int X = 0; 
  const int Y = 1;
  qp.set_a(X, 0,  1); qp.set_a(Y, 0, 1); qp.set_b(0, 7);  //  x + y  <= 7
  qp.set_a(X, 1, -1); qp.set_a(Y, 1, 2); qp.set_b(1, 4);  // -x + 2y <= 4
  qp.set_u(Y, true, 4);                                   //       y <= 4
  qp.set_d(X, X, 2); qp.set_d (Y, Y, 8); // !!specify 2D!!    x^2 + 4 y^2
  qp.set_c(Y, -32);                                       // -32y
  qp.set_c0(64);                                          // +64

  // solve the program, using ET as the exact type
  Solution s = CGAL::solve_quadratic_program(qp, ET());
  assert (s.solves_quadratic_program(qp));

Code from the first example.

like image 200
Wok Avatar answered Oct 06 '22 00:10

Wok


LAPACK has a number of Cholesky decomposition routines (they call it Cholesky factorization). There are C++ wrappers available for LAPACK (see this SO question for a list).

The answer from Anycom in that post is a bit cryptic, but he meant that there are LAPACK bindings that can be used together with Boost's linear algebra library, uBLAS.


I've found this library: OOQP (Object-Oriented Software for Quadratic Programming). If you scroll down that page, you'll find a research paper and a user guide. There seems to be a C++ API for that library. Hope this helps.

like image 30
Emile Cormier Avatar answered Oct 06 '22 01:10

Emile Cormier