Did I find the right examples for you? yes no

All Samples(2)  |  Call(1)  |  Derive(0)  |  Import(1)
Determine available solver interfaces (with python bindings).

Returns
-------
dict
    A dict like {'GLPK': True, 'GUROBI': False, ...}

        def list_available_solvers():
    """Determine available solver interfaces (with python bindings).

    Returns
    -------
    dict
        A dict like {'GLPK': True, 'GUROBI': False, ...}
    """
    solvers = dict(GUROBI=False, GLPK=False, MOSEK=False, CPLEX=False)
    try:
        import gurobipy
        solvers['GUROBI'] = True
        log.info('Gurobi python bindings found at %s' % os.path.dirname(gurobipy.__file__))
    except:
        log.info('Gurobi python bindings not available.')
    try:
        import glpk.glpkpi
        solvers['GLPK'] = True
        log.info('GLPK python bindings found at %s' % os.path.dirname(glpk.glpkpi.__file__))
    except:
        log.info('GLPK python bindings not available.')
    try:
        import mosek
        solvers['MOSEK'] = True
        log.info('Mosek python bindings found at %s' % os.path.dirname(mosek.__file__))
    except:
        log.info('Mosek python bindings not available.')
    try:
        import cplex
        solvers['CPLEX'] = True
        log.info('CPLEX python bindings found at %s' % os.path.dirname(cplex.__file__))
    except:
        log.info('CPLEX python bindings not available.')
    return solvers
        


src/o/p/optlang-0.0.2/optlang/__init__.py   optlang(Download)
log = logging.getLogger(__name__)
 
from .util import list_available_solvers
available_solvers = list_available_solvers()