Using different equations based on the value of a function
Posted: Thu May 28, 2020 9:08 am
How to arrive at a system in which another equation is enforced based on the value of a function?
Forum for questions on the use of GAMS
https://forum.gamsworld.org/
Code: Select all
z = f(x) when y > 0
z = g(x) when y < 0
Code: Select all
Variable fs, gs;
z =E= (f(x) - fs) + (g(x) - gs);
Code: Select all
Binary Variable b;
Positive Variable yp, yn;
y =E= yp - yn;
yp =L= ymax * b;
yn =L= ymax * (1 - b);
Code: Select all
Positive Variable fp, fn, gp, gn;
f(x) - fs =E= fp - fn;
g(x) - gs =E= gp - gn;
fp + fn =L= fmax * b;
gp + gn =L= gmax * (1 - b);
Code: Select all
Positive Variable fsp, fsn, gsp, gsn;
fs =E= fsp - fsn;
gs =E= gsp - gsn;
fsp + fsn =L= fmax* (1 - b);
gsp + gsn =L= gmax * b;