Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何使用 scip python 接口添加二次约束?在其中一个示例中,我看到类似 model.addCons( x*x+y*y<=6) 但是,因为我有很多变量(x1..xn 并且我的约束是形式x'Qx<=0.2,其中 x 是 n*1,Q 是 n*n) , 这种方法是不可能的。当我做线性约束时,如何将二次约束放入 coeffs 的 python 字典中?(coeffs={x**2:3.0,y**2:1.0,z**2:5.0}例如,如果我想要3x^2+y^2+5z^2<=10)
x*x+y*y<=6
x'Qx<=0.2
(coeffs={x**2:3.0,y**2:1.0,z**2:5.0}
3x^2+y^2+5z^2<=10
目前不支持此功能。您需要遍历二次约束并使用表达式方法一个接一个地添加它们。