Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 38 additions & 6 deletions pyomo/contrib/mindtpy/MindtPy.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,22 @@ class MindtPySolver:
CONFIG = _get_MindtPy_config()

def available(self, exception_flag=True):
"""Check if solver is available."""
"""Check whether the solver interface is available.

Parameters
----------
exception_flag : bool, optional
Included for API compatibility and ignored by this implementation.

Returns
-------
bool
Always ``True`` for the MindtPy interface.
"""
return True

def license_is_valid(self):
"""Report whether the MindtPy solver interface is licensed."""
return True

def version(self):
Expand All @@ -101,11 +113,19 @@ def version(self):

@document_kwargs_from_configdict(CONFIG)
def solve(self, model, **kwds):
"""Solve the model.

Args:
model (Block): a Pyomo model or block to be solved

"""Solve a model with the configured MindtPy strategy.

Parameters
----------
model : Block
Pyomo model or block to solve.
**kwds
Additional keyword arguments forwarded to the selected algorithm.

Returns
-------
SolverResults
Results object returned by the selected MindtPy algorithm.
"""
# The algorithm should have been specified as an argument to the solve
# method. We will instantiate an ephemeral instance of the correct
Expand All @@ -124,7 +144,19 @@ def solve(self, model, **kwds):
# Support 'with' statements.
#
def __enter__(self):
"""Return this solver instance for context-manager support."""
return self

def __exit__(self, t, v, traceback):
"""Exit the context manager without additional teardown actions.

Parameters
----------
t : type or None
Exception type if an exception was raised in the context block.
v : BaseException or None
Exception value if an exception was raised in the context block.
traceback : traceback or None
Traceback object if an exception was raised in the context block.
"""
pass
2 changes: 2 additions & 0 deletions pyomo/contrib/mindtpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@
# software. This software is distributed under the 3-clause BSD License.
# ____________________________________________________________________________________

"""MindtPy solver package for Pyomo MINLP decomposition methods."""

__version__ = (1, 0, 0)
Loading
Loading