Skip to content

Commit

Permalink
Push changes: pyomo --help solvers tracks all solvers, v1, v2, and appsi
Browse files Browse the repository at this point in the history
  • Loading branch information
mrmundt committed Nov 21, 2023
1 parent 52b8b6b commit 63af991
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
3 changes: 2 additions & 1 deletion pyomo/solver/IPOPT.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import subprocess
import io
import sys
from typing import Mapping
from typing import Mapping, Dict

from pyomo.common import Executable
from pyomo.common.config import ConfigValue, NonNegativeInt
Expand Down Expand Up @@ -153,6 +153,7 @@ class IPOPT(SolverBase):

def __init__(self, **kwds):
self._config = self.CONFIG(kwds)
self.ipopt_options = ipopt_command_line_options

def available(self):
if self.config.executable.path() is None:
Expand Down
10 changes: 10 additions & 0 deletions pyomo/solver/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@


class SolverBase(abc.ABC):
#
# Support "with" statements. Forgetting to call deactivate
# on Plugins is a common source of memory leaks
#
def __enter__(self):
return self

def __exit__(self, t, v, traceback):
pass

class Availability(enum.IntEnum):
FullLicense = 2
LimitedLicense = 1
Expand Down
7 changes: 4 additions & 3 deletions pyomo/solver/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
# This software is distributed under the 3-clause BSD License.
# ___________________________________________________________________________


from pyomo.opt.base import SolverFactory as LegacySolverFactory
from pyomo.common.factory import Factory
from pyomo.solver.base import LegacySolverInterface
Expand All @@ -20,10 +21,10 @@ def decorator(cls):
self._cls[name] = cls
self._doc[name] = doc

# class LegacySolver(LegacySolverInterface, cls):
# pass
class LegacySolver(LegacySolverInterface, cls):
pass

# LegacySolverFactory.register(name, doc)(LegacySolver)
LegacySolverFactory.register(name, doc)(LegacySolver)

return cls

Expand Down

0 comments on commit 63af991

Please sign in to comment.