Skip to content

Commit

Permalink
Merge pull request Pyomo#3165 from MAiNGO-github/maingo_interface
Browse files Browse the repository at this point in the history
Added MAiNGO appsi-interface
  • Loading branch information
mrmundt committed May 8, 2024
2 parents f8459a7 + fbd9a0a commit 34b15d8
Show file tree
Hide file tree
Showing 10 changed files with 1,024 additions and 107 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/test_branches.yml
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,8 @@ jobs:
|| echo "WARNING: Gurobi is not available"
python -m pip install --cache-dir cache/pip xpress \
|| echo "WARNING: Xpress Community Edition is not available"
python -m pip install --cache-dir cache/pip maingopy \
|| echo "WARNING: MAiNGO is not available"
if [[ ${{matrix.python}} == pypy* ]]; then
echo "skipping wntr for pypy"
else
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/test_pr_and_main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,8 @@ jobs:
|| echo "WARNING: Gurobi is not available"
python -m pip install --cache-dir cache/pip xpress \
|| echo "WARNING: Xpress Community Edition is not available"
python -m pip install --cache-dir cache/pip maingopy \
|| echo "WARNING: MAiNGO is not available"
if [[ ${{matrix.python}} == pypy* ]]; then
echo "skipping wntr for pypy"
else
Expand Down
14 changes: 14 additions & 0 deletions doc/OnlineDocs/library_reference/appsi/appsi.solvers.maingo.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
MAiNGO
======

.. autoclass:: pyomo.contrib.appsi.solvers.maingo.MAiNGOConfig
:members:
:inherited-members:
:undoc-members:
:show-inheritance:

.. autoclass:: pyomo.contrib.appsi.solvers.maingo.MAiNGO
:members:
:inherited-members:
:undoc-members:
:show-inheritance:
1 change: 1 addition & 0 deletions doc/OnlineDocs/library_reference/appsi/appsi.solvers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ Solvers
appsi.solvers.cplex
appsi.solvers.cbc
appsi.solvers.highs
appsi.solvers.maingo
4 changes: 2 additions & 2 deletions pyomo/contrib/appsi/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1661,15 +1661,15 @@ def license_is_valid(self) -> bool:

@property
def options(self):
for solver_name in ['gurobi', 'ipopt', 'cplex', 'cbc', 'highs']:
for solver_name in ['gurobi', 'ipopt', 'cplex', 'cbc', 'highs', 'maingo']:
if hasattr(self, solver_name + '_options'):
return getattr(self, solver_name + '_options')
raise NotImplementedError('Could not find the correct options')

@options.setter
def options(self, val):
found = False
for solver_name in ['gurobi', 'ipopt', 'cplex', 'cbc', 'highs']:
for solver_name in ['gurobi', 'ipopt', 'cplex', 'cbc', 'highs', 'maingo']:
if hasattr(self, solver_name + '_options'):
setattr(self, solver_name + '_options', val)
found = True
Expand Down
5 changes: 4 additions & 1 deletion pyomo/contrib/appsi/plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

from pyomo.common.extensions import ExtensionBuilderFactory
from .base import SolverFactory
from .solvers import Gurobi, Ipopt, Cbc, Cplex, Highs
from .solvers import Gurobi, Ipopt, Cbc, Cplex, Highs, MAiNGO
from .build import AppsiBuilder


Expand All @@ -30,3 +30,6 @@ def load():
SolverFactory.register(name='highs', doc='Automated persistent interface to Highs')(
Highs
)
SolverFactory.register(
name='maingo', doc='Automated persistent interface to MAiNGO'
)(MAiNGO)
1 change: 1 addition & 0 deletions pyomo/contrib/appsi/solvers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@
from .cplex import Cplex
from .highs import Highs
from .wntr import Wntr, WntrResults
from .maingo import MAiNGO
Loading

0 comments on commit 34b15d8

Please sign in to comment.