Re: Modeling the absolute value
Posted: Thu Sep 14, 2017 6:14 pm
Hi, the dollar command is used to manipulate the sets.
For example, if the restrictions eq1, eq2, eq3 and eq4 does not apply to the last "t":
eq1(n,m,t)$(ord(t) ne card(t)).. 1 - z(n,m,t) + z(n,m,t+1) + absvalue(n,m,t) =g= 1;
eq2(n,m,t)$(ord(t) ne card(t)).. 1 - z(n,m,t) + 1-z(n,m,t+1) + 1-absvalue(n,m,t) =g= 1;
eq3(n,m,t)$(ord(t) ne card(t)).. z(n,m,t) + 1-z(n,m,t+1) + absvalue(n,m,t) =g= 1;
eq4(n,m,t)$(ord(t) ne card(t)).. z(n,m,t) + z(n,m,t+1) + 1-absvalue(n,m,t) =g= 1;
eq5.. sum((n,m,t),absvalue(n,m,t)) =l= 2*j;
"$(ord(t) ne card(t))" is mean that the position of the set "t" (card(t)) is not equal (ne) to the last position (card(t)).
I hope this can help you
Bye!
For example, if the restrictions eq1, eq2, eq3 and eq4 does not apply to the last "t":
eq1(n,m,t)$(ord(t) ne card(t)).. 1 - z(n,m,t) + z(n,m,t+1) + absvalue(n,m,t) =g= 1;
eq2(n,m,t)$(ord(t) ne card(t)).. 1 - z(n,m,t) + 1-z(n,m,t+1) + 1-absvalue(n,m,t) =g= 1;
eq3(n,m,t)$(ord(t) ne card(t)).. z(n,m,t) + 1-z(n,m,t+1) + absvalue(n,m,t) =g= 1;
eq4(n,m,t)$(ord(t) ne card(t)).. z(n,m,t) + z(n,m,t+1) + 1-absvalue(n,m,t) =g= 1;
eq5.. sum((n,m,t),absvalue(n,m,t)) =l= 2*j;
"$(ord(t) ne card(t))" is mean that the position of the set "t" (card(t)) is not equal (ne) to the last position (card(t)).
I hope this can help you
Bye!