# dwave.system.samplers.LeapHybridSampler.sample¶

LeapHybridSampler.sample(bqm, time_limit=None, **kwargs)[source]

Sample from the specified binary quadratic model.

Parameters: bqm (dimod.BinaryQuadraticModel) – The binary quadratic model. time_limit (int) – Maximum run time, in seconds, to allow the solver to work on the problem. Must be at least the minimum required for the number of problem variables, which is calculated and set by default. The minimum time for a hybrid solver is specified as a piecewise-linear curve defined by a set of floating-point pairs, the minimum_time_limit field under LeapHybridSampler.properties. The first element in each pair is the number of problem variables; the second is the minimum required time. The minimum time for any particular number of variables is a linear interpolation calculated on two pairs that represent the relevant range for the given number of variables. For example, if LeapHybridSampler().properties[“minimum_time_limit”] returns [[1, 0.1], [100, 10.0], [1000, 20.0]], then the minimum time for a 50-variable problem is 5 seconds, the linear interpolation of the first two pairs that represent problems with between 1 to 100 variables. **kwargs – Optional keyword arguments for the solver, specified in LeapHybridSampler.parameters. A dimod SampleSet object. dimod.SampleSet

Examples

This example builds a random sparse graph and uses a hybrid solver to find a maximum independent set.

>>> import dimod
>>> import networkx as nx
>>> import dwave_networkx as dnx
>>> import numpy as np
...
>>> # Create a maximum-independent set problem from a random graph
>>> problem_node_count = 300