objective 不是 DCP

The objective is not DCP

我尝试解决这个paper

中第20页的凸问题

在我看来,objective 是凸的。

cvxpy 版本 1.1.18

可能是 DCP:错误

它报告

xception has occurred: DCPError Problem does not follow DCP rules. Specifically: The objective is not DCP. Its following subexpressions are not: 0.004 / (power(var1[0], 0.5) + power(var1[0], 0.5)) 0.004 / (power(var11, 0.5) + power(var11, 0.5))

我的密码是

K = 1000
KK = 500
delta = 1/(1000)*2
a = cp.Variable(KK)
b = cp.Variable(KK+1,nonneg=True)
tau = cp.Variable((KK,7))
print('create problem')
print('cvx version')
print(cp.__version__)
prob = cp.Problem(cp.Minimize(cp.sum([2*delta/(cp.sqrt(b[i])+cp.sqrt(b[i+1])) for i in range(KK)])),
          [...])

一个简明的例子报告了同样的问题

import copy as cp

# A non-DCP problem.
K=5
x=cp.Variable(K+1)
prob = cp.Problem(\
    cp.Minimize( cp.sum([1/(cp.sqrt(x[i]) +cp.sqrt(x[i+1])) for i in range(K)]) )\
        ,[x>=25,x<=100])
print( "prob is DCP:", prob.is_dcp())
print('be solving  by cvxpy')
try:
    prob.solve()
except Exception as e:
    print(e)

使用 cp.inv_pos(u) 代替 1/u