dwave_networkx.default_sampler.set_default_sampler

set_default_sampler(sampler)[source]

Sets a default binary quadratic model sampler.

Parameters:sampler – A binary quadratic model sampler. A sampler is a process that samples from low energy states in models defined by an Ising equation or a Quadratic Unconstrained Binary Optimization Problem (QUBO). A sampler is expected to have a ‘sample_qubo’ and ‘sample_ising’ method. A sampler is expected to return an iterable of samples, in order of increasing energy.

Examples

>>> dnx.set_default_sampler(sampler0)  
>>> indep_set = dnx.maximum_independent_set_dm(G)  
>>> indep_set = dnx.maximum_independent_set_dm(G, sampler1)