Skip to content

XpressPersistent.update_var does not use existing bounds when vartype changes #3565

@bknueven

Description

@bknueven

Summary

XpressPersistent.update_var does not properly set existing bound when the variable type changes (e.g., from continuous to discrete).

Steps to reproduce the issue

import pyomo.environ as pyo 
m = pyo.ConcreteModel()
m.x = pyo.Var(bounds=(0, 1)) 
m.o = pyo.Objective(expr=m.x)

opt = pyo.SolverFactory('xpress_persistent')
opt.set_instance(m)

m.x.fix(1)
opt.update_var(m.x)

opt.solve(m)
opt.load_vars()

# prints 1
print(m.x.value)

m.x.domain = pyo.Binary
opt.update_var(m.x)

opt.solve(m)
opt.load_vars()

# prints 0
print(m.x.value)

Error Message

Information on your system

Pyomo version: c5a50b7
Python version: 3.11.8
Operating system: macOS
How Pyomo was installed (PyPI, conda, source): source
Solver (if applicable): Xpress

Additional information

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions