I want to create constraints such that I can implement the following condition:
Let A be an integer variable >= 0 with an upper bound of 12
I want to introduce the following variable B also an integer:
if A = 1 then B = 0 else B = A
I want to create constraints such that I can implement the following condition:
Let A be an integer variable >= 0 with an upper bound of 12
I want to introduce the following variable B also an integer:
if A = 1 then B = 0 else B = A
you can introduce a binary variable z verifying the following constraints :
(A-1) <= 12*z
z<= 0.5*A
-(1-z)*12 <= B-A <= (1-z)*12
-12*z <= B <= 12*z