Skip to content

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

Open
@qtothec

Description

@qtothec
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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions