mathematically, if there are two equations
x1=9;
x1>8;
then you will get the result x1=9.
but in GAMS. if you write x1.fx=9;
then x1.lo=8.
then it will treat x1 as 8<x1<9.
this is very confusing since it is not the same as the mathematical problem. and it could change the problem in a wrong way. since we want x1=9 rather than 8<x1<9.
Is there any way to avoid this?
understanding GAMS syntax in a mathematical way Topic is solved

 User
 Posts: 44
 Joined: 6 months ago
Re: understanding GAMS syntax in a mathematical way Topic is solved
Hi, as you can read in https://www.gams.com/latest/docs/userguides/mccarl/fx.htm, when doing x1.fx=9 actually:
This means x1.fx=9 is exactly doing x1.lo=9 and x1.up=9 in one statement.
Additionaly, this kind of statements (setting variable attributes) are executed in order. So when you do x1.lo=8 afterwards, you are "overwriting" the previous set of the lower bound.
Best regards!
Claudio
... GAMS sets the lower and upper bound to that value.
This means x1.fx=9 is exactly doing x1.lo=9 and x1.up=9 in one statement.
Additionaly, this kind of statements (setting variable attributes) are executed in order. So when you do x1.lo=8 afterwards, you are "overwriting" the previous set of the lower bound.
Best regards!
Claudio

 User
 Posts: 68
 Joined: 5 months ago
Re: understanding GAMS syntax in a mathematical way
how about if I have two lines as below.
q<some value;
q.up=inf;
will the second line determine the upper bound of q which makes the first line useless?
q<some value;
q.up=inf;
will the second line determine the upper bound of q which makes the first line useless?

 User
 Posts: 44
 Joined: 6 months ago
Re: understanding GAMS syntax in a mathematical way
you mean a constraint defined ? ie
c1.. q=l=someValue;
q.up=someValue;
This would lead to models which are identical on the mathematical level, but NOT on the "software" (GAMS+solver) level.
c1.. q=l=someValue;
q.up=someValue;
This would lead to models which are identical on the mathematical level, but NOT on the "software" (GAMS+solver) level.
Who is online
Users browsing this forum: No registered users and 1 guest