Conditional binary variable logic in gams model -
this model in gams,
i have binary variable (b(n)) , real variable (u(n)), n set. want binary variable equal 0 when u zero, , equal 1 when u isn't zero.
this easy if use 'if' statements can't use them in model equations, needs done math logic...
it's ok! found solution:
b(n) =l= rel_ne(u(n),0) b(n) =g= rel_ne(u(n),0)
this seams working fine. it's not elegant solution whatever.
rel_ne returns 1 if u(n) not equal 0, , returns 0 otherwise.
Comments
Post a Comment