Created
November 3, 2021 21:12
-
-
Save techwithshadab/88eb511e258aa0de4564b163fa95bf9d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def qaoa(qubitOp): | |
backend = Aer.get_backend('statevector_simulator') # You can switch to different backends by providing the name of backend. | |
seed = 50 | |
cobyla = COBYLA() | |
cobyla.set_options(maxiter=1000) | |
qaoa = QAOA(qubitOp, cobyla, 3) | |
qaoa.random_seed = seed | |
quantum_instance = QuantumInstance(backend=backend, seed_simulator=seed, seed_transpiler=seed) | |
results= qaoa.run(quantum_instance) | |
selection, state, values, probabilities = print_result(results) | |
print(selection_to_picks(num_assets, selection)) | |
return state, values, probabilities |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment