Skip to content

Commit

Permalink
add deactivate_trivial_constraints for feasibility subproblem
Browse files Browse the repository at this point in the history
  • Loading branch information
ZedongPeng committed Sep 1, 2023
1 parent 31c8b6a commit 553c8bb
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions pyomo/contrib/mindtpy/algorithm_base_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -1311,6 +1311,20 @@ def solve_feasibility_subproblem(self):
update_solver_timelimit(
self.feasibility_nlp_opt, config.nlp_solver, self.timing, config
)
try:
TransformationFactory('contrib.deactivate_trivial_constraints').apply_to(
self.fixed_nlp,
tmp=True,
ignore_infeasible=False,
tolerance=config.constraint_tolerance,
)
except InfeasibleConstraintException as e:
config.logger.error(
str(e) + '\nInfeasibility detected in deactivate_trivial_constraints.'
)
results = SolverResults()
results.solver.termination_condition = tc.infeasible
return self.fixed_nlp, results
with SuppressInfeasibleWarning():
try:
with time_code(self.timing, 'feasibility subproblem'):
Expand Down Expand Up @@ -1341,6 +1355,9 @@ def solve_feasibility_subproblem(self):
self.handle_feasibility_subproblem_tc(
feas_soln.solver.termination_condition, MindtPy
)
TransformationFactory('contrib.deactivate_trivial_constraints').revert(
self.fixed_nlp
)
MindtPy.feas_opt.deactivate()
for constr in MindtPy.nonlinear_constraint_list:
constr.activate()
Expand Down

0 comments on commit 553c8bb

Please sign in to comment.