SAPI library - how to attain the optimal solution

Hi, I have embedded my coupling matrix and single item matrix to the chimera graph.

I used answer=sapiSolveIsing(solver,h0,j0+jc,'num_reads',x) and newAnswer=sapiUnembedAnswer(answer.solutions,embeddings,'minimize_energy',h,j) to attain the optimal solution.

Will there be a problem? 

It seems that the outputs vary depending on the number of reads. Each read produced different solution. How would I know which read is the optimal? 

Your inputs to the issue would be much appreciated.

Thanks.

0

Comments

9 comments
  • Hello,

    So there are a couple of things.

    Quantum computing in general is probabilistic by nature, so the solution is not guaranteed to be optimal.

    It is possible to determine which solution is the best solution within a set of solutions, because it will have the lowest energy.

    To determine whether a solution is the best possible solution for a given problem is a very difficult problem to solve.

    Increasing the number of reads might lead to finding a more optimal solution, and often this method is used to try to find a better solution.

    Which solutions will be returned from each read is probabilistic.

    In many cases the solutions returned will be useful, even if they are not the most efficient solution, as they will improve efficiency.

    Also, you can imagine a symmetrical problem that has more than one lowest energy solution, with the same energy in each of the lowest energy states.

    In this way, the nature and design of the problem also need to be taken into consideration.

    0
    Comment actions Permalink
  • Hi, I understand that for the sapiSolveIsing(solver,h0,j0+jc,'num_reads',x), The first column of solution has the lowest energy level so it should be the optimal within the range of readout options. Am I correct? Thanks.

    0
    Comment actions Permalink
  • That's right!

    The solutions are returned in best first order.

    So the first one will be the solution with the best energy.

    Each read might produce the same result or a different result.

    Unique solutions are listed.

    So it is possible to do 10 read and have 10 different solutions, just one, or any number in between.

    0
    Comment actions Permalink
  • Hi, I used the following codes to generate the optimal solution per run. I ran it multiple times and it produced different solutions. How can I differentiate which one is the best.

        [h0, j0, jc] = sapiEmbedProblem(H_oh, J_oh, embeddings, A);

        answer = sapiSolveIsing(solver, h0, j0 + jc * chain_strength);

        ans_oh = sapiUnembedAnswer(answer.solutions, embeddings, 'minimize_energy', H_oh, J_oh);

     

    Shall I use read_num as the parameter to get multiple answers which put the best one in the front instead?

     

    Thanks

    0
    Comment actions Permalink
  • That's right!

    You can do "num_reads = 10" for the software to do 10 samplings from the QPU.

    You will know which answer is the best out of these because it will have the lowest energy. 

    You can also compare the energies from different runs if you have the results stored, as long as the problem and embedding haven't changed between runs.

    Does that make sense?

    0
    Comment actions Permalink
  • I am currently having the problem that for each run with num_reads=10/3, the energy displayed for each of the 10/3 solutions is the same. 

    It happened to different problem instances.

    Could you kindly advise where the bug lies? Thanks.

    0
    Comment actions Permalink
  • Just a quick note, I am not sure why you chose the value 10/3. 
    Either way, the value will resolve to 3 I imagine because it's an integer and it should round down in this case.

    I'm not sure what you mean by the energy being the same.
    This could mean a couple of things.

    Do you mean that there is one solution with num_occurences > 1?
    Are the energies the same?
    Are the returned qubit values the same?

    Are you able to post a simple example?

    Depending on the problem formulation/design, multiple answers could have different qubit values and the same energy.

    Also depending on the problem formulation/design, only one solution might be returned with the same energy.

    The objective of the QPU is to try to get the lowest energy possible.
    Sometimes this doesn't quite happen, since the results are probabilistic, and the energy landscape can make it hard to get the lowest energy.

    However, if you are getting back a single result, you might have just chosen a very good problem formulation!

    If you are looking for all of the different energies associated with a problem, not just aiming to get the lowest energy, you might want to use the ExactSolver (as long as the problem is not too big).

    0
    Comment actions Permalink
  • 10/3 means 10 or 3......

    If I put the number of reads to 10, it will give me 10 solutions, each with the same energy level.

    If I put the number of reads to 3, it will give me 3 solutions, each with the same energy level.

    I selected very small problem instances. I don't know whether it is a problem due to the problem instances or due to other issues.

    0
    Comment actions Permalink
  • Will you get 10 unique solutions (i.e. each having different qubit values) but the same energy?
    Do the solutions write out to separate lines but still have the same qubits?

    Are you able to post the output from running the problem on the QPU, as well as a minimal code example that can reproduce the behaviour?

    This might be expected behaviour, so I would just like to verify.
    Thanks for your trouble!

    0
    Comment actions Permalink

Please sign in to leave a comment.

Didn't find what you were looking for?

New post