我试图在这个优化问题中加入这些约束,但无论我做什么,我都会得到错误“'generator'对象没有属性'variables'”
objective2 = cp.Minimize(cp.norm(s_new - ss))
constraints2 = [s_newi <=1 and s_newi >= 0 for s_newi in s_new)]
prob2 = cp.Problem(objective2, constraints2)
print("Second problem:", prob2.solve())
print("s_new:", s_new.value)
目前没有回答
相关问题 更多 >
编程相关推荐