2
$\begingroup$

Specifically, I can't get the correct result using QAOA,A total of 6 qubits were used in this work,this is part of my code using VQE and QAOA localsim = BasicAer.get_backend('qasm_simulator')

optimizer = SPSA(max_trials=500)
ansatz = TwoLocal(rotation_blocks='ry', entanglement_blocks='cz')
vqe = VQE(op, ansatz, optimizer = optimizer)
results1 = vqe.run(localsim)

and

from qiskit import QuantumCircuit
optimizer = COBYLA(maxiter = 100)
depth = 10
initial = QuantumCircuit(nbr_qubits)
qaoa = QAOA(operator=op, optimizer=optimizer, p = depth,initial_state = initial, quantum_instance=localsim)
results2 = qaoa.run() 

I tried changing depth and optimizer type but it didn't work,The following two pictures are the results of VQE and QAOA respectively enter image description here

enter image description here

Is it because I'm using QAOA incorrectly?

$\endgroup$
2
  • $\begingroup$ What was your operator? $\endgroup$
    – KAJ226
    May 29, 2022 at 18:56
  • $\begingroup$ op is an ising hamiltonian $\endgroup$
    – Zachary
    May 30, 2022 at 4:39

1 Answer 1

2
$\begingroup$

I recommend use the new released version, but you can still plot out iteration with graph and compare them, see what happen. choose of optimizer, depth, max iteration will effect the result. reference: https://learn.qiskit.org/course/ch-applications/simulating-molecules-using-vqe

$\endgroup$

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.