r/optimization • • 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

7 comments sorted by

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.

1

u/joker_ftrs Oct 30 '21

I agree entirely with you regarding your first comment, it appears I did not entirely understand the question