1

I need to implement a SVM for a school projet. But I'm facing a problem when I'm trying to solve a Quadratic problem in Python using the OSQP library.

The problem is QP problem

my constraints are:

alpha >= 0
matrix Y.transpose() * alpha = 0

The matrix is :

[[  2.   3.  -4.  -5.  -8.]
 [  3.   5.  -6.  -9. -12.]
 [ -4.  -6.   8.  10.  16.]
 [ -5.  -9.  10.  17.  20.]
 [ -8. -12.  16.  20.  32.]]

The below python code setup the problem and try to solve it but it failed with a dual infeasible error.

I have change multiple settings like (iter, dual_infeasible error limit) but it's still failed

  • q corresponds to the right side of the problem (linear part)
  • A is the constraint ( Y.transpose * alpha = 0)
  • l is lower bound
  • u is upper bound

    P = sparse.csc_matrix(bigMatrix) q = np.array([-1, -1, -1, -1, -1]) A = sparse.csc_matrix(np.transpose(Y)) l = np.array([0]) u = np.array([np.inf])

    prob = osqp.OSQP() prob.setup(P, q, A, l, u)
    res = prob.solve()

Do you have any suggestions to solve the problem. Note : I'm not 100% sure the problem is correctly setup.

The results I should get from this problem is :

alpha1 1.11022 x10^16, alpha2 2.5, alpha3 2., alpha4 0.5, alpha5 1.4363*10^24
Nicolas Roche
  • 105
  • 1
  • 1
  • 14
  • Please provide a minimal working example script. Without knowing matrix `P` it is hard to reproduce the problem. I suspect your lower/upper bounds are not correct. They are not directly the lower/upper bounds of the variables, but to the constraints. Check out the formulation at https://osqp.org/docs/. I suggest you to post the problem to the new [osqp Discourse forum](https://osqp.discourse.group/). – bstellato Jun 27 '19 at 13:39

0 Answers0