Skip to content

Commit

Permalink
Move to using expr (not body) when gathering variabels from constraints
Browse files Browse the repository at this point in the history
  • Loading branch information
jsiirola committed Jul 10, 2024
1 parent 399c731 commit 7f84d3e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pyomo/contrib/community_detection/community_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def generate_model_graph(
# Create a list of the variable numbers that occur in the given constraint equation
numbered_variables_in_constraint_equation = [
component_number_map[constraint_variable]
for constraint_variable in identify_variables(model_constraint.body)
for constraint_variable in identify_variables(model_constraint.expr)
]

# Update constraint_variable_map
Expand Down
6 changes: 3 additions & 3 deletions pyomo/contrib/fbbt/fbbt.py
Original file line number Diff line number Diff line change
Expand Up @@ -1576,14 +1576,14 @@ def __init__(self, comp):
if comp.ctype == Constraint:
if comp.is_indexed():
for c in comp.values():
self._vars.update(identify_variables(c.body))
self._vars.update(identify_variables(c.expr))
else:
self._vars.update(identify_variables(comp.body))
self._vars.update(identify_variables(comp.expr))
else:
for c in comp.component_data_objects(
Constraint, descend_into=True, active=True, sort=True
):
self._vars.update(identify_variables(c.body))
self._vars.update(identify_variables(c.expr))

def save_bounds(self):
bnds = ComponentMap()
Expand Down
2 changes: 1 addition & 1 deletion pyomo/util/infeasible.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def log_infeasible_constraints(
if log_variables:
line += ''.join(
f"\n - VAR {v.name}: {v.value}"
for v in identify_variables(constr.body, include_fixed=True)
for v in identify_variables(constr.expr, include_fixed=True)
)

logger.info(line)
Expand Down

0 comments on commit 7f84d3e

Please sign in to comment.