PennyLaneAI / comments

0 stars 0 forks source link

qml/demos/tutorial_qaoa_maxcut/ #25

Open utterances-bot opened 1 day ago

utterances-bot commented 1 day ago

QAOA for MaxCut | PennyLane Demos

Implementing the quantum approximate optimization algorithm using PennyLane to solve the MaxCut problem.

https://pennylane.ai/qml/demos/tutorial_qaoa_maxcut/

JCpennyChen commented 1 day ago

Hi Angus,

I have a question regarding the circuit implementation in the article. It seems like there's an inconsistency with the expectation values produced by the circuit functions.

# during the optimization phase we are evaluating a term
# in the objective using expval
H = qml.PauliZ(edge[0]) @ qml.PauliZ(edge[1])
return qml.expval(H)

Shouldn't the Hamiltonian H produce expectation values for all qubits, rather than just for edge 0 and 1? Given the small size of the problem, the function might still find the correct solution. However, as the problem size scales up, this approach could be misleading because it's not capturing the expectation values for the entire system.