Skip to content
Advertisement

CVXPY Quadratic Programming; ArpackNoConvergence error

I’m trying to use the Python package CVXPY to solve a convex quadratic programming problem of the first form here: https://www.cvxpy.org/examples/basic/quadratic_program.html, using the following code

x = np.variable(2 * N)
prob = cp.Problem(cp.Minimize((1/2) * cp.quad_form(x, P) + q @ x), [G @ x <= h, A @ x == b])
prob.solve(solver=cp.OSQP, verbose=True)

However, for certain data, it gives me the error

ArpackNoConvergence: ARPACK error -1: No convergence (1001 iterations, 0/1 eigenvectors converged)

From searching the internet, it seems like this can be addressed either by increasing the number of iterations in ARPACK, or by increasing the tolerance. CVXPY has options for both max_iters and for absolute accuracy, but these don’t seem to affect the number of iterations in ARPACK, and I assume they apply to some higher level part of the solver.

I can’t find any references online to this specific problem, or indeed to ARPACK in conjunction with CVXPY. I’m pretty stumped by this, and would really appreciate any help.

Advertisement

Answer

Without running this (code is obviously incomplete), there are two candidates:

  • A: OSQP
  • B: Internal PSD-checks within cvxpy (before submitting data to solvers!)

I’m guessing it’s B (and you might switch to some other solver to reason about it).

The iteration-parameter you are setting is related to the solvers and if i’m guessing correctly, you are not even reaching this point (error in canonicalization-phase).

It seems, your matrix induces trouble in regards to iterative eigenvalue-computations (ARPACK). Maybe this can be seen by it’s condition-number.

Not sure, if there is an easy transformation / perturbation for your use-case to improve the conditioning here.

Lots of internals are not easily accessable without rebuilding cvxpy from sources, but in this case you might get away by changing cvxpy.settings.settings.EIGVAL_TOL:

import cvxpy as cp
print(cp.settings.EIGVAL_TOL)
# 1e-10
cp.settings.EIGVAL_TOL = 1e-08

... do your work

(If your data is not totally broken due to some mistake AND not confidential, i would assume cvxpy-people would be happy to obtain your data as example too re-evaluate some internal tolerances -> github issue with reproducible code incl. data)

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement