【发布时间】:2019-05-28 15:31:00
【问题描述】:
我正在尝试使用 cvxpy 和 MOSEK 解决优化问题。尽管这两个软件包似乎独立工作,但我无法让它们一起运行。每当我要求 cvxpy 解决 MOSEK 的任何问题时,我总是得到错误:
AttributeError: type object 'solsta' has no attribute 'near_optimal'
我做错了什么?
考虑以下(最小)代码:
import cvxpy as cp
x = cp.Variable(2)
obj = cp.Minimize(x[0] + x[1])
constraints = [x >= 2]+[x<=5]
prob = cp.Problem(obj, constraints)
# Solve with MOSEK.
prob.solve(solver=cp.MOSEK,verbose=True)
print("optimal value with MOSEK:", prob.value)
与我尝试使用 MOSEK 和 cvxpy 进行的任何其他优化一样,编译器在此行崩溃:
prob.solve(solver=cp.MOSEK,verbose=True)
MOSEK 正确地解决了问题,但在将解决方案传达给 cvxpy 时似乎存在问题。
【问题讨论】: