pyomo icon indicating copy to clipboard operation
pyomo copied to clipboard

Variable bounds are not checked when the variables are not in active constraints

Open qtothec opened this issue 8 years ago • 2 comments

from pyomo.environ import *
m = ConcreteModel()
m.x = Var()
m.c = Constraint(expr=m.x >= 1)
m.p = Param(mutable=True, initialize=5)
m.y = Var(bounds=(m.p, 3))

m.o = Objective(expr=m.x)
SolverFactory('gurobi').solve(m)
m.display()

This model is very much infeasible: 5 <= y <= 3. Instead, we have:

Model unknown

  Variables:
    x : Size=1, Index=None
        Key  : Lower : Value : Upper : Fixed : Stale : Domain
        None :  None :   1.0 :  None : False : False :  Reals
    y : Size=1, Index=None
        Key  : Lower : Value : Upper : Fixed : Stale : Domain
        None :     5 :  None :     3 : False :  True :  Reals

  Objectives:
    o : Size=1, Index=None, Active=True
        Key  : Active : Value
        None :   True :   1.0

  Constraints:
    c : Size=1
        Key  : Lower : Body : Upper
        None :   1.0 :  1.0 :  None

qtothec avatar Jan 10 '18 22:01 qtothec

@jsiirola - I'm going through old bug reports. Is this bug still present in the most recent Pyomo version?

mrmundt avatar Feb 22 '22 21:02 mrmundt

Yes. I think this still exists.

jsiirola avatar Feb 23 '22 14:02 jsiirola

This bug is still around. Stumbled across it today. Our workaround is reapeating the bounds as constraints.

feldmeier avatar Feb 16 '23 15:02 feldmeier