Critical Line Algorithm
Markowitz's exact algorithm for tracing the entire efficient frontier by identifying critical turning points where the set of active constraints changes.
Overview
The Critical Line Algorithm (CLA) was introduced by Harry Markowitz (1956) as the solution method for the mean-variance problem of his 1952 paper, and he set it out again in his 1987 monograph. Unlike general-purpose quadratic programming solvers, CLA is specifically designed for the portfolio optimization problem and exploits its special structure to trace the complete efficient frontier exactly.
The algorithm works by recognizing that as the target return changes continuously along the efficient frontier, the optimal portfolio weights are piecewise linear functions of the target return. The "critical lines" are the linear segments between turning points, which occur when an asset enters or leaves the active set (i.e., when a weight hits zero or lifts off zero).
Bailey and Lopez de Prado (2013) provided a modern Python implementation of CLA, making the algorithm accessible for practical use. Their implementation supports both the standard MVO (maximize Sharpe) variant and the minimum volatility variant.
On this platform the method runs PyPortfolioOpt's CLA class. The request field cla_method selects MVO (maximum Sharpe), MinVol, or Both. The default is Both, which returns two results: CriticalLineAlgorithm_MVO and CriticalLineAlgorithm_MinVol. The inputs are the historical mean return, annualized as a compound growth rate, and the Ledoit-Wolf shrunk covariance.
Mathematical Formulation
General Optimization Problem
CLA solves the standard mean-variance optimization problem with bounded weights:
where and are the lower and upper bounds on asset 's weight. For the standard long-only case, and .
Lagrangian
The Lagrangian of the optimization problem (ignoring bound constraints handled by the active set method) is:
where is the Lagrange multiplier for the budget constraint and is the multiplier for the return constraint.
KKT Conditions
Taking the derivative with respect to and setting it to zero yields the first-order optimality condition:
Combined with the equality constraints, this gives a linear system that can be solved for the optimal weights as a function of the target return.
Analytical Solution: Piecewise Linear Weights
For a given active set (the set of assets with weights strictly between their bounds), the optimal weights are an affine function of the target return:
where and are vectors determined by the covariance matrix, expected returns, and the current active set. As varies, the weights trace a straight line (a "critical line") in weight space until an asset hits a bound, at which point a new critical line begins with a different active set.
Algorithm Steps
- Step 1: Initialize with the maximum-return portfolio (all weight in the highest-return asset).
- Step 2: Compute and for the current active set.
- Step 3: Determine the next turning point by finding the smallest decrease in that causes a weight to hit a bound or an inactive asset to enter the active set.
- Step 4: Update the active set and repeat from Step 2 until the minimum variance portfolio is reached.
Algorithm Variants
MVO Variant (Maximize Sharpe Ratio)
After tracing the full efficient frontier using CLA, the tangency portfolio that maximizes the Sharpe Ratio can be identified by evaluating the Sharpe Ratio at each turning point and searching along the critical line segment where the maximum occurs. The frontier is exact. The implementation locates the maximum on that segment with a golden-section search, so the tangency point is found numerically along an exact frontier. If the risk-free rate is at or above every asset's expected return, this arm alone optimizes against a rate just below the highest expected return and the result is marked as degraded.
MinVol Variant (Minimum Volatility)
The minimum variance portfolio is the final turning point of the CLA algorithm. It corresponds to the leftmost point on the efficient frontier and is obtained automatically as a byproduct of the full frontier computation.
Advantages & Limitations
Advantages
- Exact solution: Traces the entire efficient frontier exactly, without discretization or numerical approximation.
- Complete frontier: Produces all turning points simultaneously, giving the full picture of optimal portfolios.
- Specialized efficiency: Exploits the structure of the portfolio problem, often faster than general QP solvers for moderate-sized problems.
- No hyperparameters: The algorithm has no tuning parameters, convergence thresholds, or learning rates.
Limitations
- Scalability: Computational cost grows with the number of assets, as each turning point requires solving a linear system.
- Group sums are refused: Per-name weight bounds and asset exclusions are solved directly, because the algorithm pivots on which box bounds are active. A group sum limit, such as a sector cap, is a general linear row that breaks the turning-point algorithm itself, so a run that carries one does not run this method. This is a permanent property of the algorithm, not pending work. Turnover budgets are not available on any method.
- Input sensitivity: Like all MVO-based methods, the frontier is sensitive to estimation errors in expected returns and covariances.
- Implementation complexity: More complex to implement correctly than calling a standard QP solver.
References
- Markowitz, H. (1952). "Portfolio Selection." The Journal of Finance, 7(1), 77-91.
- Markowitz, H. (1956). "The Optimization of a Quadratic Function Subject to Linear Constraints." Naval Research Logistics Quarterly, 3(1-2), 111-133.
- Markowitz, H. (1987). Mean-Variance Analysis in Portfolio Choice and Capital Markets. Basil Blackwell.
- Bailey, D. H., & Lopez de Prado, M. (2013). "An Open-Source Implementation of the Critical-Line Algorithm for Portfolio Optimization." Algorithms, 6(1), 169-196.
Not investment advice. Past performance is not indicative of future results.