Skip to content

Commit

Permalink
Revert "switch to nl_v1 (for now)"
Browse files Browse the repository at this point in the history
This reverts commit f062086.
  • Loading branch information
bknueven committed Feb 17, 2023
1 parent b028abe commit 0f8bf27
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 14 deletions.
6 changes: 0 additions & 6 deletions watertap/core/plugins/solvers.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
###############################################################################

import pyomo.environ as pyo
from pyomo.opt import WriterFactory
from pyomo.core.base.block import _BlockData
from pyomo.core.kernel.block import IBlock
from pyomo.solvers.plugins.solvers.IPOPT import IPOPT
Expand All @@ -26,7 +25,6 @@
from idaes.logger import getLogger

_log = getLogger("watertap.core")
_default_nl_writer = WriterFactory.get_class("nl")


@pyo.SolverFactory.register(
Expand Down Expand Up @@ -57,9 +55,6 @@ def _presolve(self, *args, **kwds):
if "constr_viol_tol" not in self.options:
self.options["constr_viol_tol"] = 1e-08

# temporarily switch to nl_v1 writer
WriterFactory.register("nl")(WriterFactory.get_class("nl_v1"))

if not self._is_user_scaling():
self._cleanup_needed = False
return super()._presolve(*args, **kwds)
Expand Down Expand Up @@ -153,7 +148,6 @@ def _presolve(self, *args, **kwds):
raise

def _cleanup(self):
WriterFactory.register("nl")(_default_nl_writer)
if self._cleanup_needed:
self._reset_scaling_factors()
self._reset_bounds()
Expand Down
8 changes: 0 additions & 8 deletions watertap/core/plugins/tests/test_solvers.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import pyomo.environ as pyo
import idaes.core.util.scaling as iscale

from pyomo.opt import WriterFactory
from pyomo.solvers.plugins.solvers.IPOPT import IPOPT
from pyomo.common.errors import ApplicationError
from idaes.core.util.scaling import (
Expand All @@ -25,8 +24,6 @@
from idaes.core.solvers import get_solver
from watertap.core.plugins.solvers import IpoptWaterTAP

_default_nl_writer = WriterFactory.get_class("nl")


class TestIpoptWaterTAP:
@pytest.fixture(scope="class")
Expand Down Expand Up @@ -64,11 +61,6 @@ def _test_bounds(self, m):
def s(self):
return pyo.SolverFactory("ipopt-watertap")

@pytest.mark.unit
def test_nl_writer_held_harmless(self, m, s):
s.solve(m, tee=True)
assert _default_nl_writer == WriterFactory.get_class("nl")

@pytest.mark.unit
def test_pyomo_registration(self, s):
assert s.__class__ is IpoptWaterTAP
Expand Down

0 comments on commit 0f8bf27

Please sign in to comment.