将列表更改为Symmetrix矩阵

时间:2019-11-07 04:22:00

标签: python numpy

我正在尝试使用solve_qp解决以下Python问题:

from qpsolvers import solve_qp
k = np.array(kernel)
f = np.array(f)
lb=np.array(lower_limit)
ub=np.array(upper_limit)
Aeq = np.array(Aeq)
xs = solve_qp(k, f,lb,ub,Aeq,beq)
print(xs)

其中

k= [[ 1.  1.  1. -1. -1. -1.]
 [ 1.  1.  1. -1. -1. -1.]
 [ 1.  1.  1. -1. -1. -1.]
 [-1. -1. -1.  1.  1.  1.]
 [-1. -1. -1.  1.  1.  1.]
 [-1. -1. -1.  1.  1.  1.]]
f = [-0.5 -0.5 -0.5  1.5  1.5  1.5]
lb = [0. 0. 0. 0. 0. 0.]
ub = [100. 100. 100. 100. 100. 100.]
Aeq = [ 1.  1.  1. -1. -1. -1.]
beq = 0.0

但我不断收到以下错误:

ValueError: The number of columns of C must match the length of b. Received C as (6, 2) and b as (7,)

0 个答案:

没有答案
相关问题