-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change QAOA observable to problem Hamiltonian #260
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you help me understand how this observable is chosen?
Starting from the circuit we are running: qaoa_barabasi_albert which comes from benchpress. I don't know much about this circuit, but I assume it is trying to solve some problem related to the Barabási-Albert model. Naively, I wouldn't expect this QAOA circuit to have the same Hamiltonian as a QAOA circuit solving a MAXCUT problem. My knowledge of QAOA is quite limited, so I may be missing something.
It's unfortunate that there isn't more documentation on this circuit in benchpress.
Since I was unable to find the problem Hamiltonian or any other observable used in Benchpress, I looked in the literature for QAOA approaches to solving Barabasi-Albert weighted graphs and found the paper I linked in this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah okay, thanks for the explanation, that helps me understand much more (and more than the reading I was doing). I wonder if we should reach out to the benchpress team to get some info on how the qaoa circuits are generated and ask what Hamiltonian they are using.
I have at one blocking comment, and one question.
@@ -235,8 +235,37 @@ def simulate_expvals( | |||
|
|||
else: | |||
density_matrix = simulate_density_matrix(compiled_circuit) | |||
obs_str = "Z" * compiled.num_qubits |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The variable obs_str
still needs to be set in order to be recorded in the results.
obs_str = "Z" * compiled.num_qubits | ||
observable = Operator.from_label(obs_str) | ||
if circuit_name == "qaoa": | ||
observable = Operator( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This observable only represents an operator acting on 4 qubits, but the circuit we are running is 10 qubits. Do we just assume the operator acts as identity on the other 6 qubits?
Fixes #255.
A natural choice of observable for the QAOA circuits is the problem Hamiltonian, instead of the default "ZZZZ..." observable.
In https://arxiv.org/pdf/2009.01095, we see that for binary encoding the problem Hamiltonian is given by:
where, for a 10-qubit circuit as in the UCC benchmarks,
Operator
to facilitate computing the observable.