79515003

Date: 2025-03-17 15:28:39
Score: 2
Natty:
Report link

Let's say your integer variables are: x_1, x_2, and x_3. You want a binary indicator variable y such that:

y = 0 if x_1 + x_2 + x3 == 0,

y = 1 if x_1 + x_2 + x3 > 0

You know that x_1 + x2 + x3 is always <= 5. In this case, I would use this constraint:

y <= x_1 + x_2 + x_3 <= 5*y

Reasons:
  • Low length (0.5):
  • No code block (0.5):
  • Low reputation (1):
Posted by: cmukid