Solver utilities (cpmpy.solvers.utils)
Utilities for handling solvers
List of functions
Recursively yield all combinations of param values |
- class cpmpy.solvers.utils.SolverLookup[source]
- classmethod base_solvers()[source]
Return ordered list of (name, class) of base CPMpy solvers
First one is default
- classmethod get(name=None, model=None)[source]
get a specific solver (by name), with ‘model’ passed to its constructor
This is the preferred way to initialise a solver from its name
- cpmpy.solvers.utils.get_supported_solvers()[source]
Returns a list of solvers supported on this machine.
Deprecated since version 0.9.4: Please use
SolverLookupobject instead.- Returns:
a list of SolverInterface sub-classes :list[SolverInterface]:
- cpmpy.solvers.utils.param_combinations(all_params, remaining_keys=None, cur_params=None)[source]
Recursively yield all combinations of param values
For example usage, see examples/advanced/hyperparameter_search.py https://github.com/CPMpy/cpmpy/blob/master/examples/advanced/hyperparameter_search.py
all_params is a dict of {key: list} items, e.g.:
{'val': [1,2], 'opt': [True,False]}output is an generator over all {key:value} combinations of the keys and values. For the example above:
generator([{'val':1,'opt':True},{'val':1,'opt':False},{'val':2,'opt':True},{'val':2,'opt':False}])