I'm trying to use the cvxopt quadratic solver to find a solution to a Kernel SVM but I'm having issues. I'm back to solving a very simple quadratic program:
\begin{gather*} \min_{x\in\mathbb{R}^n} \frac{1}{2}x^\intercal Px + q^\intercal P \end{gather*}
I get the error ValueError: Rank(A) < p or Rank([P; A; G]) < n. As I don't specify A or G I thought the problem might come from the fact that Rank(P) < n but it's not the case as P is full-ranked. The code below reproduces this error:
import numpy as np
import cvxopt
n = 5
P = np.random.rand(n,n)
P = P.T + P + np.eye(n)
q = 2 * np.random.randint(2, size=n) - 1
P = cvxopt.matrix(P.astype(np.double))
q = cvxopt.matrix(q.astype(np.double))
print(np.linalg.matrix_rank(P))
solution = cvxopt.solvers.qp(P, q)
Complete error:
Traceback (most recent call last):
solution = cvxopt.solvers.qp(P, q)
File "python2.7/site-packages/cvxopt/coneprog.py", line 4470, in qp
return coneqp(P, q, G, h, None, A, b, initvals, kktsolver = kktsolver, options = options)
File "python2.7/site-packages/cvxopt/coneprog.py", line 2013, in coneqp
raise ValueError("Rank(A) < p or Rank([P; A; G]) < n")
ValueError: Rank(A) < p or Rank([P; A; G]) < n
Any idea?