2

In the example given in https://cvxopt.org/examples/tutorial/qp.html, they give the syntax for the situation when there is one equality constraint but I am having problems getting it right when I have three equality constraints.

1
  • Do you plan to give us any details about the problems? Commented Nov 13, 2019 at 1:27

1 Answer 1

4

CVXOPT can be easily implemented with several inequality as well as equality constraint and they follow the same logic.

So for the inequality Gx <= h you will have

G = opt.matrix(np.concatenate([G1,Gn])
h = opt.matrix(np.concatenate([h1,hn])

The same logic will apply for multiple equality constraint where Ax == b, hence

A = opt.matrix(np.concatenate([A1,An])
b = opt.matrix(np.concatenate([b1,bn])

then you can set the solver to be

sol = solvers.qp(P, q, G, h, A, b)

The only thing you need to be careful not to have error is to make sure you concatenate matrixes, hence you need to transform value into matrix

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.