Skip to content

Commit

Permalink
Merge pull request #2 from bknueven/mis_bk
Browse files Browse the repository at this point in the history
simplifying the code
  • Loading branch information
DLWoodruff authored Apr 17, 2024
2 parents 1739d99 + a4a9496 commit 73f4a2f
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions pyomo/contrib/iis/mis.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@
logger = logging.getLogger("pyomo.contrib.iis")
logger.setLevel(logging.INFO)

_default_nl_writer = WriterFactory.get_class("nl")


class _VariableBoundsAsConstraints(IsomorphicTransformation):
"""Replace all variables bounds and domain information with constraints.
Expand Down Expand Up @@ -87,7 +85,7 @@ def _apply_to(self, instance, **kwds):


def compute_infeasibility_explanation(
model, solver=None, tee=False, tolerance=1e-8, logger=logger
model, solver, tee=False, tolerance=1e-8, logger=logger
):
"""
This function attempts to determine why a given model is infeasible. It deploys
Expand All @@ -105,7 +103,7 @@ def compute_infeasibility_explanation(
Args
----
model: A pyomo block
solver (optional): A pyomo solver, a string, or None
solver: A pyomo solver object or a string for SolverFactory
tee (optional): Display intermediate solves conducted (False)
tolerance (optional): The feasibility tolerance to use when declaring a
constraint feasible (1e-08)
Expand Down Expand Up @@ -267,10 +265,6 @@ def _constraint_generator():
)

# Phase 2 -- deletion filter
# TODO: the model created here seems to mess with the nl_v2
# writer sometimes. So we temporarily switch to nl_v1 writer.
WriterFactory.register("nl")(WriterFactory.get_class("nl_v1"))

# remove slacks by fixing them to 0
for v in slack_block.component_data_objects(pyo.Var):
v.fix(0)
Expand Down Expand Up @@ -319,8 +313,6 @@ def _constraint_generator():
msg += "Constraints / bounds in guards for stability:"
msg = _get_results(guards, msg)

WriterFactory.register("nl")(_default_nl_writer)

logger.info(msg)


Expand Down

0 comments on commit 73f4a2f

Please sign in to comment.