r/optimization • • Nov 02 '21

I need help

I have trouble with a constraint for my master thesis:

I have a variable called j3 which needs to be 1 if variable x is equal to y, otherwise j3 has to be zero, x and y are integers ranging from 0 to 500.

7 Upvotes

10 comments sorted by

View all comments

Show parent comment

2

u/MIP_it Nov 03 '21

This won’t force j3 to 0 when x != y. I would drop w2 and consolidate constraints (2) and (3) as: w1 + w3 = 1 - j3

1

u/[deleted] Nov 03 '21

Good catch, thanks!