Skip to content

Commit a4a9496

Browse files
committed
simplifying the code
1 parent 1739d99 commit a4a9496

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

pyomo/contrib/iis/mis.py

+2-10
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@
4949
logger = logging.getLogger("pyomo.contrib.iis")
5050
logger.setLevel(logging.INFO)
5151

52-
_default_nl_writer = WriterFactory.get_class("nl")
53-
5452

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

8886

8987
def compute_infeasibility_explanation(
90-
model, solver=None, tee=False, tolerance=1e-8, logger=logger
88+
model, solver, tee=False, tolerance=1e-8, logger=logger
9189
):
9290
"""
9391
This function attempts to determine why a given model is infeasible. It deploys
@@ -105,7 +103,7 @@ def compute_infeasibility_explanation(
105103
Args
106104
----
107105
model: A pyomo block
108-
solver (optional): A pyomo solver, a string, or None
106+
solver: A pyomo solver object or a string for SolverFactory
109107
tee (optional): Display intermediate solves conducted (False)
110108
tolerance (optional): The feasibility tolerance to use when declaring a
111109
constraint feasible (1e-08)
@@ -267,10 +265,6 @@ def _constraint_generator():
267265
)
268266

269267
# Phase 2 -- deletion filter
270-
# TODO: the model created here seems to mess with the nl_v2
271-
# writer sometimes. So we temporarily switch to nl_v1 writer.
272-
WriterFactory.register("nl")(WriterFactory.get_class("nl_v1"))
273-
274268
# remove slacks by fixing them to 0
275269
for v in slack_block.component_data_objects(pyo.Var):
276270
v.fix(0)
@@ -319,8 +313,6 @@ def _constraint_generator():
319313
msg += "Constraints / bounds in guards for stability:"
320314
msg = _get_results(guards, msg)
321315

322-
WriterFactory.register("nl")(_default_nl_writer)
323-
324316
logger.info(msg)
325317

326318

0 commit comments

Comments
 (0)