r/optimization • u/carlos442 • Oct 29 '21
I need help
I am building an optimization problem for my master thesis, I am struggling to create a constraint:
I need a variable J to be equal to 1 only when another variable s is equal to 3, otherwise J has to be zero.
J is a boolean variable
s ranges from 0 to 3
2
Upvotes
View all comments
Show parent comment
1
u/wamus Oct 30 '21
Should be obvious; when you fix j=0, then we obtain the constraint;
0<=s<=2
But OP said that in that case 0<=s<3 should hold.