upper/lower bound vs restriction

Problems with syntax of GAMS
Post Reply
pitters
User
User
Posts: 14
Joined: 2 years ago

upper/lower bound vs restriction

Post by pitters »

Hi, quick question, do setting lower / upper bound work different than a restriction?, is one more efficient than the other?

upper bound by setting it
a.up(t) = 50

upper bound by restriction
a(t) =L= 50


thanks
User avatar
dirkse
Moderator
Moderator
Posts: 214
Joined: 7 years ago
Location: Fairfax, VA

Re: upper/lower bound vs restriction

Post by dirkse »

Pitters,

In most cases, the two items you mention (x.up = 50 or x =L= 50) are identical. For example, most LP solvers include a presolve step that converts singleton equations like x =L= 50 into the equivalent explicit upper bound. Usually it is best to just set the variable upper bound explicitly in GAMS.

There are some cases where there is a difference.
1. In MCP models, we don't really have constraints. Instead, we use the syntax of constraints to define functions. So in this case, setting f.. x =L= 50; creates a function f(x) := x - 50.
2. Some NLP solvers treat explicit variable bounds differently. For example, they might honor explicit bounds at all times, so you can be assured that the NL functions will never be evaluated with x > 50, but if the bound x <= 50 is in a general constraint it may not be satisfied at all times, and it may be violated by a small amount - the solver's infeasibility tolerance.
3. If you are solving the same model multiple times (say, a dynamic model with a rolling time horizon defined by the singleton set tCurr) you can put explicit variable bounds that depend on the time index into a constraint to avoid the need to reset the bounds each time. If you do

f.. x =L= myLimit(tCurr);

you are done: the equation f is regenerated each time in the loop over t. In contrast, the explicit variable bound needs to go in the loop:

loop {t,
tCurr(t) = yes;
x.up = myLimit(tCurr);
solve m using nlp min z;
};

HTH,

-Steve
Post Reply