Quantum Computing Asked by Ghostwriter on March 30, 2021
Suppose I run the Qiskit’s QAOA algorithm.
qaoa = QAOA(operator=qubit_operator, p=p, optimizer=optimizer)
result = qaoa.run(quantum_instance)
There is a built-in method that gets me the most likely binary solution for this problem. sample_most_likely(result['eigenstate'])
But how do I get the whole probability distribution of binary solutions? Ultimately, I would like to calculate the expected value for my problem, not the value based solely on the most likely string.
You should be able to use: result['eigenstate']
That should spit out something like (if you are using 4 qubits):
{'0001': 27,
'0010': 20,
'0011': 1821,
'0100': 25,
'0101': 591,
'0110': 46,
'0111': 5347,
'1001': 18,
'1010': 2,
'1011': 226,
'1101': 11,
'1111': 58}
Correct answer by KAJ226 on March 30, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP