You are on page 1of 5

Daniel Fylstra

Introducing Convex and Conic


Optimization for the Quantitative
Finance Professional
Few people are aware of a quiet revolution that has taken place in
optimization methods over the last decade

O
ptimization has played an
important role in quantitative
finance ever since Markowitz
published his original paper on
portfolio selection in 19521.
Most “quants” have some
knowledge of linear programming as used in
bond duration matching, quadratic program-
ming as used in equity portfolio optimization,
and nonlinear optimization used with portfo-
lios of derivatives. The finance industry and
technical literature is home to many different,
competing approaches that apply these stan-
dard optimization methods to different models
and risk measures, in an effort to achieve better
investment results.
But fewer people are aware of a quiet revo-
lution that has taken place in the optimiza-
tion methods themselves over the last decade.
A better understanding of the properties of
optimization models, and new algorithms –
notably interior point or barrier methods –
have led to a changed view of the whole field
of optimization. It is not an exaggeration to
say that linear and quadratic programming
are being replaced – or more properly sub-
sumed – by more powerful and general meth-
ods of convex and conic optimization.

18 Wilmott magazine
What this means for quantitative finance is a
relaxing of restrictions on optimization models It is not an exaggeration to say that linear
– for example, using quadratic constraints as
easily as a quadratic objective – and new ways to and quadratic programming are being
deal with important problems such as “unnatu-
ral” portfolios from optimization that are due to
“noise” in the return and covariance or factor
replaced – or more properly subsumed –
parameters of a portfolio model. This article
will introduce the ideas of convex and conic
by more powerful and general methods
optimization, and their applications in
quantitative finance. of convex and conic optimization
Linear and quadratic programming
An optimization problem consists of decision
variables, an objective function to be maximized or
minimized, and constraints that place limits on general constraints would put the problem in the In an observation now famous for its prescience
other functions of the variables. In linear pro- domain of nonlinear optimization. Quantitative among optimization researchers, mathemati-
gramming, the objective and constraint func- finance professionals have worked hard to create cian R. Tyrrell Rockafellar wrote in SIAM Review
tions are all linear – hence the simple form: models that “fit” within the domain of linear and in 19932:
quadratic programming, and avoid models that
max/min cx “. . . in fact, the great watershed in opti-
require nonlinear optimization methods. Why?
subject to bl ≤ Ax ≤ bu mization isn’t between linearity and
nonlinearity, but convexity and
xl ≤ x ≤ xu Convex and non-convex problems
nonconvexity.”
where x is a vector of decision variables, cx is the Nonlinear optimization is a well-developed
objective function, A is a matrix of coefficients field, with many solution algorithms for prob- What makes the general optimization problem
and Ax computes the constraints, bl and xl are lems of the general form: so hard to solve? It is not the fact that f (x) or
lower bounds, and bu and xu are upper bounds. G(x) may be nonlinear! It is the fact that f (x) or
max/min f (x) G(x) may be non-convex.
In quadratic programming, the objective is gener-
alized to a quadratic function of the form: subject to bl ≤ G(x) ≤ bu A convex optimization problem is one
xl ≤ x ≤ xu where all of the constraints are convex func-
max/min xT Qx + cx tions, and the objective is a convex function if
subject to bl ≤ Ax ≤ bu where f (x) is a smooth function, and G(x) is a minimizing, or a concave function if maximiz-
xl ≤ x ≤ xu vector of smooth functions of the variables x. ing. A non-convex optimization problem is any
Linear and quadratic programming problems are case where the objective or any of the con-
where Q is a matrix of coefficients. In the sim-
special cases of this form, where f (x) = cx or straints are non-convex functions. The differ-
plest formulation of the classic Markowitz port-
xT Qx + cx, and G(x) = Ax . But solution algorithms ence is dramatic: Convex optimization prob-
folio optimization problem, Q is a covariance
for this general problem can find only “locally lems can be efficiently solved to global optimal-
matrix, the objective xT Qx is portfolio variance to
optimal” solutions that may not be “globally ity with up to tens or even hundreds of thou-
be minimized, and A has just two rows: A budget
optimal,” and they may fail to find a feasible sands of variables. In contrast, the best methods
constraint 1x = 1 and a portfolio return threshold
solution even though one exists. Unlike linear for global optimization on modern computers
ax ≥ b where a is the expected return of each
and quadratic programming, the time taken to usually can solve non-convex problems of only a
security and b is the minimum portfolio return.
find a globally optimal solution can rise expo- few hundred variables to global optimality.
A factor model that expresses the “beta” or
nentially with the number of variables and con- Even a quadratic programming problem may
sensitivity of each security to one or more
straints. This severely limits the size of problems be “impossibly” hard to solve (in mathematical
market factors also leads to a quadratic
that can be solved to global optimality. Hence terms, NP-hard) if the objective function xT Qx is
programming model.
the aversion to nonlinear optimization for prac- non-convex, which happens when the matrix Q
Classical quadratic programming still requires tical quantitative finance problems seems well is indefinite3. Fortunately for portfolio optimiza-
that all constraints are linear; quadratic or more founded. Or is it? tion, the matrix Q will be positive definite if the
^

Wilmott magazine 19
DANIEL FYLSTRA

covariance terms are computed from historical


data where the number of observations exceeds Quantitative finance professionals have
the number of securities.
worked hard to create models that 'fit'
Convex functions
What do we mean by a convex function?
Geometrically, a function is convex if a line seg-
within the domain of linear and quadratic
ment drawn from any point (x, f (x)) to another
point (y, f (y)) – called the chord from x to y – lies
programming, avoiding models that
on or above the graph of f, as in the picture below:
require nonlinear optimization methods.
Why?
Interior point methods models “fit” within the domain of linear and
and software quadratic programming. For example, in Robert
Algebraically, f is convex if, for any x and y, Rockafellar’s observation moved from theoreti- Fernholz’s well-regarded work apply-
and any t between 0 and 1, cally interesting to practically significant with ing “stochastic portfolio theory”
f (tx + (1 − t)y) ≤ tf (x) + (1 − t)f (y) . A function is the development of interior point methods – to equity portfolio manage-
concave if −f is convex – i.e. if the chord from x to first for linear programming, pioneered by ment6, the linear portfolio
y lies on or below the graph of f . It is easy to see that Khachian and Karmarkar4 in the 1980s, then return threshold constraint is
every linear function – whose graph is a straight for more general convex optimization prob- replaced by a portfolio growth
line – is both convex and concave. A quadratic lems, pioneered by Nesterov and Nemirovskii5 threshold constraint that
function xT Qx is convex if Q is positive semi-defi- 1994. Where the simplex method relies on the includes a quadratic term.
nite, or concave if Q is negative semi-definite. A fact that the constraints are linear, and moves Fernholz remarks that “this con-
non-convex function “curves up and down” – it is from vertex to vertex where constraints inter- straint is nonlinear, and conventional
neither convex nor concave. A familiar example is sect, interior point methods rely only on the quadratic programs cannot be used in this
the sine function; perhaps less familiar is the fact that the constraints are convex – they case.” He goes on to show that, for enhanced
quadratic xT Qx where Q is indefinite, for example move along the so-called central path defined index (“tracking”) portfolios, the quadratic term
x21 − 2x1 x2 − 1/2(x22 − 1) which is plotted below: by a nonlinear barrier function, even for LP in the growth constraint is small in magnitude,
problems. and therefore can be neglected – yielding a lin-
This means, for example, that an interior ear constraint and a conventional QP problem.
point method doesn’t “care” whether it is deal- But with modern interior point methods, this
ing with a quadratic objective or (one or many) simplification is no longer necessary – the origi-
quadratic constraints – it will take essentially nal problem including the quadratic constraint
the same number of steps to find the optimal can be solved just as reliably, and in about the
solution. same time, as the simplified QP problem.
Commercial interior point optimization
software that handles quadratic constraints Conic optimization
has just begun to appear; examples are the Nesterov and Nemirovskii’s seminal work also
Barrier component of the CPLEX optimizer, the opened up a natural generalization of linear
MOSEK optimizer, and the Barrier solver in programming, called conic programming, that
Frontline Systems’ Premium Solver Platform shares the favorable characteristics of LP but
General nonlinear functions may be convex for Excel. encompasses a wider range of problems. And
or non-convex. A problem with all convex non- conic quadratic programming – now known as
linear functions can be solved efficiently, to Efficient portfolios and quadratic second order cone programming – shares the
global optimality, to very large size; but these constraints favorable characteristics of QP but encompasses
favorable features are lost if even one problem As mentioned earlier, quantitative finance pro- a wider range problems relevant for portfolio
function is non-convex. fessionals have worked hard to make their optimization.

20 Wilmott magazine
DANIEL FYLSTRA

A conic optimization problem can be written


as an LP – with a linear objective and linear con-
straints – plus one or more cone constraints. A
cone constraint specifies that the vector formed
by a set of decision variables is constrained to
lie within a closed convex pointed cone. The
simplest example of such a cone is the non-nega-
tive orthant, the region where all variables are
non-negative – the normal situation in an LP.
But conic optimization allows for more general
cones, that can express all the elements of a port-
folio optimization problem, and much more.
A simple type of closed convex pointed cone
that captures many optimization problems of
interest is the second order cone, also called
the Lorentz cone or “ice cream cone.”
Geometrically it looks like the picture below,
in three dimensions:

commercial quality implementations of the


proposed methods. An interior point
A second order cone (SOC) constraint of
dimension n specifies that the vector formed by SOCP problems and method doesn't
a set of n decision variables must belong to this portfolio optimization
cone. Algebraically, the L2-norm of n − 1 vari-
ables must be less than or equal to the mag-
One of the major problems with classical
Markowitz portfolio optimization is
'care' whether it is
nitude of the nth variable. Any convex
quadratic constraint can be reformulated
the presence of “noise” or sam-
pling errors in the input data
dealing with a quad-
as an SOC constraint, though this
requires several steps of linear algebra.
used to estimate the terms of
the covariance matrix, or the fac- ratic objective or
A quadratic objective xT Qx can be han- tor loadings computed for a factor
dled by introducing a new variable t, model. Michaud drew attention to (one of many) quad-
making the objective “minimize t”, this issue in a 1998 book7, referring
adding the constraint xT Qx ≤ t, and con-
verting this constraint to SOC form.
to portfolio optimization as “an error
prone procedure that often results in error-
ratic constraints – it
A problem with a linear objective and
linear plus SOC constraints is called a sec-
maximized and investment-irrelevant portfo-
lios.” This occurs because optimization, by its
will take essentially
ond order cone programming (SOCP)
problem. Such a problem can be efficient-
nature, maximally exploits the diversification
potential of the data, including the estimation the same number of
ly solved via specialized interior point methods, errors. Resampling of the efficient frontier, pro-
in about the same time as a QP problem of the posed by Michaud, and various scenario-based steps to find the
same size. Enhancement of the simplex method approaches have been developed to cope with
to solve SOCP problems is an this problem, but these methods do not explic- optimal solution
^
area of active research, but there are not yet itly model parameter uncertainty or provide

Wilmott magazine 21
DANIEL FYLSTRA

any performance guarantees on the computed


portfolio. The limitations of nonlinear optimization
Goldfarb and Iyengar8 have shown how
conic optimization can be applied to the sam-
pling error problem in portfolio optimization.
– heavily used in portfolios of derivatives
They begin with a factor model, but they treat
the mean return estimates and the factor load-
– is not due to non-linearity, but rather is
ings for each security as “noisy,” belonging to
parameterized uncertainty sets. They show how
due to non-convexity
the parameters of the uncertainty sets can be
obtained through the normal process of linear Hence, one can concentrate on the problem of
regression used to estimate historical returns interest rather than details of the software.
and factor sensitivities, and how to obtain confi- As noted earlier, the limitations
dence intervals for the error in these estimated of nonlinear optimization – heavi-
parameters. Then they solve variations of the ly used in portfolios of deriva-
portfolio optimization problem (minimizing tives – is not due to nonlineari-
variance, maximizing Sharpe ratio, minimizing ty, but rather is due to non-
VaR, etc.) by reformulating the constraints that convexity. The problem in
include the uncertain parameters as second practice has been that
order cone (SOC) constraints, with a user-speci- it’s very difficult for
fied confidence threshold. The result is a portfo- modelers to determine
lio that does offer probabilistic guarantees on whether their func-
risk-return performance, and that requires tions are convex
about the same amount of computing time as or non-convex.
conventional portfolio optimization. It takes con-
siderable
Software for convex and mathematical expertise and time to prove con-
conic problems vexity, and software to assist in this task has not REFERENCES
Conic optimization, including second order cone been available. But a first-generation facility9 to
1. H. Markowitz. Portfolio Selection. Journal of Finance 7
programming and a related methodology called automatically determine whether a nonlinear
1: 77–91, 1952.
semidefinite programming (SDP), has been a very model is convex or non-convex, by simply click- 2. T. Rockafellar. Lagrange multipliers and optimality.
active area for optimization researchers in recent ing a button, is included in the Premium Solver SIAM Review 35:183–238, 1993.
years. Some codes developed by academics, for Platform V6.0. This makes it possible to explore 3. R. Horst, P. Pardalos, N. Thoai. Introduction to Global
example Boyd and Vandenberghe’s SOCP code convex optimization using any of the variety of Optimization. Kluwer, 1995.
and Sturm’s SeDuMi code, can be found on the nonlinear optimizers available for this platform. 4. N. Karmarkar. A new polynomial-time algorithm for lin-
World Wide Web. ear programming. Combinatorica 4: 373–395, 1984.
For quantitative finance professionals who are Conclusions 5. Y. Nesterov and A. Nemirovskii. Interior-Point
comfortable working in Excel, the simplest way to There is growing excitement in the optimization Polynomial Algorithms in Convex Programming. SIAM,
explore conic optimization is to download a free research community about the new develop- 1994.
6. R. Fernholz. The Application of Stochastic Portfolio
trial version of Frontline Systems’ Premium Solver ments in convex and conic optimization – but
Theory to Equity Management. INTECH research report,
Platform V6.0 from www.solver.com. This software this is just beginning to “spill over” into the
2003.
is upward compatible from the standard Excel quantitative finance community, where many 7. R. Michaud. Efficient Asset Management. Harvard
Solver (that Frontline originally developed for users of optimization are found. Linear and quad- Business School Press, 1998.
Microsoft) and now includes a built-in SOCP ratic programming – now over fifty years old – are 8. D. Goldfarb and G. Iyengar. Robust portfolio selection
Barrier Solver. It automatically handles the linear being transformed into methods more powerful problems. CORC Technical Report TR-2002–03, Columbia
algebra needed to transform quadratic constraints and general than ever before. Quantitative finance University.
and objectives into SOC constraints, sparing the applications of the new technology of convex and 9. I. Nenov, D. Fylstra, L. Kolev. Convexity Determination
user this effort. Cone constraints can be entered by conic optimization are sure to grow in impor- in the Microsoft Excel Solver Using Automatic
simply selecting “soc” from a drop-down list. tance over the next few years. Differentiation Techniques. Submitted for publication. W

22 Wilmott magazine

You might also like