The provided QP solver for CVXOPT solves problems of the form ( see http://cvxopt.org/userguide/coneprog.html#quadratic-programming ):
Minimize
(1/2)*x.t*P*x + q.T*x
Subject to
G*x <= h
A*x = b
This works fine, but it gets a bit awkward when wanting to solve a problem constraint by an inequality on two sides:
Minimize
(1/2)*x.t*P*x + q.T*x
Subject to
G1*x <= h1
G2*x >= h2
A*x = b
I can redefine the second problem as the first one, by doubling the number of dimensions and by requiring the new_x
to be the old_x
stacked on top of itself:
new_x = [old_x]
[old_x]
I think I can enforce the above condition by finding an appropriate form for A
. I can then encode both the h1
and h2
inequalities into the new_G * new_x <= new_h
by setting new_h
to be h1
stacked on h2
and new_G
to be a diagonal matrix with n
consecutive 1
s followed by n
consecutive -1
s on the diagonal.
Anyway, the above is very clumsy, it's doubling the dimensionality of my problem and it might not even work.
Is there a nicer way of expressing the second problem in CVXOPT?
where
`