python cvxopt求解器ValueError:域错误

时间:2018-10-26 08:47:39

标签: python-3.x cvxopt

我有一个python 2.7代码将其翻译成python 3.6代码。

当我跑步时:

from cvxopt import solvers, matrix
(...)
P = matrix(P)
q = matrix(q)
G = matrix(G)
h = matrix(h)
A = matrix(A)
b = matrix(b)
sol = solvers.qp(P, q, G, h, A, b)

我收到此错误:

Traceback (most recent call last):
  File "C:\Users\jaime.lazcano\Documents\Projects\myproject\optimization.py", line 85, in run_optimizacion
    sol = solvers.qp(P, q, G, h, A, b)
  File "C:\ProgramData\Anaconda2\envs\myproject\lib\site-packages\cvxopt\coneprog.py", line 4487, in qp
    return coneqp(P, q, G, h, None, A,  b, initvals, kktsolver = kktsolver, options = options)
  File "C:\ProgramData\Anaconda2\envs\myproject\lib\site-packages\cvxopt\coneprog.py", line 2243, in coneqp
    if iters == 0:  W = misc.compute_scaling(s, z, lmbda, dims)
  File "C:\ProgramData\Anaconda2\envs\myproject\lib\site-packages\cvxopt\misc.py", line 285, in compute_scaling
    W['d'] = base.sqrt( base.div( s[mnl:mnl+m], z[mnl:mnl+m] ))
ValueError: domain error

该代码在python 2.7上有效,但在python 3.6上无效。

我该怎么办?

我不知道python 3.6的格式是什么

0 个答案:

没有答案