Optimisation
The mean–variance problems Ardentum solves, how they are solved exactly, and how every solution is checked and explained.
Objectives
Let be portfolio weights, annualised expected returns, the annualised covariance and the risk-free rate on the same scale (Markowitz, 1952).
| Objective | Problem |
|---|---|
| Minimum volatility | |
| Maximum Sharpe ratio | |
| Target return | |
| Target volatility | |
| Maximum utility | |
| Minimum CVaR | , optionally s.t. (see below) |
| Risk parity | for every held asset (see below) |
All except risk parity share the constraint set below. Variance is written with from the eigendecomposition , which is exact and numerically robust even for singular (positive semi-definite) matrices.
Constraints
| Constraint | Formulation |
|---|---|
| Full investment | |
| Position bounds | (global or per asset) |
| Exclusions (assets or sectors) | |
| Sector limits | |
| Minimum ESG score | (long-only) |
| Gross exposure | |
| Tracking error |
All are linear or second-order-cone constraints, so every problem is convex and has a global optimum that interior-point solvers find reliably.
Maximum Sharpe ratio: an exact convex reformulation
The Sharpe ratio is not concave, but with the Charnes–Cooper change of variables , (Charnes & Cooper, 1962; Cornuéjols & Tütüncü, 2007) the problem becomes
a convex quadratic programme whose solution gives . Every linear constraint is homogenised the same way; the tracking-error cone becomes .
The reformulation requires a feasible portfolio with expected return above . Ardentum first solves over ; if that is not positive, the maximum-Sharpe portfolio is undefined and reported as such rather than approximated.
Minimum CVaR: a linear programme over history
Volatility treats gains and losses alike and assumes nothing about tails. Conditional value at risk (CVaR, expected shortfall) at level is the average loss in the worst of outcomes. Using the historical per-period return vectors of the estimation window as equally likely scenarios, Rockafellar and Uryasev (2000) show
with the minimising equal to the value at risk. Introducing , turns minimum CVaR into a linear programme (plus any second-order-cone constraints such as tracking error), solved jointly over . The result keeps the empirical distribution's fat tails and asymmetry.
CVaR here is per data period (e.g. one-day CVaR for daily data) and is historical: it cannot anticipate losses worse than the window contains. At least observations are required. Every optimisation result also reports the historical one-period VaR and CVaR of its weights at the chosen level.
Validation: the optimum equals an independent solution of the same programme by SciPy's HiGHS solver, is no worse than a brute-force grid over the simplex, and the reported CVaR equals the closed form (mean of the worst losses when ).
Risk parity: equal risk contributions
The Euler decomposition splits portfolio variance into one contribution per asset, , which sum to . A risk parity (equal risk contribution) portfolio makes these contributions equal, so each of the holdings carries of the risk (Maillard, Roncalli and Teiletche, 2010). It uses no expected returns, the noisiest input, which is its appeal; the price is that low-risk assets can need large weights.
The weights solve Spinu's (2013) strictly convex problem
Its optimality condition says exactly that every equals , and strict convexity makes the solution unique when is positive definite. CVXPY solves it (an exponential-cone programme), and a few Newton steps on the optimality condition make the shares equal to machine precision. Excluded assets are left out; short positions are not allowed.
The weights are set by the risks alone, so other constraints (weight and sector limits, a minimum ESG score, a tracking-error limit) are checked afterwards. A broken one is reported with the weight that breaks it, for example "GOVB.SYN gets 45.1%, above its maximum of 30.0%", rather than replaced by a portfolio that is no longer risk parity.
Validation: two assets give inverse-volatility weights for any correlation, and so does any number of assets with one common correlation (closed forms); every risk contribution equals to ; the weights match an independent solution of the same problem by SciPy's quasi-Newton method; and the volatility lies between those of the minimum-variance and equally weighted portfolios, as Maillard, Roncalli and Teiletche prove.
Efficient frontier
The frontier is traced by solving the target-return problem on a grid from the minimum-volatility portfolio's return up to the maximum return attainable under (a linear programme). The problem is compiled once with the target as a parameter and re-solved for each point. Without constraints other than full investment, the frontier is Merton's (1972) hyperbola
which Ardentum reproduces to within relative error (automated test). The capital market line runs from through the maximum-Sharpe portfolio.
Mean-CVaR efficient frontier
Replacing variance by historical CVaR gives the mean-CVaR frontier (Rockafellar and Uryasev 2002; Krokhmal, Palmquist and Uryasev 2002). For each target on a grid from the minimum-CVaR portfolio's expected return to the highest attainable return,
The optimal value is a convex, nondecreasing function of , so only the efficient branch above the minimum-CVaR portfolio is shown. As with minimum CVaR, the tail measure is per data period and historical; expected returns are the same annualised estimates used elsewhere. The page also measures the mean-variance frontier's portfolios by the same CVaR: for elliptical (e.g. normal) returns the two frontiers coincide, so a gap between them is a picture of the fat tails and skew that volatility ignores.
Validation: every point equals an independent solution of the same linear programme by SciPy's HiGHS solver; no portfolio on a brute-force grid over the simplex with at least the same expected return has lower CVaR; each point's reported CVaR and VaR equal the closed-form historical values of its weights; returns increase and CVaR never decreases along the frontier; and no mean-variance portfolio has lower CVaR than the mean-CVaR frontier at or below its return.
Solving and verification
Problems are solved with CVXPY (Diamond & Boyd, 2016) using the Clarabel interior-point solver (Goulart & Chen, 2024), with SCS as a fallback. After solving, Ardentum:
- removes round-off below , clips to bounds and renormalises;
- re-checks every constraint (tolerance ); a violating solution raises an error and is never shown;
- computes diagnostics: which constraints bind, and their shadow prices (dual values) where they are interpretable.
Pre-checks catch common infeasibilities with a specific message (e.g. maximum weights that sum to less than 100%, a minimum ESG score above the best-scoring asset, a target return above the attainable maximum).
Validation
The optimiser is tested against independent answers: closed-form global minimum-variance, tangency and utility portfolios; Merton's frontier; SciPy SLSQP with multiple starts; PyPortfolioOpt; brute-force grid search; and the Karush–Kuhn–Tucker optimality conditions.
Explanations
Explanations are derived from the optimality conditions, so each one is a checkable fact:
- Minimum volatility. Every held, unconstrained asset has the same marginal variance ; an asset left out has a marginal variance at least as high, so adding it would raise risk.
- Maximum Sharpe. Held, unconstrained assets satisfy with . An asset left out has an expected return below this required return: its return does not compensate for the risk it would add.
- With an ESG tilt the objective uses the ESG-adjusted returns, so these conditions hold for the adjusted returns; the required return is translated back into plain terms so it can be compared with the asset's expected return.
- Each statement is made only when it is true at the solution. When an asset left out would improve the objective on return and risk alone, a binding constraint is what keeps it out (a full sector, the minimum ESG score, the tracking-error or gross-exposure limit), and the explanation names it; held weights shaped by a binding constraint say so too.
- Assets at their maximum weight would be held in larger size without the limit; binding constraints are listed with their shadow prices.
Weight stability
Optional: the return history is resampled with replacement (bootstrap), inputs are re-estimated and the problem re-solved many times with a fixed seed. The 5th–95th percentile range of each weight shows how much the portfolio depends on estimation noise (in the spirit of Michaud, 1998). Wide ranges are a warning sign about the inputs.
Limitations
Single-period model; returns summarised by mean and covariance only (no skewness, fat tails or regime changes); no transaction costs, taxes or liquidity limits inside the optimisation; estimates treated as known.