0

I am looking for a definitive guide on formulating a CVXOPT quadratic programming problem with quadratic constraints. There are good documents provided here:

The problem statement I am dealing with is identical to the problem here:

enter image description here

What is the matrix G supposed to look like? I've formulated as a system of linear equations, but looking at examples this does not appear to be correct?

The best resource I've found is https://courses.csail.mit.edu/6.867/wiki/images/a/a7/Qp-cvxopt.pdf, but the links at the end are dead for more reading.

I have an ipython notebook trying to use this programming method but it continually fails: https://gist.github.com/jaredvacanti/62010beda0ccfc20d2eac3c900858e50

Edit: I have edited the data source file in the notebook to provide access to the real data used in this optimization problem.

Jared
  • 3,651
  • 11
  • 39
  • 64
  • The first link tells you what G should look like. What's exactly the problem? Also: if you have no experience with cvxopt and you don't need the option for customized solving (one of the advantages of cvxopt), then use cvxpy, which is much much easier to use (high-level approach). – sascha Apr 25 '17 at 21:06
  • When I provide P, q, A, and b to the solver I get an optimal solution that is similar to the sample data I'm trying to fit a spline to, but when I provide G and h, I get nonsense/no optimal solution. Due to this I believe there is something wrong with the formulation of G and h. – Jared Apr 25 '17 at 21:18

1 Answers1

0

The notebook you have posted seems to have it all figured out. The problem I had is that the source file for data is not available.

Now to your question:

What is the matrix G supposed to look like? I've formulated as a system of linear equations, but looking at examples this does not appear to be correct?

Rewrite your "linear equations" into matrix form, i.e.

2x + 2y = 4
x  - y  = 1

is equivalent to

matrix([[2,2],[1,-1]]) * matrix([[x],[y]])  = matrix([[4],[1]])

where matrix is from cvxopt.

matusko
  • 3,487
  • 3
  • 20
  • 31
  • I've updated the notebook to include the data so the example should be able to run exactly. When running the solver, if only P, q, A, and B are provided there is a good fit as a solution. When also providing G and h the solver does not terminate. This is my problem - it must be a formulation of G and h. – Jared Apr 25 '17 at 21:17