'domain error' and 'singular KKT matrix' in qp

12 views
Skip to first unread message

Kangkang Chang

unread,
May 21, 2024, 3:18:21 AMMay 21
to CVXOPT
Hello,
When I try to use cvxopt to solve some qp problems, I met some errors such as 'domain error' and 'singular KKT matrix'. I don't know how to fix these. I have two examples in attached. I used windows 11 system with python 3.12 x64, the version of cvxopt is 1.3.2.

Here are some running messages with error:
     pcost       dcost       gap    pres   dres
 0:  6.7033e+01 -1.9036e+03  8e+03  9e-02  2e+02
 1:  5.3714e-02 -7.9915e+02  1e+03  1e-02  3e+01
 2:  6.3872e-01 -1.5859e+01  2e+01  2e-04  3e-01
 3:  9.7689e-02 -2.8317e-01  4e-01  2e-06  3e-03
 4:  1.4190e-02 -1.6652e-02  3e-02  2e-08  3e-05
 5:  2.0015e-03 -2.2198e-03  4e-03  2e-16  3e-08
Terminated (singular KKT matrix).

-------------- 
     pcost       dcost       gap    pres   dres
 0:  1.7544e+02  3.0533e+03  3e+04  7e-03  4e+02
 1:  1.4756e+02  1.9922e+05  3e+04  6e-03  4e+02
 2:  7.7732e+01  3.1720e+06  3e+04  6e-03  4e+02
 ......
164:  7.7769e+07  7.7769e+07  6e-299  2e-16  4e+04
165:  7.7769e+07  7.7769e+07  8e-299  4e-16  3e+05
166:  7.7769e+07  7.7769e+07  5e-297  4e-15  1e+06
Traceback (most recent call last):
  File "d:\QPerror\loadQP.py", line 46, in <module>
    sol = qp(Pm, qm, Gm, hm, Am, bm, options={"show_progress": True, "maxiters": 1000})
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\Python312\Lib\site-packages\cvxopt\coneprog.py", line 4485, in qp
    return coneqp(P, q, G, h, None, A,  b, initvals, kktsolver = kktsolver, options = options)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\Python312\Lib\site-packages\cvxopt\coneprog.py", line 2519, in coneqp
    misc.update_scaling(W, lmbda, ds, dz)
  File "D:\Python312\Lib\site-packages\cvxopt\misc.py", line 450, in update_scaling
    s[:m] = base.sqrt( s[:m] )
            ^^^^^^^^^^^^^^^^^^
ValueError: domain error
-------------------------
CVXOPT_Priority0_1716181109545021500.pickle
loadQP.py
CVXOPT_Priority1_1716181109058795100.pickle

Martin

unread,
May 21, 2024, 3:29:31 AMMay 21
to CVXOPT
This is a numerical issue—the solver does not reach the default tolerance. You can try two things:
  1. Use a different KKT solver: add the argument kktsolver='ldl' to the qp(...) call.
  2. Increase the tolerance, e.g., options={"feastol": 1e-5}

Reply all
Reply to author
Forward
0 new messages