-
Notifications
You must be signed in to change notification settings - Fork 13
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
Alternative initial QAOA state. #16
Comments
Hi, thanks for submitting the issue zz_exp = 0
for edge in G.edges:
comp = MyCustomComposer(solution=rotated)
comp.energy_expectation_lightcone(edge)
zz_exp += sim.simualte(comp.circuit)
full_exp = 05*(G.number_of_edges - zz_exp)
Can you check what's the energy for |+> initial state with same gamma=beta=0? My guess is that it'll be 5.6247672 |
Yes, it does supply the proper circuit when using the alternative initial state. I didn't list it in the above, but I also modified to various parts so that With the standard initial state |
I checked probability amplitudes and they are equal up to a phase shift https://github.com/danlkv/QTensor/blob/warm_start/qtensor/tests/test_warm_start.py. There is a bug is in lightcone optimization, it treats all qubits as equal, which is not the case for the warm start state. I added a monkey patch in the Note that you can obtain amplitudes from qtensor using |
Great! I agree that the two constructions agree in this regard. Additionally, I recently looked at the exact p=1 analytic result and can also confirm that both the qiskit and qtensor codes faithfully generate this result as well. |
In place of the standard all |+> state (created by layer_of_Hadamards), one may also want to supply a different initial state. Similar in structure, I am interested in creating separable state, given by the code below.
This is contained within CircuitComposer and is called the same way as layer_of_Hadamards. In this definitions case, 'solution' is supplied as a list in the form of [ [z_1,x_1],[z_2,_x_2]... ] to WeightedQAOASimulator. However, when using this initial state, the resulting energy of this initial state is not as expected. In this case I am using WeightedQAOASimulator but this particular example is an unweighted graph. Additionally, for the "standard" initial state, all cases match within numerical precision, so it's likely some issue with this different initial state.
For an example:
Qtensor Energy
This returns an energy of 5.624767271462993
Qiskit and Cirq
Both qiskit and cirq in this case return an energy of ~4.998846035923315 . Note that the qiskit circuit is "flipped" since qiskit defines the ordering of qubits differently than cirq.
The text was updated successfully, but these errors were encountered: