SOS Constraint with sum
回答済みIs there a way to create a SOS constraint where one of the variables is a sum of variables? I have n+1 non-negative variables denoted x_1,...x_n, y and would like to add a constraint that either y=0 or x_1=...=x_n=0. Since the variables are all greater than or equal to zero, it seems like a natural way to achieve this would be to have a type 1 SOS constraint where the two variables are y and x_1+...+x_n. I know this could be achieved by creating n type 1 SOS constraints of the form (y, x_i), but n is very large and this must be done for multiple y's so I'd like to avoid that.
Thanks!
-
正式なコメント
This post is more than three years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum. Or why not try our AI Gurobot?. -
Hi Alexander,
I would not use SOS constraints in this case, but big-M. Specifically, let M1 be the big-M value of y and M2 be the big-M value of the sum(x_i). Then I would introduce a binary variable z such that:
y <= M1z
sum(x_i) <= M2(1-z)Then, if z=1, you have sum(x_i)<=0 which due to the non-negativity means x_i=0 for all x_i. Equally, if z=0, then you have y<=0 which due to the non-negativity means y=0. You can check some slides I made about this here (page 15).
Hope this helps
Richard
1 -
Thanks Richard, that is very helpful!
0
投稿コメントは受け付けていません。
コメント
3件のコメント