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

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

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.

- 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.
- 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.
- 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