用于 MaxCut 的 QAOA |PennyLane 演示
I have a problem that Why here is
neg_obj -= 0.5 * (1 - circuit(gammas, betas, edge=edge, n_layers=n_layers))
the cost function is C_{ij} = 1/2(1 − Z_j Z_k)
circuit()=Z_jZ_k
?
def objective(params):
gammas = params[0]
betas = params[1]
neg_obj = 0
for edge in graph:
# objective for the MaxCut problem
neg_obj -= 0.5 * (1 - circuit(gammas, betas, edge=edge, n_layers=n_layers))
return neg_obj
Thank you for your reply!
Best wishes.