Skip to content

Commit

Permalink
Merge pull request #2848 from jsiirola/fix-fbbt-generalexpr
Browse files Browse the repository at this point in the history
Fix typo in FBBT (GeneralExpression)
  • Loading branch information
michaelbynum authored May 26, 2023
2 parents d8cbd46 + c2fe429 commit edf4ccc
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pyomo/contrib/fbbt/fbbt.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ def _prop_bnds_leaf_to_root_GeneralExpression(node, bnds_dict, feasibility_tol):
is more conservative).
"""
if node.expr.__class__ in native_types:
expr_lb = expr_up = node.expr
expr_lb = expr_ub = node.expr
else:
expr_lb, expr_ub = bnds_dict[node.expr]
bnds_dict[node] = (expr_lb, expr_ub)
Expand Down
14 changes: 14 additions & 0 deletions pyomo/contrib/fbbt/tests/test_fbbt.py
Original file line number Diff line number Diff line change
Expand Up @@ -1317,6 +1317,20 @@ def test_external_function(self):
self.assertAlmostEqual(m.y.lb, 0)
self.assertAlmostEqual(m.y.ub, 3)

def test_named_expr(self):
m = pyo.ConcreteModel()
m.x = pyo.Var(bounds=(0, None))
m.y = pyo.Var(bounds=(1, 6))
m.e_const = pyo.Expression(expr=3)
m.e_var = pyo.Expression(expr=m.y + m.e_const)

m.c = pyo.Constraint(expr=m.x**2 == m.e_var)

self.tightener(m)
self.tightener(m)
self.assertAlmostEqual(m.x.lb, 2)
self.assertAlmostEqual(m.x.ub, 3)


class TestFBBT(FbbtTestBase, unittest.TestCase):
def setUp(self) -> None:
Expand Down

0 comments on commit edf4ccc

Please sign in to comment.