Skip to content

Commit

Permalink
Merge pull request #3 from qtothec/fathom_disjuncts_for_fbbt
Browse files Browse the repository at this point in the history
Fathom disjuncts for FBBT
  • Loading branch information
michaelbynum authored May 2, 2019
2 parents ab1171f + 2d2ef6d commit 0fb1701
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pyomo/contrib/gdp_bounds/compute_bounds.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
processed with this transformation.
"""
from pyomo.common.errors import InfeasibleConstraintException
from pyomo.contrib.fbbt.fbbt import fbbt_block, BoundsManager
from pyomo.core.base.block import Block, TraversalStrategy
from pyomo.core.expr.current import identify_variables
Expand Down Expand Up @@ -132,14 +133,21 @@ def fbbt_disjunct(disj, parent_bounds):
try:
for var, var_bnds in disj._disj_var_bounds.items():
scope_lb, scope_ub = var_bnds
scope_lb = -inf if scope_lb is None else scope_lb
scope_ub = inf if scope_ub is None else scope_ub
parent_lb, parent_ub = parent_bounds.get(var, (-inf, inf))
orig_bnds[var] = (max(scope_lb, parent_lb), min(scope_ub, parent_ub))
except AttributeError:
# disj._disj_var_bounds does not exist yet
pass
bnds_manager = BoundsManager(disj)
bnds_manager.load_bounds(orig_bnds)
new_bnds = fbbt_block(disj)
try:
new_bnds = fbbt_block(disj)
except InfeasibleConstraintException as e:
if disj.type() == Disjunct:
disj.deactivate() # simply prune the disjunct
new_bnds = parent_bounds
bnds_manager.pop_bounds()
disj._disj_var_bounds = new_bnds
# Handle nested disjuncts
Expand Down

0 comments on commit 0fb1701

Please sign in to comment.