dwave.samplers.TreeDecompositionSolver.sample¶
- TreeDecompositionSolver.sample(bqm: dimod.binary.binary_quadratic_model.BinaryQuadraticModel, num_reads: Optional[int] = 1, elimination_order: Optional[List[Hashable]] = None) dimod.sampleset.SampleSet [source]¶
Find ground states of a binary quadratic model.
- Parameters
bqm – Binary quadratic model (BQM).
num_reads – Total number of samples to draw. The samples are drawn in order of energy so if
num_reads=1
, only the ground state is returned. Ifnum_reads=2
, the ground state and the first excited state are returned. Ifnum_reads >= len(bqm)**2
, samples are duplicated.elimination_order – Variable elimination order. Should be a list of the variables in the binary quadratic model. If None, the min-fill heuristic 1 is used to generate one.
- Raises
ValueError – The treewidth of the given BQM and elimination order cannot exceed the value provided in
properties
.
- 1
Gogate & Dechter, “A Complete Anytime Algorithm for Treewidth”, https://arxiv.org/abs/1207.4109