---
title: Constraint-Preserving Mixers in QAOA
url: https://www.emergentmind.com/topics/constraint-preserving-mixers
type: topic
---

# Constraint-Preserving Mixers in QAOA

Constraint-preserving mixers are mixing operators in QAOA and related alternating-operator constructions that are designed so that quantum evolution remains inside a feasible subspace defined by hard constraints, rather than relying solely on penalty terms in the cost Hamiltonian. In the standard formulation, a level-\(p\) circuit has the form
\[
|\psi(\boldsymbol\gamma,\boldsymbol\beta)\rangle = \prod_{\ell=1}^p \Big[ U_M(\beta_\ell)\, e^{-i\gamma_\ell H_{PS}} \Big] \,|\psi_0\rangle,
\]
and the central design question is how to choose \(U_M(\beta)=e^{-i\beta H_M}\) and \(|\psi_0\rangle\) so that hard constraints are preserved exactly while the feasible subspace remains sufficiently connected for optimization. Across the literature, this program appears as symmetry-preserving \(XY\)-mixers for fixed Hamming weight, Grover-style mixers based on projectors onto feasible superpositions, stabilizer-based logical mixers for arbitrary specified subspaces, graph-controlled permutation mixers for scheduling, and warm-started variants that bias the search without leaving the constrained sector [1904.09314] [2006.00354] [2306.17083] [2604.02083].

## 1. Feasible-subspace dynamics in constrained QAOA

The original \(X\)-mixer,
\[
H_X = \sum_i X_i,
\]
induces transitions between all computational-basis states and therefore does not preserve hard constraints such as one-hot or fixed-cardinality conditions. In graph coloring with one-hot encoding, for example, each vertex \(v\) is represented by qubits \(\{x_{v,c}\}_{c=1}^{\kappa}\) with
\[
\sum_{c=1}^{\kappa} x_{v,c} = 1,
\]
so the feasible subspace is exponentially smaller than the full Hilbert space: for \(n\) vertices and \(\kappa\) colors, the full dimension is \(2^{n\kappa}\), the feasible dimension is \(\kappa^n\), and the ratio is
\[
\left(\frac{\kappa}{2^\kappa}\right)^n.
\]
This makes amplitude leakage into infeasible states especially costly [1904.09314].

In the constraint-preserving formulation, the target is a mixer family that is feasibility preserving and explores the feasible subspace. One explicit definition requires that \(B(\beta)\ket{\psi}\in\mathcal F\) for every feasible \(\ket{\psi}\in\mathcal F\), and that for all feasible \(x,y\in F\) there exist \(\beta^\ast\in\mathbb R\) and \(r\in\mathbb N\) such that \(\left|\bra{y} B(\beta^\ast)^r \ket{x}\right|>0\). This is the precise sense in which a mixer is both constraint-preserving and ergodic on the feasible sector [2311.04100].

Penalty methods remain a baseline, but they enlarge the search space and complicate the energy landscape. In the multi-constrained setting, one standard QUBO route adds every constraint as a quadratic penalty, converts inequalities with slack variables, and then applies the \(X\)-mixer over the full \(2^N\)-dimensional space. Later work explicitly contrasts this with workflows that encode one-hot constraints directly into the mixer and initial state, thereby reducing the effective search space to \(\prod_i d_i\) for one-hot groups of sizes \(d_i\) [2506.03115].

## 2. Conserved quantities and the central role of \(XY\)-mixers

The canonical constraint-preserving mixer for one-hot and fixed-cardinality constraints is the \(XY\)-mixer. For a block of \(d\) qubits, the full \(XY\)-mixer is
\[
H_{XY}^{(d)} = \sum_{j<k} \left( X_j X_k + Y_j Y_k \right),
\]
and the ring version is
\[
H_{\text{ring}}^{(d)} = \sum_{j=0}^{d-1} \left( X_j X_{j+1} + Y_j Y_{j+1} \right),
\]
with indices modulo \(d\). The conserved quantity is the Hamming-weight operator
\[
\hat N = \sum_{j=0}^{d-1} \frac{1-Z_j}{2},
\]
and the key relation is
\[
[H_{XY}^{(d)},\hat N]=0.
\]
Thus, if the initial state lies in the weight-1 sector, evolution under the \(XY\) mixer stays in that sector exactly [2506.03115].

For one-hot graph coloring, this conservation law is often written in terms of the total \(Z\) operator on a vertex register,
\[
Z_{\text{tot},v} := \sum_{c=1}^{\kappa} Z_{v,c},
\]
with feasible states satisfying \(Z_{\text{tot},v}=\kappa-2\). Because
\[
[H_{XY,v}, Z_{\text{tot},v}] = 0,
\]
the mixer acts as a continuous-time quantum walk on the color graph while never leaving the Hamming-weight-1 subspace. On that subspace, each \(X_{v,c}X_{v,c'}+Y_{v,c}Y_{v,c'}\) term acts essentially as a swap between \(|c\rangle_v\) and \(|c'\rangle_v\) [1904.09314].

The natural unbiased initial state for such dynamics is the generalized W-state,
\[
|W_\kappa\rangle = \frac{1}{\sqrt{\kappa}} \sum_{c=1}^{\kappa} |c\rangle,
\]
and for multiple one-hot blocks one uses \(\bigotimes_v |W_\kappa\rangle_v\). This state lies exactly in the feasible subspace and is an eigenstate of the \(XY\)-mixer, making it the analogue of \(|+\rangle^{\otimes n}\) for \(X\)-mixer QAOA [1904.09314].

The same mechanism extends beyond one-hot to general cardinality constraints. For binary selection with \(\sum_i x_i = k\), the embedded constraint operator is proportional to total \(Z\)-magnetization, and each \(XY_{j,k}=\frac12(X_jX_k+Y_jY_k)\) commutes with it. This makes \(XY\)-mixers prototypical constraint-preserving mixers for cardinality-constrained optimization [2505.18396].

## 3. Exact compilation, shallow circuits, and hardware-aware architectures

A major result of the \(XY\)-mixer literature is that constraint preservation need not imply prohibitive circuit depth. For the ring mixer on \(\kappa\) qubits, Jordan–Wigner mapping yields a quadratic fermionic Hamiltonian diagonalizable by a fermionic Fourier transform. This gives an exact implementation of \(e^{-i\beta H_{XY}}\) by: applying the fermionic fast Fourier transform, performing single-qubit \(Z\)-rotations in momentum space, and applying the inverse transform. Under all-to-all connectivity, the FFFT can be implemented in depth \(O(\log \kappa)\); under nearest-neighbor connectivity, Givens rotation networks give depth \(O(\kappa)\). The implementation is exact and introduces no Trotter error [1904.09314].

For the complete-graph \(XY\)-mixer on a one-hot block, the same work gives an exact decomposition into \(\kappa-1\) commuting partitions when \(\kappa=2^m\). Each partition consists of disjoint pairwise \(XY\) interactions induced by bit-flip patterns on the binary labels of the colors, so each layer is constant depth and the total depth is \(O(\kappa)\) on all-to-all hardware. This avoids the \(\Omega(\kappa^2)\) or worse depth that a naïve Trotterization would incur for high precision [1904.09314].

Later architecture work combines these ideas with other constraint encodings. In a multi-constrained QAOA workflow, one-hot constraints are enforced by ring \(XY\)-mixers and \(\ket{W}\)-state initialization, while inequality constraints are implemented through QPE-based Indicator Functions. For a group of size \(d_i\), the initialization depth is
\[
\mathbf{L}_{\text{init}}^{(i)} = 2\left\lceil \log_2 d_i \right\rceil,
\]
and the ring mixer cost per QAOA layer is summarized as
\[
\mathbf{L}_{\text{mixer}} = 4 \;(+2 \text{ if } U_\text{last} \text{ is needed}).
\]
Because groups are independent, mixer depth scales with the largest one-hot block size rather than the total number of variables [2506.03115].

A separate practical caveat arises under Trotterized Adiabatic Evolution. For fully connected \(XY\)-mixers on a single large constraint block, the number of non-commuting term pairs scales as \(O(n^3)\), and Trotter errors can dominate. For multiple disjoint local constraints, by contrast, blockwise \(XY\)-mixers commute across blocks and the dominant Trotter error depends on the size of each block rather than total problem size. This identifies constraint locality as the main hardware-level criterion for when \(XY\)-mixers remain advantageous [2605.02465].

## 4. Beyond \(XY\): Grover, logical, permutation, and algebraic mixer constructions

Grover-type mixers provide a different route. If one can efficiently prepare
\[
|F\rangle = \frac{1}{\sqrt{|F|}} \sum_{x\in F}|x\rangle,
\]
then GM-QAOA uses the projector mixer
\[
U_M(\beta)=e^{-i\beta |F\rangle\langle F|} = I - (1-e^{-i\beta})|F\rangle\langle F|.
\]
This mixer is automatically constraint-preserving because it acts only through the feasible superposition, and it can be implemented exactly as
\[
U_M(\beta)=U_S\Bigl(I-(1-e^{-i\beta})|0\rangle\langle 0|\Bigr)U_S^\dagger.
\]
The trade-off is that complexity shifts from Hamiltonian design to state preparation and a global multi-controlled phase-shift gate [2006.00354].

Locally acting Grover mixers reduce that overhead when the initial state factorizes over disjoint subsystems. If
\[
|\psi_0\rangle = |\psi_0^{(1)}\rangle \otimes \cdots \otimes |\psi_0^{(\ell)}\rangle,
\]
the mixer can be replaced by
\[
U_M(\beta^{(1)},\dots,\beta^{(\ell)}) = \bigotimes_{j=1}^{\ell} e^{-i\beta^{(j)} |\psi_0^{(j)}\rangle\langle\psi_0^{(j)}|}.
\]
On a 7-qubit exact-cover instance, the mixer CNOT count drops from 218 for global GM-QAOA to 28 for the local construction. On a 9-qubit TSP instance, the corresponding counts are 572 and 54, while convergence behavior remains comparable [2606.11530].

LX-mixers generalize the well-known \(X\) and \(XY\) mixers and relax the Grover mixer by using the stabilizer formalism. For a pair of feasible basis states \(\ket{x},\ket{y}\), the primitive mixer
\[
H_{x\leftrightarrow y}=\ket{x}\bra{y}+\ket{y}\bra{x}
\]
can be written as a logical \(X\) times a stabilizer projector,
\[
H_{x\leftrightarrow y}=X\,\Pi_{C(S)}.
\]
This gives a systematic recipe: partition the feasible subspace into stabilizer codespaces, apply logical rotational \(X\) gates within them, and choose a connected union graph over feasible states. Numerical examples show dramatic CX reductions relative to previous constructions [2306.17083].

A separate line of work gives a fully general algebraic formulation. Classical constraints are embedded as observables \(\hat C_i\), and one seeks Hamiltonians or unitary primitives that commute with all \(\hat C_i\). In the general case, finding such operators is NP-Complete, whereas the locality-bounded variant is in P for constant locality \(k\) because all \(k\)-local candidates can be enumerated and checked in worst-case polynomial time [2407.01975]. Graph-controlled permutation mixers for scheduling instantiate the same principle in a different language: constraints are encoded by a conflict graph, and graph-controlled permutation unitaries are proven to be both feasibility preserving and capable of exploring the feasible subspace [2311.04100].

## 5. Warm-starting, trainability, and iterative biasing

Warm-starting introduces bias toward promising regions of the feasible subspace, but it creates a structural problem if the initial state ceases to be the ground state of the mixer. For one-hot constraints, a biased W-state
\[
|W_P\rangle = \sum_{i=1}^k \sqrt{P_i}\,|e_i\rangle
\]
is generally not an eigenstate of the standard \(XY\)-mixer unless all \(P_i=1/k\). A recent construction resolves this by defining
\[
\mathcal{H}_P = \frac{1}{k-1}\sum_{i=1}^{k}\sum_{j>i}^{k} \mathcal{H}_{ij}\!\left(\frac{P_i}{P_i+P_j}\right),
\]
and proving that \(|W_P\rangle\) is the unique ground state of \(\mathcal{H}_P\) in the Hamming-weight-1 sector. The construction extends to arbitrary connected topologies \(G\), preserves Hamming weight, and admits a shallow decomposition in terms of standard \(XY\) gates and single-qubit \(Z\)-rotations [2604.02083].

This enables Iterative Warm-Starting (IWS), where the QAOA angles are optimized once for an initial uniform distribution and then a classical update rule repeatedly modifies the probabilities \(P_{l,i}\) of each one-hot block based on previous samples. The mixer Hamiltonian is updated accordingly, so the current biased W-state remains the mixer ground state at every iteration. On Max-\(k\)-Cut and TSP instances, IWS-QAOA increases the probability of sampling optimal solutions by orders of magnitude compared to standard XY-QAOA, and hardware experiments on ibm_boston with 144-qubit one-hot instances successfully identify optimal solutions after greedy post-processing repairs infeasible measurements caused by noise [2604.02083].

A related trainability analysis studies the dynamical Lie algebras generated by different \(XY\)-mixer topologies. A ring \(XY\)-mixer with arbitrary \(R_Z\) gates yields a DLA of size \(O(n^2)\), whereas all-to-all \(XY\)-mixers or the addition of \(R_{ZZ}\) gates produce exponentially large DLAs. This motivates a warm-start strategy in which optimization begins in a polynomial-sized DLA and then lifts into the exponentially expressive one. Numerical results on Portfolio Optimization, Sparsest \(k\)-Subgraph, and Graph Partitioning show improved convergence and higher-quality optima for both shared-angle and multi-angle QAOA [2505.18396].

Warm-starting can also be combined with constraint-preserving \(XY\)-evolution without redefining the mixer. For 5-city TSP instances, a MaxCut-based warm-start is projected into the one-hot subspace to create a biased product state compatible with an \(XY\)-mixer. The combined warm-started \(XY\) method reaches a mean of \(28.1\%\) true optimal tours at \(p=2\), substantially outperforming both a pure \(XY\)-mixer with W-state initialization and a warm-start-only variant [2504.19934].

## 6. Empirical regimes, trade-offs, and open problems

The strongest empirical case for constraint-preserving mixers comes from problems where the feasible subspace is naturally one-hot or block-cardinality constrained. On graph coloring, level-1 QAOA with an \(X\)-mixer and optimized penalties gives approximation ratio \(r\sim 0.2\) on 3-coloring a triangle, whereas an \(XY\) ring mixer with W-state initial state reaches values near \(r\sim 0.8\). For 2-coloring a triangle, the optimized \(X\)-mixer reaches \(r\approx 0.75\), while the \(XY\)-mixer reaches \(r=1\) at level 1. On the Prism graph, the simultaneous ring \(XY\)-mixer and W-state initial state give average approximation ratio \(\sim 0.8\) at \(p=1\), and by \(p=3\) the probability of sampling an optimal coloring exceeds 0.6 [1904.09314].

For multi-constrained industrial-style problems, the best results come from hybrid architectures. On Prosumer Problem instances, IF+XY achieves RAAR \(>0.95\) across all instances at \(p=12\), retains the highest \(P^\ast\) among the tested methods, and has the smallest TTS\(^\ast\). Compared to QUBO on the smaller instances where QUBO is simulable, the average speedup factor is reported as
\[
r = \mathrm{TTS}^\ast_{\mathrm{QUBO}} / \mathrm{TTS}^\ast_{\mathrm{IF+XY}} \approx 87.
\]
This suggests that search-space restriction can outweigh per-layer circuit complexity when evaluated through time-to-solution rather than raw depth [2506.03115].

A common misconception is that \(XY\)-mixers are uniformly preferable to penalty methods. The Trotterized adiabatic study rejects that blanket statement. For a single global equality constraint spanning all variables, Trotter errors significantly impair \(XY\)-mixer performance, and standard \(X\)-mixers can be more robust. For multiple disjoint local blocks, however, \(XY\)-mixers outperform \(X\)-mixers by several orders of magnitude even under Trotterized evolution. This suggests that the relevant discriminator is not merely “constraint-preserving versus penalties,” but the locality structure of the constraint decomposition [2605.02465].

Practical applications also reveal an objective-design trade-off. In a direct-indexing-style portfolio selection experiment with Dicke-state initialization, an \(XY\)-mixer, and a Trotterized parameter schedule, the QAOA approach achieves a Sharpe Ratio of \(1.81\), compared to \(1.31\) for Simulated Annealing and \(0.98\) for HRP. At the same time, the reported turnover is \(76.8\%\), which indicates that constraint-preserving optimization can improve the discrete selection stage while still requiring explicit transaction-cost or turnover regularization if implementation frictions matter [2602.14827].

Open problems remain stable across the literature. Scaling beyond the small-instance regime is unresolved for several constructions; the effect of noise on elaborate mixers and on nontrivial state preparation remains incompletely characterized; overlapping constraint families such as TSP’s two-way one-hot structure still require specialized higher-order mixers or a mixer-plus-penalty split; and general-purpose synthesis of low-depth, high-connectivity mixers for arbitrary feasible subspaces remains computationally hard in the worst case [1904.09314] [2407.01975] [2605.02465]. A plausible implication is that future progress will continue to combine three ingredients rather than relying on any single primitive: conserved-quantity mixer design, problem-structured compilation, and warm-start or oracle mechanisms that reduce effective search without destroying alignment inside the feasible sector.

Source: https://www.emergentmind.com/topics/constraint-preserving-mixers