mr.piron.Back to the research desk
QUANTUM FRONTIERS

From portfolio constraints to QUBO: a benchmark-first quantum workflow.

Derive the QUBO and Ising coefficients, verify a synthetic portfolio exactly, inspect QAOA and mixer assumptions, and compare the complete workflow with classical solvers.

TECHNICAL RESEARCHAdvanced14 primary sources1,999 words
MR. PIRON / RESEARCH DESK13 min read

01 /Define the portfolio before choosing the hardware

Quantum portfolio optimization is meaningful only after the portfolio problem is specified. Is the task selecting assets, choosing integer lots, fitting a benchmark, or allocating continuous weights? Are return forecasts fixed or estimated inside the experiment? Which constraints are mandatory? Those choices determine the mathematical problem and the correct classical reference.

Start from a continuous mean–variance allocation with turnover control. The covariance must be positive semidefinite, the estimation horizon must match the return forecast, and the risk coefficient must have a documented scale. CVXPY illustrates quadratic portfolio problems, while OSQP documents a convex quadratic solver with affine constraints. [1, 2] These methods provide useful baselines before introducing a discrete encoding.

Selection constraints change the problem. A rule allowing at most K holdings introduces binary decisions linked to weights. Gurobi’s objective documentation distinguishes continuous quadratic programs from mixed-integer quadratic programs. [3] Comparing a quantum selection task only with unconstrained equal weighting misses that distinction. Every benchmark should receive the same universe, information snapshot, objective, constraints and evaluation budget.

Continuous reference problemEQ. 01.1
min⁡w  λw⊤Σw−μ⊤w+κ∥w−w0∥1s.t. 1⊤w=1,  ℓ≤w≤u\min_w\;\lambda w^\top\Sigma w-\mu^\top w+\kappa\lVert w-w_0\rVert_1\quad\text{s.t. }\mathbf1^\top w=1,\;\ell\le w\le u

This is convex when Σ is positive semidefinite and λ, κ are nonnegative. A cardinality constraint requires a different formulation.

02 /A binary selector is a restricted allocation mandate

Consider a deliberately small specification: select exactly K of n assets and assign each selected asset weight 1/K. Let x be the binary selection vector. The return term is the average forecast among selected assets; the variance term is the covariance quadratic form divided by K squared. The resulting objective balances two estimates rather than predicting returns through quantum computation.

This equal-weight restriction matters. A continuous optimizer may find a better portfolio because it has more freedom, not because its search is intrinsically better. Maintain two comparison tracks: solvers for the identical binary problem, and alternative allocation mandates with their differences explicitly recorded. Do not call these interchangeable benchmarks.

For variable allocation sizes, an encoding might represent a bounded position with several bits. With b bits per instrument, n instruments already require nb binary variables before auxiliary variables are counted. Resolution, minimum lots, budget conservation and additional constraints determine whether that larger formulation is practical. D-Wave’s model documentation distinguishes binary quadratic models from constrained models and explains the role of penalty encodings. [4]

Equal-weight selection objectiveEQ. 02.1
g(x)=λK2x⊤Σx−1Kμ⊤x,x∈{0,1}n,  1⊤x=Kg(x)=\frac\lambda{K^2}x^\top\Sigma x-\frac1K\mu^\top x,\qquad x\in\{0,1\}^n,\;\mathbf1^\top x=K

The 1/K and 1/K² factors preserve portfolio units. Removing them changes the relationship between return and variance unless coefficients are adjusted.

03 /Derive the QUBO coefficients and retain the constant

A quadratic unconstrained binary objective handles cardinality by adding a nonnegative penalty. Expand its square using xᵢ² = xᵢ. Declare the coefficient convention before passing it to a library: an upper-triangular coefficient dictionary counts each off-diagonal interaction once, whereas a symmetric matrix quadratic form counts it twice. A factor-of-two mistake can produce a plausible-looking but incorrect portfolio.

The displayed coefficients use a single-count pair convention. Retain the constant when comparing encoded energy with the original penalized objective. A constant does not change an optimizer’s minimizer, but dropping it from one side of a unit check makes reported energy differences misleading.

Turnover can sometimes be included without increasing degree. If the previous binary selection x₀ is fixed, |xᵢ−x₀ᵢ| equals x₀ᵢ + (1−2x₀ᵢ)xᵢ. That adds a linear coefficient and a constant; it is not a general treatment of continuous-weight trading costs. Qiskit Optimization documents conversion between quadratic programs, penalties and Ising operators. [5] Verify the conversion independently on every state of a small instance.

Penalized objective and single-count expansionEQ. 03.1
F(x)=g(x)+A(1⊤x−K)2=C+∑iaixi+∑i<jbijxixjF(x)=g(x)+A(\mathbf1^\top x-K)^2=C+\sum_i a_ix_i+\sum_{i<j}b_{ij}x_ix_j
Coefficients for symmetric covarianceEQ. 03.2
ai=λK2Σii−μiK+A(1−2K),bij=2λK2Σij+2A,C=AK2a_i=\frac\lambda{K^2}\Sigma_{ii}-\frac{\mu_i}K+A(1-2K),\quad b_{ij}=\frac{2\lambda}{K^2}\Sigma_{ij}+2A,\quad C=AK^2

04 /Verify an original four-asset example exactly

Take four synthetic assets A through D, choose two, and set the risk coefficient to two. The following original example uses illustrative annualized forecasts and covariance values; it does not describe securities or historical performance. Six pairs satisfy the mandate. The best pair is B and C with objective −0.01825, forecast return 0.0375 and variance 0.009625.

The code enumerates all sixteen binary states, including invalid selections, and checks the coefficient expansion against the direct penalized objective. This catches diagonal, interaction and constant errors before a sampler enters the workflow. A penalty of 0.1 works for this particular example; it should not be carried into another problem by habit.

The feasible enumeration provides a certified reference for the original binary objective. Larger benchmark instances need an appropriate mixed-integer solver or a clearly labeled best-known reference. SciPy’s milp solves mixed-integer linear problems, not arbitrary quadratic objectives; using it here would require an explicit linearization or another solver. [13]

python / RESEARCH IMPLEMENTATION
from itertools import product

mu = [0.060, 0.045, 0.030, 0.020]
sigma = [
    [0.0400, 0.0080, 0.0040, 0.0020],
    [0.0080, 0.0225, 0.0030, 0.0010],
    [0.0040, 0.0030, 0.0100, 0.0015],
    [0.0020, 0.0010, 0.0015, 0.0064],
]
n, k, risk, penalty = 4, 2, 2.0, 0.1

def original(x):
    variance = sum(x[i] * sigma[i][j] * x[j]
                   for i in range(n) for j in range(n)) / k**2
    forecast = sum(mu[i] * x[i] for i in range(n)) / k
    return risk * variance - forecast

a = [risk * sigma[i][i] / k**2 - mu[i] / k
     + penalty * (1 - 2*k) for i in range(n)]
b = {(i, j): 2*risk*sigma[i][j] / k**2 + 2*penalty
     for i in range(n) for j in range(i+1, n)}
offset = penalty * k**2

def encoded(x):
    return offset + sum(a[i]*x[i] for i in range(n)) + sum(
        value*x[i]*x[j] for (i, j), value in b.items())

states = list(product([0, 1], repeat=n))
for x in states:
    expected = original(x) + penalty * (sum(x)-k)**2
    assert abs(encoded(x) - expected) < 1e-12
feasible = [x for x in states if sum(x) == k]
best = min(feasible, key=original)
assert best == (0, 1, 1, 0)
assert abs(original(best) + 0.01825) < 1e-12

05 /Penalty selection has a proof and a numerical cost

A penalty must be strong enough that an invalid state cannot outperform the best valid state. Suppose the unpenalized objective has total range at most D over all binary states, and at least one valid state exists. Any cardinality violation contributes at least one to the squared penalty. Therefore A greater than D is a sufficient condition: even the lowest unpenalized invalid score becomes worse than every feasible score after the penalty is added.

This is a conservative argument, not a recommended universal setting. The range bound can be much larger than the separation relevant to the best feasible solution. An oversized penalty can make economically meaningful coefficient differences tiny after hardware rescaling. Examine feasibility and original-objective quality over a documented penalty grid, using training instances rather than the final benchmark instances.

Inequality constraints require their own encoding, often with slack variables. Those variables consume bits and alter coefficient ranges. Record how each business rule maps to terms and test violations separately. Report feasibility before repair and after repair. If a post-processing routine routinely replaces invalid answers, its runtime and contribution belong in the result.

06 /Translate binary decisions into an Ising Hamiltonian

For a gate-based experiment, substitute xᵢ = (1−Zᵢ)/2, where measured Pauli-Z eigenvalues are +1 and −1. The substitution yields a constant, single-qubit Z terms and pairwise ZZ terms. The ground-state bitstrings represent minima of the encoded objective. This translation changes the representation, not the financial objective.

The sign convention must be explicit. Here x = 0 corresponds to Z = +1. Libraries can also present spin variables or bitstrings in different orders. Test a known asymmetric portfolio through construction, measurement decoding and final scoring so that reversing a register cannot silently permute assets.

QAOA was introduced as a parameterized approach to combinatorial optimization. [6] Its cost operator can be built from the Ising representation, and IBM’s current tutorial documents a practical circuit and optimization workflow. [7] Solving the Hamiltonian approximately does not guarantee a good forecast, stable portfolio, or feasible business allocation. Those remain separate validation obligations.

Binary-to-Ising mapping under this conventionEQ. 06.1
HC=C~I+∑ihiZi+∑i<jJijZiZj,Jij=bij/4,hi=−ai/2−14∑j≠ibijH_C=\widetilde C I+\sum_i h_iZ_i+\sum_{i<j}J_{ij}Z_iZ_j,\quad J_{ij}=b_{ij}/4,\quad h_i=-a_i/2-\frac14\sum_{j\ne i}b_{ij}

The offset is C̃ = C + ½Σᵢaᵢ + ¼Σᵢ<ⱼbᵢⱼ. Use the same ordered asset register in the circuit and the decoder.

07 /QAOA optimizes a distribution, then samples portfolios

The standard construction starts from a superposition, applies the cost evolution, and then applies a mixing evolution. Repeating this pair p times produces a circuit with angle vectors gamma and beta. A classical optimizer adjusts those angles using an estimated objective. The resulting circuit supplies a distribution of bitstrings, not a single guaranteed optimum.

There are several distinct quantities to track: expected penalized energy, probability of obtaining a valid portfolio, best observed valid score, and the diversity of observed candidates. A lower expectation does not by itself establish a better best feasible answer at a fixed sampling budget. For each shot budget, score decoded candidates against the original objective and constraints.

The training objective may use mean energy or another specified aggregation. Freeze that choice and the optimizer budget before comparing methods. Repeated optimizer starts, angle searches and discarded circuits all consume resources. Include them even when a final circuit is short. A warm start can transfer information from a classical relaxation into a quantum experiment; Qiskit documents one such approach. [9] Give classical baselines equivalent access to the relaxation.

Standard alternating circuitEQ. 07.1
∣ψp(γ,β)⟩=∏ℓ=1p[e−iβℓHMe−iγℓHC]∣+⟩⊗n,HM=∑iXi|\psi_p(\boldsymbol\gamma,\boldsymbol\beta)\rangle=\prod_{\ell=1}^p\left[e^{-i\beta_\ell H_M}e^{-i\gamma_\ell H_C}\right]|+\rangle^{\otimes n},\qquad H_M=\sum_i X_i

Read each layer as cost evolution followed by mixing; circuit execution order determines the ordering of the product. This standard mixer does not preserve cardinality.

08 /Constraint-preserving mixers and hardware-aware design

A standard X mixer explores bitstrings of every cardinality. An XY mixer can preserve Hamming weight under ideal evolution, allowing a fixed-weight initial state to remain within the selection subspace. State preparation, the mixer’s connectivity, and the reachability of useful candidates become part of the design. If the initial state spans several weights, the mixer preserves those sectors rather than magically selecting the desired one.

IBM’s current multi-objective portfolio tutorial demonstrates an XY-based workflow with post-selection. [10] That is a valuable constraint-handling example; report the retained fraction of samples rather than assuming every measurement is usable. A bit-flip error or a different initialization can change feasibility behavior even when the abstract mixer has the right conservation property.

The hardware circuit must be transpiled to native gates and connectivity. IBM documents layout, routing and translation stages. [8] A dense covariance and a dense penalty introduce many interactions, potentially adding routing cost. If couplings are truncated for hardware, describe the approximation and score portfolios on the full original objective. Compare against classical methods given the same sparse proposal model as well.

09 /Build a matched benchmark ladder

Use exact enumeration first, then a suitable mixed-integer solver, then transparent heuristics such as random feasible sampling, greedy swaps and simulated annealing. D-Wave Ocean exposes a classical simulated-annealing sampler with configurable reads, sweeps and seeds. [14] Its use of a QUBO does not make it a quantum calculation. Annealing hardware, gate-based QAOA, and a hybrid service should be named separately.

Measure absolute objective difference whenever an exact optimum is known. A relative difference can be useful, but specify its denominator and avoid presenting a near-zero optimum as a stable normalization. When the reference is only the best solution observed, call the comparison a best-known difference. A solver’s own certified bound provides different information from a collection of heuristic runs.

Match wall-clock budgets, instance information and post-processing. Repeat across instances and seeds, and show distributions rather than only the best trial. Save raw samples before repair. To attribute a hybrid improvement, compare quantum samples alone, classical local search alone, and the combined workflow under comparable resource budgets.

  • Feasibility: valid raw samples / all raw samples, with each constraint checked independently.
  • Quality: best feasible original objective, its gap to a certified or labeled best-known reference, and median results across seeds.
  • Resources: encoding, training, transpilation, queue, quantum execution, decoding and post-processing time reported separately.
  • Robustness: solution changes under forecast, covariance and penalty perturbations; no hidden selection of favorable instances.

10 /Interpret contemporary results at their actual scope

The 2025 IBM/Vanguard research studies portfolio construction with a sampling-based variational scheme combined with classical local search. [11] It is evidence for a particular hybrid experiment and formulation. It should not be restated as a general proof that quantum portfolio selection outperforms classical optimization.

IBM’s accompanying discussion describes comparison with CPLEX on the tested task. [12] More recent documentation is also unusually useful about limitations: the multi-objective tutorial says uniform random sampling performs about as well as its shallow QAOA sampler at the demonstrated larger scale. [10] Those facts support a benchmark-led research agenda.

Qubit count and candidate-space size answer different questions. For example, choosing six of forty assets gives 3,838,380 feasible selections, while an exact statevector represents 2⁴⁰ amplitudes. Difficulty simulating the latter does not prove that searching the former is difficult for a classical optimizer. Likewise, a hardware run proves execution on hardware, not an economically useful advantage. Separate representation, computational comparisons, and future portfolio performance in the conclusions.

11 /An auditable experiment loop and a daily research decision

Freeze a data snapshot and a benchmark manifest before running the experiment. The manifest should contain the universe, return and covariance estimation windows, units, constraints, objective coefficients, seeds and resource limits. Store both raw and post-processed answers. A daily research article should explain what changed in the experiment and why the comparison still addresses the same question.

The loop below makes solver names interchangeable while keeping scoring independent. A sampler is permitted to propose a candidate; a separate checker decides whether it satisfies the mandate. This prevents different packages from quietly using different constraint tolerances, objective conventions or repair routines. The economic objective should also be recalculated after weight-to-lot conversion before any implementation study.

A complete quantum engagement delivers more than a circuit image: an exact mapping test, a set of matched classical baselines, resource accounting, sensitivity results and a clear feasibility ledger. Deployment requires its own operational design. The practical decision is whether the method adds reproducible value on the specified problem after all costs and limitations are counted. That conclusion may justify another research iteration, a hybrid prototype, or keeping the classical method.

text / RESEARCH IMPLEMENTATION
snapshot = freeze_market_inputs_and_constraints()
reference = solve_exact_or_record_certified_bound(snapshot)
for solver in preregistered_solver_set:
    for seed in preregistered_seeds:
        start_total_timer()
        encoded = build_and_verify_solver_representation(snapshot)
        raw = solver.propose(encoded, seed, fixed_budget)
        save_raw_samples_and_resource_breakdown(raw)
        for candidate in decode(raw):
            valid = check_original_constraints(candidate, snapshot)
            score = original_objective(candidate, snapshot) if valid else null
            record(candidate, valid, score, reference)
        record_total_time_including_training_and_postprocessing()
∎

Research is complete only when the assumptions, experiment, and limitations can be reconstructed.

This perspective is research commentary. It does not constitute investment advice or evidence of live strategy performance. Experimental methods require project-specific testing. Equations and code illustrate research formulations, not measured live returns.

More perspectivesExplore the engineering atlas