# limitations under the License. from __future__ import absolute_import import logging from optlang._version import get_versions from optlang.util import list_available_solvers from optlang.interface import statuses import optlang.duality __version__ = get_versions()['version'] del get_versions log = logging.getLogger(__name__) available_solvers = list_available_solvers() # Load classes from preferred solver interface if available_solvers['CPLEX']: from optlang.cplex_interface import Model, Variable, Constraint, Objective elif available_solvers["GUROBI"]: from optlang.gurobi_interface import Model, Variable, Constraint, Objective elif available_solvers['GLPK']: from optlang.glpk_interface import Model, Variable, Constraint, Objective elif available_solvers['SCIPY']: from optlang.scipy_interface import Model, Variable, Constraint, Objective else: log.error('No solvers available.') # Import all available solver interfaces if available_solvers['GLPK']:
def test_list_available_solvers(): solvers = list_available_solvers() for solver, boolean in six.iteritems(solvers): assert boolean is True or boolean is False