dwave_networkx.utils.decorators.binary_quadratic_model_sampler

binary_quadratic_model_sampler(which_args)[source]

Decorator to check sampler arguments.

Parameters:which_args (int or sequence of ints) – Location of the sampler arguments in args. If more than one sampler is allowed, can be a list of locations.
Returns:_binary_quadratic_model_sampler – Function which checks the sampler for correctness. A sampler is expected to have “sample_qubo” and “sample_ising” methods. Alternatively, if no sampler is provided (or sampler is None) the sampler as set by set_default_sampler will be provided to the function.
Return type:function

Examples

Decorate functions like this:

@binary_quadratic_model_sampler(1)
def maximal_matching(G, sampler, **sampler_args):
    pass