dwave.system.samplers.LeapHybridSampler.sample#
- LeapHybridSampler.sample(bqm, time_limit=None, **kwargs)[source]#
Sample from the specified binary quadratic model.
- Parameters:
bqm (
dimod.BinaryQuadraticModel
) – 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.
min_time_limit()
calculates (and describes) the minimum time for your problem.**kwargs – Optional keyword arguments for the solver, specified in
parameters
.
- Returns:
Sample set constructed from a (non-blocking)
Future
-like object.- Return type:
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 >>> G = nx.random_geometric_graph(problem_node_count, radius=0.0005*problem_node_count) >>> qubo = dnx.algorithms.independent_set.maximum_weighted_independent_set_qubo(G) >>> bqm = dimod.BQM.from_qubo(qubo) ... >>> # Find a good solution >>> sampler = LeapHybridSampler() >>> sampleset = sampler.sample(bqm)