ValueError: Rank(A) < p or Rank([P; A; G]) < n

77 views
Skip to first unread message

Nancy Shan

unread,
Nov 16, 2022, 2:11:24 PM11/16/22
to CVXOPT

The ValueError: Rank(A) < p or Rank([P; A; G]) < n drives me crazy .

I respectively use same matrices to solve the minimization and the maximization problem with the function cvxopt.solvers.qp(P,q,G,h,A,b) . When I solve the minimization problem, cvxopt works well and gets the solution of x. But when I try to solve the maximization problem, that is, when I multiply the matrix P, by minus one , cvxopt runs an error. My goal is to solve the maximization problem, but I can't solve the error, and I don't understand why the error comes up after adding a negative sign. The codes and results of the above two situations are as follows.

Situation 1:

屏幕截图 2022-11-16 152017.png

Result 1:

屏幕截图 2022-11-16 152239.png

Situation 2:

屏幕截图 2022-11-16 152316.png

#just adding a negative sign before P

Result 2:

2屏幕截图 2022-11-16 152351.png

Martin

unread,
Nov 18, 2022, 2:45:57 PM11/18/22
to CVXOPT
The matrix P must be positive semidefinite in order for the problem to be convex. The matrix -P is negative semidefinite if P is positive semidefinite, and hence you no longer have a convex problem when you change the sign.
Reply all
Reply to author
Forward
0 new messages