Is there a way to return solutions in the order that they appear?

I'm trying to do an analysis of the minimum number of runs necessary to get both of my optimal solutions 99% of the time. To do that systematically, I wanted to get all the returns in the order in which they appear without the post-processing of putting them in best to worst order. I'm using the following sampler if it makes a difference.

EmbeddingComposite(DWaveSampler()).sample_qubo()

 

0

Comments

6 comments
  • Hi Zachary - I would approach that by having a loop that returns single reads. For example, num_reads=1. Would that work for you, or is there a reason you would need to batch the reads?

     

    0
    Comment actions Permalink
  • That would work, but that would use a bit more of my time on the system as the time to submit and embed the problem is greater than the time to run one trial. But if it turns out that there isn't an easy way to get that raw data, that is probably what I'll end up doing. Thank you!

    0
    Comment actions Permalink
  • I just tried a casual experiment and confirmed that increasing num_reads seems much more efficient for QPU time than individual jobs of num_reads=1.

    I am not sure how to get the results in the order they were generated, but I do have a thought on a method that may work somewhat efficiently. You could try a binary search, starting with a large number of reads and modify that number by successively dividing the search space (up or down) until you get a number of correct results you feel comfortable with.

    There is a caveat here -- In the system, random really means random. Even if you get a few sets of data that suggest your result is correct with p<0.01, you probably want to run that same experiment a number of times to increase your confidence. I have run a bunch of random distribution experiments, and every now and then the system can yield a surprising result.

    I hope this helps.

     

    0
    Comment actions Permalink
  • If you use the parameter answer_mode as follows, it will return the results as is:

    answer_mode='raw'

    Here is a link to the documentation:
    https://docs.dwavesys.com/docs/latest/c_solver_parameters.html#answer-mode

    I hope this answers your question.
    Please let us know if you need any further information!

    1
    Comment actions Permalink
  • One exception to this is when using SRTs (Spin Reversal Transforms). 
    The order in which they are returned will be nondeterministic. 
    But I don't think you will be using SRTs here.

    0
    Comment actions Permalink
  • That is exactly what I was looking for. Thank you.

    2
    Comment actions Permalink

Please sign in to leave a comment.

Didn't find what you were looking for?

New post