---
title: Adaptive Cost Encoding for Quantum Optimization
url: https://www.emergentmind.com/topics/adaptive-cost-encoding-ace
type: topic
---

# Adaptive Cost Encoding for Quantum Optimization

The QCE-ACF framework refers to a hybrid methodology for quantum circuit design and optimization in binary combinatorial contexts, comprising Quantum Circuit Evolution (QCE) augmented with an Adaptive Cost Function (ACF). This approach is classical-optimizer-free, leveraging evolutionary circuit construction coupled with generation-wise dynamic cost evaluation to escape stagnation and accelerate convergence, particularly in noisy intermediate-scale quantum (NISQ) settings [2503.22404].

## 1. Framework Architecture and Evolution Dynamics

QCE-ACF operates on the principle of evolutionary search in quantum circuit space. Each parent circuit $U_g$ is represented as a gate sequence drawn from a non-fixed gate-set $\{R_x, R_y, R_z, CR_x, CR_y, CR_z, R_{xx}, R_{yy}, R_{zz}\}$, with open depth and connectivity constraints. At each generation $g$, $K$ offspring are generated using randomized local mutations:

- **Insert a gate:** applies $p_\text{insert}$
- **Delete a gate:** applies $p_\text{delete}$
- **Swap gate order:** applies $p_\text{swap}$
- **Modify parameters:** applies $p_\text{modify}$

Each offspring circuit is evaluated via a selected cost function, and the best performer replaces the parent for the next generation. This approach avoids reliance upon gradient-based classical optimizers, characteristic of QAOA, yet can experience convergence stagnation when mutations yield only marginal cost changes.

High-level pseudocode for baseline QCE is:

```python
Algorithm QCE-Baseline
Input: cost H_C, max generations G_max, mutation probs, K, shots N_t
Initialize U_0 ← random single-gate circuit
for g = 0 to G_max−1:
    for i = 1 to K:
        U_{g,i} ← mutate(U_g)
        cost_i ← EvaluateCost(U_{g,i})
    U_{g+1} ← U_{g,i*}, where i* = argmin_i cost_i
    if convergence criterion met: break
Output: best circuit U*
```

## 2. Combinatorial Problem Formulation and Cost Function Foundation

Binary optimization problems, such as set-partitioning, are encoded in QUBO form:

\[
C(x) = \sum_{p\in P} w_p x_p  + \sum_{i\in I} \rho_i \left( \sum_{p: i\in I_p} x_p - 1 \right)^2
\]

where $C(x)$ denotes classical cost for measured bit-string $x$. The circuit cost is empirically:

\[
\langle C \rangle = \frac{1}{N_t} \sum_{x} f_x \cdot C(x)
\]

with $f_x$ the measurement frequency of outcome $x$ among $N_t$ total shots.

## 3. Adaptive Cost Function (ACF) Principle and Mechanism

The core innovation in QCE-ACF is the introduction of an adaptive scoring scheme, which selectively discards or down-weights infeasible measurement outcomes at each generation. The primary motivation is to reshape the fitness landscape, encouraging evolutionary search to favor circuits that yield feasible solutions and to overcome changeless cost plateaus.

Let $M_g$ be measured outcomes at generation $g$ split into feasible ($F_g$) and violation ($V_g$) sets. The cost averages are:

- **Feasible present:** 

\[
\langle C_g \rangle_F = \frac{1}{N_t - |V_g|} \sum_{x \in F_g} f_x C(x)
\]

- **No feasible sample:** identify $x_m = \arg\max_{x\in V_g} f_x$, then

\[
\langle C_g \rangle_V = \frac{1}{N_t - |V_{g,m}|} \sum_{x \in V_g \setminus \{x_m\}} f_x C(x)
\]

The adaptive cost function for generation $g$ is:

\[
\text{ACF}_g(U) = 
\begin{cases}
\langle C_g \rangle_F & \text{if } F_g \neq \emptyset \\
\langle C_g \rangle_V & \text{if } F_g = \emptyset
\end{cases}
\]

This piecewise evaluation effectively discards the most frequent violating outcomes or all infeasible shots, adapting the fitness landscape iteratively.

## 4. Implementation Parameters and Workflow

The QCE-ACF process employs the following settings:

- Measurement shots per circuit: $N_t = 1024$
- Offspring per generation: $K = 4$
- Mutation probabilities: all set to $0.25$
- Generations to convergence: typically $G_{max} = 50$–$100$

At each generation, for each offspring, measurement outputs are partitioned according to feasibility. The ACF is applied in every generation, supplanting the static cost function of baseline QCE.

The corresponding pseudocode is:

```python
Algorithm QCE-ACF
Input: H_C, G_max, N_t, K, mutation probabilities
Initialize U_0 ← random single-gate circuit
for g = 0 to G_max−1:
    for i = 1 to K:
        U_{g,i} ← mutate(U_g)
        Run U_{g,i} for N_t shots → {f_x}
        Partition M_g → F_g, V_g
        if F_g ≠ ∅:
            cost_i ← (1/(N_t–|V_g|))·sum_{x∈F_g} f_x C(x)
        else:
            x_m = argmax_{x∈V_g} f_x
            cost_i ← (1/(N_t–f_{x_m}))·sum_{x∈V_g\{x_m\} f_x C(x)
    U_{g+1} ← U_{g,i*}, where i* = argmin_i cost_i
    if cost_i* plateaued: break
Output U*, samples
```

## 5. Quantitative Performance and Benchmarks

The QCE-ACF framework has been tested on set-partitioning instances of 14 and 20 qubits against standard QAOA:

| Instance | QAOA Ratio | QAOA Time (s) | QCE-ACF Ratio | QCE-ACF Time (s) |
|----------|------------|---------------|---------------|------------------|
| 14.1     | 1.0        | 19.37         | 1.0           | 1.08             |
| 14.2     | 1.0        | 18.03         | 1.0           | 0.63             |
| 20.1     | 1.0        | 1694.8        | 1.0           | 9.50             |
| 20.10    | 1.0        | 1643.6        | 1.0           | 2.34             |

Both QAOA and QCE-ACF achieve global optimum (Ratio=1.0), but QCE-ACF consistently outpaces QAOA with execution times one or two orders of magnitude lower. Under noise, QCE-ACF maintains accuracy and speed:

| Instance | QAOA Ratio | QAOA Time (s) | QCE-ACF Ratio | QCE-ACF Time (s) |
|----------|------------|---------------|---------------|------------------|
| 14.1     | 1.0        | 117.17        | 1.0           | 1.35             |
| 14.7     | 1.0        | 176.13        | 1.0           | 38.20            |

This suggests that QCE-ACF is robust to quantum gate and measurement noise, attributable to shallow circuit depths and ACF's targeted evaluation.

## 6. Noise Resilience and Practical Guidelines

Injected noise consists of two-qubit depolarizing errors and readout faults, modeled via Qiskit AerSimulator. QCE-ACF consistently produces shallow-depth circuits, typically $\lesssim$30 layers for 14 qubits, limiting the total effect of error channels. The ACF mechanism discards noisy, infeasible outputs, focusing selection on legitimate candidates.

Recommended practical settings:

- Maintain shallow circuits under ACF directive.
- Use $\approx$1024 measurement shots for stable estimates.
- Tune penalty weights $\rho_i$ to avoid scarcity of feasible strings for large problems.

A plausible implication is that ACF-guided evolution is particularly suitable for NISQ algorithm deployment where error mitigation is critical.

## 7. Comparative Insights and Application Scope

QCE-ACF’s improved convergence over standard QCE and efficient outperformance of QAOA stems from dynamic cost landscape reshaping. By focusing evolutionary pressure on feasible, high-quality bit-strings and discarding infeasible solutions adaptively, it circumvents the stagnation endemic to naive mutation selection. This principle generalizes across constrained binary optimization problems encoded as QUBO, supporting:

- Fast quantum circuit synthesis without deep circuit requirements
- Noise resilience due to emphasis on low-error measurement strings
- Applicability to large, constraint-dense binary domains

To apply QCE-ACF:

1. Encode target as a QUBO Hamiltonian.
2. Set $N_t \approx 10^3$, $K=4$, uniform mutation rates, $G_{max}=50$–$100$.
3. Use measurement-based ACF in place of default cost (as in eqs. 7–9).
4. Monitor convergence for infeasibility dominance and invoke violation-discarding logic accordingly.
5. Expect efficient, shallow-circuit solution discovery even under substantial quantum hardware noise.

In summary, QCE-ACF constitutes a flexible evolutionary circuit design paradigm with an adaptive evaluation strategy, yielding rapid convergence and optimality in quantum binary optimization tasks and maintaining robustness under realistic noise models [2503.22404].

Source: https://www.emergentmind.com/topics/adaptive-cost-encoding-ace