Skip to content

Commit

Permalink
Merge pull request #3226 from bknueven/trivial_constraint_short_circuit
Browse files Browse the repository at this point in the history
Check _skip_trivial_constraints before the constraint body
  • Loading branch information
mrmundt authored Apr 9, 2024
2 parents c68ce66 + ad7011f commit 72c0d44
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
5 changes: 2 additions & 3 deletions pyomo/solvers/plugins/solvers/gurobi_direct.py
Original file line number Diff line number Diff line change
Expand Up @@ -493,9 +493,8 @@ def _add_constraint(self, con):
if not con.active:
return None

if is_fixed(con.body):
if self._skip_trivial_constraints:
return None
if self._skip_trivial_constraints and is_fixed(con.body):
return None

conname = self._symbol_map.getSymbol(con, self._labeler)

Expand Down
5 changes: 2 additions & 3 deletions pyomo/solvers/plugins/solvers/xpress_direct.py
Original file line number Diff line number Diff line change
Expand Up @@ -667,9 +667,8 @@ def _add_constraint(self, con):
if not con.active:
return None

if is_fixed(con.body):
if self._skip_trivial_constraints:
return None
if self._skip_trivial_constraints and is_fixed(con.body):
return None

conname = self._symbol_map.getSymbol(con, self._labeler)

Expand Down

0 comments on commit 72c0d44

Please sign in to comment.