49
49
logger = logging .getLogger ("pyomo.contrib.iis" )
50
50
logger .setLevel (logging .INFO )
51
51
52
- _default_nl_writer = WriterFactory .get_class ("nl" )
53
-
54
52
55
53
class _VariableBoundsAsConstraints (IsomorphicTransformation ):
56
54
"""Replace all variables bounds and domain information with constraints.
@@ -87,7 +85,7 @@ def _apply_to(self, instance, **kwds):
87
85
88
86
89
87
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
91
89
):
92
90
"""
93
91
This function attempts to determine why a given model is infeasible. It deploys
@@ -105,7 +103,7 @@ def compute_infeasibility_explanation(
105
103
Args
106
104
----
107
105
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
109
107
tee (optional): Display intermediate solves conducted (False)
110
108
tolerance (optional): The feasibility tolerance to use when declaring a
111
109
constraint feasible (1e-08)
@@ -267,10 +265,6 @@ def _constraint_generator():
267
265
)
268
266
269
267
# 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
-
274
268
# remove slacks by fixing them to 0
275
269
for v in slack_block .component_data_objects (pyo .Var ):
276
270
v .fix (0 )
@@ -319,8 +313,6 @@ def _constraint_generator():
319
313
msg += "Constraints / bounds in guards for stability:"
320
314
msg = _get_results (guards , msg )
321
315
322
- WriterFactory .register ("nl" )(_default_nl_writer )
323
-
324
316
logger .info (msg )
325
317
326
318
0 commit comments