I want to model the equation below in GAMS:
Code: Select all
equation1..
if( x(i) > x(j),
y(i) > y(j);
);
here y(i) is a variable and x(i) is a parameter.
I would be appreciated if someone can help how to model it in GAMS.
Code: Select all
equation1..
if( x(i) > x(j),
y(i) > y(j);
);
Code: Select all
set i / blah /;
alias (i,j);
parameter a(i);
variables x(i);
equation f(i,j);
f(i,j)$[a(i) > a(j)] .. x(i) =g= x(j);
dirkse wrote: ↑5 years ago
Hi,
You have two strict inequalities there: one comparing parameters, the other comparing variables. The parameters can be compared this way, but not the variables. So you could do something like:
Mathematically, we don't do optimization over open sets (i.e. those defined with strict inequalities): how can you solveCode: Select all
set i / blah /; alias (i,j); parameter a(i); variables x(i); equation f(i,j); f(i,j)$[a(i) > a(j)] .. x(i) =g= x(j);
max x
s.t. x < 3
And numerically, we do all this in finite-precision arithmetic so there is almost always some round-off error. Constraints are not satisfied exactly but to within some tolerance, so a strict vs. non-strict inequality is easily lost in the noise of round-off error.
-Steve