4
$\begingroup$

I am using Qiskit's QAOA for optimization and I would like to extract the probabilities distribution obtained in the optimization loop when running the circuit with the optimal parameters set. To do this I have extrapolated the QAOA circuit and assigned the optimal parameters, however the result is different with respect to the expected one (i.e., the optimal state has different probability than the one reported at the end of the optimization loop). To replicate the optimal circuit output exactly, I have set the seed_simulator parameter in the AerSampler to a fixed value, however, when doing this, the optimizer stops working, in the sense that all the QAOA parameters values give the same energy, so the optimization process does not let the solution evolve.

Below the code used to set the sampler and run the optimization:

from qiskit_aer.primitives import Sampler as AerSampler
from qiskit.algorithms.optimizers import COBYLA

QAOA_LAYERS=1

SAMPLER_QAOA=AerSampler(backend_options={"method": "statevector", "seed_simulator":SEED})
SAMPLER_QAOA.set_options(run_options={"shots":1000, "seed":SEED},  transpiler_options={"seed": SEED})

QAOA_MES = QAOA(sampler=SAMPLER_QAOA, optimizer=COBYLA(), initial_point=INITIAL_GUESS, reps=QAOA_LAYERS, callback=callback)
QAOA_SOLVER = MinimumEigenOptimizer(QAOA_MES)
QAOA_RESULT = QAOA_SOLVER.solve(QUBO_OPT_PROBLEM)

Here's the optimizer solutions list with the parameters beta and gamma sampled mean value (which does not change anyway) enter image description here

Is there any way to set the seed without destroying the optimization or to recover the optimal (and not the last) probability distribution?

$\endgroup$
1
  • $\begingroup$ If you're absolutely sure that setting the seed is the root cause of this behavior, you should probably inform the Qiskit team on GitHub: github.com/Qiskit/qiskit/issues $\endgroup$
    – Tristan Nemoz
    Commented Sep 1, 2023 at 14:39

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.