How to define Var with an open interval in Pyomo?

Viewed 287

Pyomo provides some features to add constraints into variables like bellow code in the document.

model.LumberJack = Var(within=NonNegativeReals, bounds=(0,6), initialize=1.5)

But, I want to define a variable with open interval constraints such as (0, 1]. In my understanding, the bounds argument means closed interval, so, if I set the param as bounds=(0,1), it means [0, 1].

I think closed interval constraints are common things and Pyomo provide this kind of features, but I couldn't find it. Is it a implementation issue? or theoretical issues in optimization?

1 Answers

An open interval would mean a "strictly less" constraint in the model, i.e.

variable < upper bound

instead of

variable <= upper bound

Depending on your solution algorithm this may not be supported by the underlying theory. For example, in linear and mixed integer programming theory there is no support for strict inequalities. The only thing you can have is <= and >=. So even if Pyomo would support (half-)open intervals, the algorithms to solve the problem may not.

The usual approach to work around this is to use a small epsilon and write

variable <= upper bound - epsilon

to "emulate" a strict inequality. This may of course introduce numerical difficulties.

Finally, given that most algorithms operate with finite precision and numerical tolerances, there is the question what a strict inequality on a variable bound should mean. As soon as the tolerance is bigger than 0 the variable would be allowed to attain the value at the upper bound and that would be considered feasible within tolerances.

Related