dwave.samplers.TreeDecompositionSolver.sample#
- TreeDecompositionSolver.sample(bqm: BinaryQuadraticModel, num_reads: int | None = 1, elimination_order: List[Hashable] | None = None) 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
.