HHaering Solutions
← Back/Project/Quantitative Finance/ETH IFOR · swissQuant
swissQuant

A Custom Portfolio Optimizer, Up to 40% More Risk-Return Efficient Than Standard Heuristics

A spatial Branch-and-Bound built at ETH IFOR with swissQuant, delivering certified-optimal portfolios on a non-convex problem standard MIP solvers can only attempt heuristically

Year
2023
Partner
swissQuant
Domain
Quantitative Finance

Modern asset managers want portfolios where every position carries a fair share of risk, not just a fair share of capital. The constraint that enforces this is mathematically nasty, and most off-the-shelf solvers either give up or return numbers no one can defend in front of a risk committee.

We worked with swissQuant and ETH Zurich's Institute for Operations Research to build a Branch-and-Bound algorithm that solves the problem to certified global optimality. The output isn't just a portfolio, it's a portfolio with a proof.

+40%
more risk-return efficient than the heuristic baseline on 33-asset MSCI World portfolios
2.5×
lower portfolio variance than the heuristic in the pure risk-minimization regime
Certified
global optimum on a non-convex QCQP standard MIP solvers cannot solve to optimality
Production-ready
documented Python implementation for swissQuant's valuation pipeline
The Challenge

What we set out to solve

swissQuant's institutional clients required portfolios where each asset's marginal contribution to total volatility stays inside a tight tolerance. The math behind that constraint is non-convex, and off-the-shelf quadratic and conic solvers either return infeasible solutions or hit time limits as the asset universe grows.

Heuristics produce a point but no bound on how far that point sits from optimal. That's awkward when the result has to land on a portfolio manager's desk and be defended.

Our Approach

How we solved it

We reformulated the problem as a Quadratically Constrained Quadratic Program and built a spatial Branch-and-Bound algorithm with custom convex relaxations on every node. Tight bound-tightening, smart branching rules, and a benchmark of six algorithmic variants on real MSCI World data identified the configuration that consistently wins.

Alongside the exact engine, we shipped two industry-friendly heuristics that warm-start the search or serve as a fast fallback when a certified optimum isn't worth the wait.

Outcome

What we delivered

Deliverable: a documented Python implementation of the spatial Branch-and-Bound on McCormick relaxations, the two warm-start heuristics, and the reproducible MSCI World test harnesses, ready to plug into swissQuant's internal valuation pipeline.

On real five-year MSCI World data (top-100 instruments, four-currency basket, daily log-returns Jan 2015 – Jan 2020), the algorithm closes a 40% objective gap left open by the iterative heuristic on 33-asset portfolios. In the most non-convex regime (n = 11, τ = 1) the heuristic returns a positive objective where the true optimum is negative, a 160% relative gap; our algorithm finds the certified optimum.

Technical deep dive

The model, the benchmarks, the figures from the report.

Below: the underlying mathematical formulation, the numbers we measured, and the figures we drew on. For readers who want the details.

The model, in math

We measure portfolio risk by volatility R(x) = √(xᵀΣx). For a long-only portfolio x, the marginal risk contribution of asset i follows from the Euler decomposition of volatility:

Marginal risk contributions sum exactly to the portfolio's total volatility.

Relative marginal risk: asset i may contribute at most a fraction cᵢ of the total risk.

Problem (P): mean-variance with rMRC constraints. τ trades off risk against expected return μ.

Reformulation: auxiliary variables y, z lift all the non-convexity into clean bilinear equalities.

The McCormick envelope: four linear inequalities per asset that bound the bilinear term z_i = x_i y_i given box bounds on (x_i, y_i).

Each Branch-and-Bound node solves a convex relaxation built from these McCormick inequalities. Branching subdivides the box on x, the bounds on y are recomputed analytically, and the search terminates when the gap between the best feasible incumbent and the lowest open lower bound is below the tolerance.

Benchmark

Runtime of the best B&B configuration on MSCI World benchmarks.

Universe sizec-factorτ ≤ 0.6τ = 0.7τ = 0.8τ = 0.9τ = 1.0
n = 111.5/n22.3 s11.0 s12.7 s14.1 s17.3 s
n = 221.5/n198.9 s217.0 s107.3 s68.2 s64.7 s
n = 331.5/n674.3 s1658.4 s2219.0 s34.4 s57.3 s
n = 442/n1223.6 s1883.5 s1232.2 s761.5 s598.2 s
n = 542/n---1238.8 s621.1 s

Times in seconds, single-threaded relaxation calls, one-hour cap. Test bed: random subsets of the MSCI World top 100, daily log-returns Jan 2015 – Jan 2020, four-currency basket. Em-dashes indicate the configuration did not close the optimality gap within the budget.

From the technical record
Figure 2.1 from the report: the McCormick envelope for the bilinear term z = xy. The black curve is the original non-convex feasible region; the green and pink polytopes are the linear over- and under-estimators that the relaxation solves over.
Figure 2.1 from the report: the McCormick envelope for the bilinear term z = xy. The black curve is the original non-convex feasible region; the green and pink polytopes are the linear over- and under-estimators that the relaxation solves over.
Algorithm 1: the spatial Branch-and-Bound loop. At each node we solve the McCormick-relaxed program, prune by best-bound, and branch on the asset with the largest bilinear violation.
Algorithm 1: the spatial Branch-and-Bound loop. At each node we solve the McCormick-relaxed program, prune by best-bound, and branch on the asset with the largest bilinear violation.
Figure 4.3 from the report: relative gap in objective between the iterative heuristic and the certified Branch-and-Bound optimum, as a function of risk-aversion τ on n = 33 assets. The gap peaks above 40% in the mid-τ regime where the problem is most non-convex.
Figure 4.3 from the report: relative gap in objective between the iterative heuristic and the certified Branch-and-Bound optimum, as a function of risk-aversion τ on n = 33 assets. The gap peaks above 40% in the mid-τ regime where the problem is most non-convex.

OR techniques deployed

  • Spatial Branch-and-Bound
  • McCormick envelope relaxations
  • Bilinear reformulation of QCQP
  • Adaptive bound-tightening on relaxation duals
  • Risk-parity & risk-budgeting modeling
  • Mean-variance with non-convex risk constraints

Stack & solvers

  • Python
  • Gurobi
  • NumPy
  • MSCI World data pipeline

Have a similar problem?

Let's discuss what we could do for you.

mail@haeringsolutions.ch