Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
:param n_sample: The number of sampling time of each measurement in VQE.
If None, use calculated ideal value.
:param edges: The edges list of the graph.
:returns Vqe object
"""
sampler = sampler or vqe.non_sampling_sampler
minimizer = minimizer or vqe.get_scipy_minimizer(
method="Powell",
options={"ftol": 5.0e-2, "xtol": 5.0e-2, "maxiter": 1000, "disp": True}
)
hamiltonian = pauli.I() * 0
for i, j in edges:
hamiltonian += pauli.Z(i) * pauli.Z(j)
return vqe.Vqe(vqe.QaoaAnsatz(hamiltonian, n_step), minimizer, sampler)