Binary Variable Activation
AnsweredHi, i need to activate the Variable Z[i,j] according to:
G(i,j)>MG(i,j), then Z[i,j]=1
G(i,j)<=MG(i,j) then Z[i,j]=0
I need to do it with the big M technique
PD: G(i,j) and MG(i,j) are parameters.
0
-
Hi Juan,
If G[i,j] and MG[i,j] are parameters, you do not need a Big-M constraint to model your condition. You can simply compare the values of G[i,j] and MG[i,j] and set the binary variable Z[i,j] to zero or one accordingly.
Best regards,
Simran0 -
Can you give me de code line please?
0 -
You can do something like this in Python, for example,
if G[i,j] > MG[i,j]:
model.addConstr(Z[i,j]==1)
else
model.addConstr(Z[i,j]==0)0
Please sign in to leave a comment.
Comments
3 comments