QAOAAnsatz¶
- class QAOAAnsatz(local_field=<class 'qiskit.circuit.library.standard_gates.ry.RYGate'>)[source]¶
Bases:
AnsatzQAOA-style ansatz inspired by Killoran et al. (2020).
Each of the
Llayers consists of a Hadamard encoding layer followed by a weight Hamiltonian:for
n_qubits == 1— a single local-field rotation;for
n_qubits == 2— oneRZZon the pair, then one local field per qubit (no wrap-around);for
n_qubits >= 3—RZZgates on a closed ring (i ↔ (i+1) % n), then one local field per qubit.
A trailing Hadamard layer is applied after the
L-th weight Hamiltonian. The default local field isRYGate.- Parameters:
local_field (
type[Gate]) – Single-qubit rotation used as the local field. Must be one ofRXGate,RYGate,RZGate. Defaults toRYGate.
Methods Summary
build(params, n_qubits, n_layers, **kwargs)Build the QAOA ansatz circuit.
n_params_per_layer(n_qubits, **kwargs)Per-layer parameter count.
Methods Documentation