dwave-hybrid
dwave-hybrid copied to clipboard
Clarify/update `SplatComposer` behavior
Note:
-
hybrid.SplatComposer
does not sort output samples by energy- subsequent
hybrid.ArgMin
with the defaultkey="samples.first.energy"
might not pick the best sample by energy - easily fixed by sorting after compose, with e.g:
hybrid.SliceSamples()
, or a more explicithybrid.SliceSamples(sorted_by='energy')
.
- subsequent
-
hybrid.SplatComposer
does not sort input subsamples by energy before composing with a smaller samples set-
if subsamples generator does not produce sorted sampleset, and is seeded by, say, a single initial state, the output sampleset (containing just one sample) might not be the best
-
easily "fixed" by sorting subsamples generator output
-
but a better fix might be to explode the input sample with
hybrid.AggregatedSamples(aggregate=False)
before composing with Splat, followed by a truncate withhybrid.SliceSamples(1)
. So, something like:subsampler = ( hybrid.AggregatedSamples(aggregate=False) | hybrid.SimulatedAnnealingProblemSampler() | hybrid.SplatComposer() | hybrid.SliceSamples(1, ordered_by='energy') )
would make sure the best sample is generated, accounting for boundary conditions.
-
(Originally raised offline by @jackraymond)