How can I take many multiple samples from dwave-hybrid

I am using dwave-hybrid framework to create a custom hybrid solver. I want to take 100 samples from this custom solver. Do I need to use hybrid.ArgMin() or not?

iteration = hybrid.RacingBranches(
hybrid.InterruptableTabuSampler(),
hybrid.RandomSubproblemDecomposer(size=70)
| hybrid.QPUSubproblemAutoEmbeddingSampler(qpu_sampler=neal.SimulatedAnnealingProblemSampler(num_sweeps=num_sweep,
num_reads=100)
)
| hybrid.SplatComposer()
) | hybrid.ArgMin() | hybrid.TrackMin(output=True)

Because I think ArgMin() only choose the first lowest-energy sample, not output 1000 samples for me.
 
0

Comments

5 comments
  • Hello,

    Our apologies for the delayed response. 
    We're just taking a look into possible solutions for the problem you mentioned above.

    My first impression is that ArgMin will drop all but the best solution to pass into the next iteration of the loop.
    That said, there might be an alternative, or some way of creating an alternative with a little coding.

    We will try to get back to you with some more tools, or suggestions to help you move forward with your workflow.

    Thank you for your patience and understanding!
    Feel free to ask more questions if needed.

    0
    Comment actions Permalink
  • Hi again,

    So how ArgMin works is that it picks the branch with the best solution to pass back through the loop.

    For instance, if the TabuSampler has a better result at the end of the second iteration of the loop, this branch's result will be passed into the start of the third iteration of the loop.

    If branch that has the lowest energy has an algorithm that provides multiple sample sets, then they will be available in following iterations, or in the returned value.

    One option is to make a workflow with only one branch if you are interested in only one kind of solver.

    Another option is using something like the following in place of ArgMin():

    MergeSamples() | SliceSamples(5)

    MergeSamples will produce an aggregate sampleset of all input samplesets.

    SliceSamples can reduce the sampleset size, it orders by energy by default, and then select a subset of samples with a slice (range).

    There are also a couple of example workflows that do not use ArgMin:
    PopulationAnnealing
    ParallelTempering

    I hope this is helpful!

    0
    Comment actions Permalink
  • Thank you so much. I will take a look and spend my time into your reference links.

    0
    Comment actions Permalink
  • There is just a minor issue with the above.
    We found a bug that we are looking into now.
    For the moment MergeSamples won't work.
    I will let you know as soon as I have a workaround or solution.

    1
    Comment actions Permalink
  • Here is the bug issue for reference:
    https://github.com/dwavesystems/dimod/issues/701

    0
    Comment actions Permalink

Please sign in to leave a comment.

Didn't find what you were looking for?

New post