hello, i just started using gams, i apologize already for my pace.
I want to model following model, but i could not model the absolute value. I wrote something like the following but it is not true
zobj =e= sum(i,sum(j, f(i,j)* (xplus(i) + xneg(i) -xplus(j) + xneg(j) )))
Can you help me ?
Modeling abs value
Modeling abs value
- Attachments
-
- Screenshot_1.png (10.47 KiB) Viewed 2901 times
Re: Modeling abs value
In my opinion, you must change abs part with a dummy decision variables like lambda(i,j) or etc. After defining this non negative decision you must replace abs part of objective with this decision variable. Please do not forget to add below constraints to reflect abs effect to the model:
cons(i,j).. lambda(i,j)=g=x(i)-x(j);
cons2(i,j).. lambda(i,j)=g=x(j)-x(i);
Another important part: define x as free variables and lambda as positive variables.
cons(i,j).. lambda(i,j)=g=x(i)-x(j);
cons2(i,j).. lambda(i,j)=g=x(j)-x(i);
Another important part: define x as free variables and lambda as positive variables.