Graph implementations for nonsmooth convex programs
Recent Advances in Learning and Control (2008)
- ISSN: 01708643
- ISBN: 9781848001541
- DOI: 10.1007/978-1-84800-155-8
Available from
Michael Grant's profile on Mendeley.
or
Abstract
We describe graph implementations, a generic method for representing a convex function via its epigraph, described in a disciplined convex programming framework. This simple and natural idea allows a very wide variety of smooth and nonsmooth convex programs to be easily specified and efficiently solved, using interiorpoint methods for smooth or cone convex programs.
Page 1
Graph implementations for nonsmooth convex programs
mcgrant 9 o rd . edu
1 Int roduct ion
V.D. Blondel et al. (Eds.) Recent Advances in Learning and Control, LNCIS 371, pp. 95-110, 2008.
springerlink.com (~) Springer-Verlag Berlin Heidelberg 2008
1 Int roduct ion
V.D. Blondel et al. (Eds.) Recent Advances in Learning and Control, LNCIS 371, pp. 95-110, 2008.
springerlink.com (~) Springer-Verlag Berlin Heidelberg 2008
Page 2
96 M.C. Grant and S.P. Boyd
neither obvious nor well known, even to some experts in convex optimization.
Furthermore, even if a transformation is identified, the reformulation process is
often time consuming and error prone, for both experts and applications-oriented
modelers alike.
We propose to enable modeling frameworks to largely automate the process
of identifying and applying these transformations, so that a much wider variety
of models--smooth and nonsmooth alike--can be both easily specified and era-
ciently solved. Our approach depends upon two distinct but interrelated evel-
opments. The first is a methodology for constructing convex optimization models
called disciplined convex programming. The methodology imposes a set of rules
or conventions that must be followed when constructing convex programs. The
rules are simple and teachable, drawn from basic principles of convex analy-
sis, and follow the practices of those who regularly use convex optimization.
Conforming problems are called, appropriately, disciplined convex programs, or
DCPs. The DCP ruleset does not limit generality, but it does require that the
modeler explicitly provide just enough structure to allow further analysis and
solution of a problem to be automated.
The second development is a new method for defining or implementing a func-
tion in a modeling framework, as as the optimal value of a parameterized convex
program (specifically, a DCP). We call such a function definition a graph ira-
plementation because it exploits the relationship between convex and concave
functions and their epigraphs and hypographs, respectively. A graph implemen-
tation encapsulates a method for transforming instances of a specific function
in a constraint or objective into a form compatible with the underlying solver's
standard form. The conditions imposed by the DCP ruleset ensure that these
transformations always preserve quivalence and convexity. The most significant
benefit of graph implementations is their ability to efficiently implement non-
differentiable functions. But in fact, graph implementations can also be used
to implement many smooth functions as well when the target standard form is
nonsmooth (e.g., an SDP).
We have created a modeling framework called cvx \[8\] that supports disciplined
convex programming and graph implementations, cvx uses the object-oriented
features of MATLAB~to turn it into an optimization modeling language: opti-
mization variables can be declared and constraints and objectives pecified using
natural MATLAB| syntax, cvx verifies compliance with the DCP ruleset, trans-
forms conforming models to solvable form, calls an appropriate numerical solver,
and translates the numerical results back to the original problem--all without
user intervention. The framework includes a large library of common convex and
concave functions, both smooth and nonsmooth, and more can be added.
To an applications-oriented user, the conceptual model presented by cvx is
very simple: cvx solves any problem (up to some practical size limits, of course)
constructed according to the DCP ruleset from functions found in the cvx library.
The modeler need not know what transformations are taking place, or even
that a transformation is necessary. That is, graph implementations are entirely
opaque or hidden from a standard cvx user. On the other hand, expert users
neither obvious nor well known, even to some experts in convex optimization.
Furthermore, even if a transformation is identified, the reformulation process is
often time consuming and error prone, for both experts and applications-oriented
modelers alike.
We propose to enable modeling frameworks to largely automate the process
of identifying and applying these transformations, so that a much wider variety
of models--smooth and nonsmooth alike--can be both easily specified and era-
ciently solved. Our approach depends upon two distinct but interrelated evel-
opments. The first is a methodology for constructing convex optimization models
called disciplined convex programming. The methodology imposes a set of rules
or conventions that must be followed when constructing convex programs. The
rules are simple and teachable, drawn from basic principles of convex analy-
sis, and follow the practices of those who regularly use convex optimization.
Conforming problems are called, appropriately, disciplined convex programs, or
DCPs. The DCP ruleset does not limit generality, but it does require that the
modeler explicitly provide just enough structure to allow further analysis and
solution of a problem to be automated.
The second development is a new method for defining or implementing a func-
tion in a modeling framework, as as the optimal value of a parameterized convex
program (specifically, a DCP). We call such a function definition a graph ira-
plementation because it exploits the relationship between convex and concave
functions and their epigraphs and hypographs, respectively. A graph implemen-
tation encapsulates a method for transforming instances of a specific function
in a constraint or objective into a form compatible with the underlying solver's
standard form. The conditions imposed by the DCP ruleset ensure that these
transformations always preserve quivalence and convexity. The most significant
benefit of graph implementations is their ability to efficiently implement non-
differentiable functions. But in fact, graph implementations can also be used
to implement many smooth functions as well when the target standard form is
nonsmooth (e.g., an SDP).
We have created a modeling framework called cvx \[8\] that supports disciplined
convex programming and graph implementations, cvx uses the object-oriented
features of MATLAB~to turn it into an optimization modeling language: opti-
mization variables can be declared and constraints and objectives pecified using
natural MATLAB| syntax, cvx verifies compliance with the DCP ruleset, trans-
forms conforming models to solvable form, calls an appropriate numerical solver,
and translates the numerical results back to the original problem--all without
user intervention. The framework includes a large library of common convex and
concave functions, both smooth and nonsmooth, and more can be added.
To an applications-oriented user, the conceptual model presented by cvx is
very simple: cvx solves any problem (up to some practical size limits, of course)
constructed according to the DCP ruleset from functions found in the cvx library.
The modeler need not know what transformations are taking place, or even
that a transformation is necessary. That is, graph implementations are entirely
opaque or hidden from a standard cvx user. On the other hand, expert users
Page 3
Graph Implementations for Nonsmooth Convex Programs 97
2 A Br ie f In t roduct ion to cvx
To begin, consider the simple linear program
minimize c T x
subject to Ax < b, (1)
with variable x C R n and data A C R mxn, b C R m, and c C R n. The following
(MATLAB@/cvx) code generates and solves a random instance of (1)"
m = 16; n = 8 ;
A = randn(m,n) ; b = randn(m,1) ; c = randn(n ,1 ) ;
cvx_begin
var iab le x (n)
min imize( c ' * x )
sub jec t to
A .x<=b;
cvx end
The indentation is purely for stylistic reasons and is optional. The code is rela-
tively self-explanatory, but a few notes are in order:
9 The cvx begin and cvx end commands mark the beginning and end, re-
spectively, of any cvx model.
9 Variables must be declared before their first use. For example, the var iab le
statement above declares x to be a vector of length n.
9 The sub jec t to statement is optional-- it is provided by cvx only to make
models more readable and has no mathematical effect.
9 Objectives and constraints may be placed in any order.
When cvx end is reached, cvx will complete the conversion of the model to
solvable form and call the underlying numerical solver. It will replace the
MATLAB| variable x, which up to that point was a special cvx variable object,
with a numeric vector representing an optimal value.
Now consider a norm minimization problem with box constraints:
minimize I IAy- bll 2 (2)
subject to g __ y _ u
2 A Br ie f In t roduct ion to cvx
To begin, consider the simple linear program
minimize c T x
subject to Ax < b, (1)
with variable x C R n and data A C R mxn, b C R m, and c C R n. The following
(MATLAB@/cvx) code generates and solves a random instance of (1)"
m = 16; n = 8 ;
A = randn(m,n) ; b = randn(m,1) ; c = randn(n ,1 ) ;
cvx_begin
var iab le x (n)
min imize( c ' * x )
sub jec t to
A .x<=b;
cvx end
The indentation is purely for stylistic reasons and is optional. The code is rela-
tively self-explanatory, but a few notes are in order:
9 The cvx begin and cvx end commands mark the beginning and end, re-
spectively, of any cvx model.
9 Variables must be declared before their first use. For example, the var iab le
statement above declares x to be a vector of length n.
9 The sub jec t to statement is optional-- it is provided by cvx only to make
models more readable and has no mathematical effect.
9 Objectives and constraints may be placed in any order.
When cvx end is reached, cvx will complete the conversion of the model to
solvable form and call the underlying numerical solver. It will replace the
MATLAB| variable x, which up to that point was a special cvx variable object,
with a numeric vector representing an optimal value.
Now consider a norm minimization problem with box constraints:
minimize I IAy- bll 2 (2)
subject to g __ y _ u
Page 4
98 M.C. Grant and S.P. Boyd
The following cvx/MATLAB@ code constructs and solves a version of (2),
reusing A and b from above and generating random bounds:
1 = -abs( randn(n ,2) ) ; u = +abs( randn(n ,2) ) ;
cvx_begin
variable y(n)
minimize(norm(A,y-b,2) )
to
y<=u;
y>=l ;
cvx_end
It is well known that (2) can be reformulated as a (convex) quadratic program
(QP) or a second-order cone program (SOCP). (cvx, in fact, converts this prob-
lem to an SOCP.) The transformation i this case is not particularly complicated;
still, it is nice to have it completely automated.
cvx supports a variety of other norms and penalties for this model simply by
replacing the objective function; for example:
All of these examples can be reformulated as SOCPs as well. Here, however, the
transformations are not at all obvious, even to experts; and in all three cases
working out the transformation by hand would be tedious and error prone, cvx,
however, can solve all three problems automatically.
As a final example, consider the task of determining the minimum volume
ellipsoid (also known as the LSwner-John ellipsoid) g containing a finite set of
points Zl, z2, 9 9 9 zn c R d"
minimize vol(g) (3)
subject toz icg , i -1 , . . . ,n .
The parameterization wewill use for g is
-~ {u I IIPu + qll2 -< 1 }, (4)
where (P, q) E R dxd x R d, and P is symmetric positive semidefinite. In this case,
vol(g) is proportional to det(P -1) (see \[6, w With this parametrization we
can cast the problem above as
minimize det P-1
subject to l lPz i+q l \ [2<l , i - l ,2 , . . . ,n , (5)
with variables P - pT E a dxd and q C R d. We have written the objective
informally as det P - 1; a more precise description is faet_inv (P), where
A \ [det (P) -1 P - pT ~_ 0 f~_~v(P) +oc otherwise. (6)
The following cvx/MATLAB@ code constructs and solves a version of (2),
reusing A and b from above and generating random bounds:
1 = -abs( randn(n ,2) ) ; u = +abs( randn(n ,2) ) ;
cvx_begin
variable y(n)
minimize(norm(A,y-b,2) )
to
y<=u;
y>=l ;
cvx_end
It is well known that (2) can be reformulated as a (convex) quadratic program
(QP) or a second-order cone program (SOCP). (cvx, in fact, converts this prob-
lem to an SOCP.) The transformation i this case is not particularly complicated;
still, it is nice to have it completely automated.
cvx supports a variety of other norms and penalties for this model simply by
replacing the objective function; for example:
All of these examples can be reformulated as SOCPs as well. Here, however, the
transformations are not at all obvious, even to experts; and in all three cases
working out the transformation by hand would be tedious and error prone, cvx,
however, can solve all three problems automatically.
As a final example, consider the task of determining the minimum volume
ellipsoid (also known as the LSwner-John ellipsoid) g containing a finite set of
points Zl, z2, 9 9 9 zn c R d"
minimize vol(g) (3)
subject toz icg , i -1 , . . . ,n .
The parameterization wewill use for g is
-~ {u I IIPu + qll2 -< 1 }, (4)
where (P, q) E R dxd x R d, and P is symmetric positive semidefinite. In this case,
vol(g) is proportional to det(P -1) (see \[6, w With this parametrization we
can cast the problem above as
minimize det P-1
subject to l lPz i+q l \ [2<l , i - l ,2 , . . . ,n , (5)
with variables P - pT E a dxd and q C R d. We have written the objective
informally as det P - 1; a more precise description is faet_inv (P), where
A \ [det (P) -1 P - pT ~_ 0 f~_~v(P) +oc otherwise. (6)
Page 5
Graph Implementations for Nonsmooth Convex Programs 99
This function implicitly constrains P to be symmetric and positive definite. The
function faet_inv is convex, so the,problem above is a convex problem.
The following cvx /MATLAB~ code generates a random set of points and
computes the optimal ellipsoid by solving (5)"
d=2;
z = randn(d,n) ;
cvx_begin
variables P(d,d) q(d)
minimize (det_ inv(P) )
subject to
for i = i 9 n,
norm( P,z( ' , i )+q,2 ) <= I;
end
cvx_end
The function det_ inv represents faet_inv('), including the implicit constraint that
its argument be symmetric and positive definite. It is known that this problem
can be cast as a semidefinite program (SDP), but the required conversion is
quite complicated. Fortunately, that conversion is buried inside cvx's definition
of det_ inv and performed automatically.
This is, of course, a considerably abbreviated introduction to cvx, intended
only to give the reader an idea of the basic syntax and structure of cvx models.
The reader is encouraged to read the user's guide \[8\] for a more thorough treat-
ment, or to download the software and try it. The examples presented here can
be entered exactly as listed.
3 Disciplined Convex Programming
Disciplined convex programming was first named and described by Grant, Boyd,
and Ye in \[9\] and Grant in \[10\]. It was modeled on the methods used by those who
regularly construct convex optimization models. Such modelers do not simply
construct arbitrary nonlinear programs and attempt o verify convexity after the
fact; rather, they begin with a mental ibrary of functions and sets with known
geometries, and combine them in ways which convex analysis guarantees will
preserve convexity.
Disciplined convex programming is an attempt o formalize and this practice
and codify its techniques. It consists of two key components:
9 an atom library--a collection of functions or sets with known properties of
curvature (convexity and concavity) and monotonicity; and
9 the DCP ruleset--a finite enumeration of ways in which atoms may be com-
bined in objectives and constraints while preserving convexity.
The rules are drawn from basic principles of convex analysis, and are easy to
learn, once you have had an exposure to convex analysis and convex optimization.
They constitute a set of sufficient but not necessary conditions for convexity,
This function implicitly constrains P to be symmetric and positive definite. The
function faet_inv is convex, so the,problem above is a convex problem.
The following cvx /MATLAB~ code generates a random set of points and
computes the optimal ellipsoid by solving (5)"
d=2;
z = randn(d,n) ;
cvx_begin
variables P(d,d) q(d)
minimize (det_ inv(P) )
subject to
for i = i 9 n,
norm( P,z( ' , i )+q,2 ) <= I;
end
cvx_end
The function det_ inv represents faet_inv('), including the implicit constraint that
its argument be symmetric and positive definite. It is known that this problem
can be cast as a semidefinite program (SDP), but the required conversion is
quite complicated. Fortunately, that conversion is buried inside cvx's definition
of det_ inv and performed automatically.
This is, of course, a considerably abbreviated introduction to cvx, intended
only to give the reader an idea of the basic syntax and structure of cvx models.
The reader is encouraged to read the user's guide \[8\] for a more thorough treat-
ment, or to download the software and try it. The examples presented here can
be entered exactly as listed.
3 Disciplined Convex Programming
Disciplined convex programming was first named and described by Grant, Boyd,
and Ye in \[9\] and Grant in \[10\]. It was modeled on the methods used by those who
regularly construct convex optimization models. Such modelers do not simply
construct arbitrary nonlinear programs and attempt o verify convexity after the
fact; rather, they begin with a mental ibrary of functions and sets with known
geometries, and combine them in ways which convex analysis guarantees will
preserve convexity.
Disciplined convex programming is an attempt o formalize and this practice
and codify its techniques. It consists of two key components:
9 an atom library--a collection of functions or sets with known properties of
curvature (convexity and concavity) and monotonicity; and
9 the DCP ruleset--a finite enumeration of ways in which atoms may be com-
bined in objectives and constraints while preserving convexity.
The rules are drawn from basic principles of convex analysis, and are easy to
learn, once you have had an exposure to convex analysis and convex optimization.
They constitute a set of sufficient but not necessary conditions for convexity,
Page 6
i00 M.C. Grant and S.P. Boyd
which means that it is possible to build models that violate the rules but are still
convex. We will provide examples of such violations and their resolution later in
this section.
3.1 Preliminaries
The rules of disciplined convex programming depend primarily upon the cur-
vature of numeric expressions. The four categories of curvature considered are
constant, affine, convex, and concave. The usual definitions apply here; for ex-
ample, a function f : R n ~ a is convex if its domain is a convex set, and
f(Gx + (1 -G)y ) _< c~f(x) + (1 - (~)f (y) Vx, y e R n, c~ E \[0, 1\]. (7)
Of course, there is significant overlap in these categories: constant expressions
are affine, and real affine expressions are both convex and concave. Complex
constant and affine expressions are considered as well, but of course convex and
concave xpressions are real by definition.
Functions in the atom library are chracterized not just by curvature but by
monotonicity as well. Three categories of monotonicity are considered: nonde-
creasing, nonincreasing, and nonmonotonic. Again, the usual mathematical def-
initions apply; for example, a function f" R ~ R is nondecreasing if
x >_ y ~ f (x) >_ f (y). (8)
Two technical clarifications are worth making here. First, monotonicit X
sidered in a global, extended-valued sense. For example, the MATLAB
root function sqr t is interpreted in cvx as follows:
fsqrt" R + (R tO-~) , x > o Aqrt(x) -c~ x < O
is con-
square
(9)
Under this interpretation, it is concave and nondecreasing. Secondly, for func-
tions with multiple arguments, curvature is considered jointly, while mon-
tonicity is considered separately for each argument. For example, the function
quad over_lin in cvx, given by
~xTx/y
f (X, y) - \[
y>0
(10)
y_<0
fqol (x, y)" (R n R) ~ (R O +c~),
is jointly convex in x and y, but nonincreasing in y alone.
With terminology defined, we now proceed to the ruleset itself.
3.2 Const ra in ts and Objectives
A disciplined convex program may either be an optimization problem consist-
ing of a single objective and zero or more constraints, or a feasibility problem
which means that it is possible to build models that violate the rules but are still
convex. We will provide examples of such violations and their resolution later in
this section.
3.1 Preliminaries
The rules of disciplined convex programming depend primarily upon the cur-
vature of numeric expressions. The four categories of curvature considered are
constant, affine, convex, and concave. The usual definitions apply here; for ex-
ample, a function f : R n ~ a is convex if its domain is a convex set, and
f(Gx + (1 -G)y ) _< c~f(x) + (1 - (~)f (y) Vx, y e R n, c~ E \[0, 1\]. (7)
Of course, there is significant overlap in these categories: constant expressions
are affine, and real affine expressions are both convex and concave. Complex
constant and affine expressions are considered as well, but of course convex and
concave xpressions are real by definition.
Functions in the atom library are chracterized not just by curvature but by
monotonicity as well. Three categories of monotonicity are considered: nonde-
creasing, nonincreasing, and nonmonotonic. Again, the usual mathematical def-
initions apply; for example, a function f" R ~ R is nondecreasing if
x >_ y ~ f (x) >_ f (y). (8)
Two technical clarifications are worth making here. First, monotonicit X
sidered in a global, extended-valued sense. For example, the MATLAB
root function sqr t is interpreted in cvx as follows:
fsqrt" R + (R tO-~) , x > o Aqrt(x) -c~ x < O
is con-
square
(9)
Under this interpretation, it is concave and nondecreasing. Secondly, for func-
tions with multiple arguments, curvature is considered jointly, while mon-
tonicity is considered separately for each argument. For example, the function
quad over_lin in cvx, given by
~xTx/y
f (X, y) - \[
y>0
(10)
y_<0
fqol (x, y)" (R n R) ~ (R O +c~),
is jointly convex in x and y, but nonincreasing in y alone.
With terminology defined, we now proceed to the ruleset itself.
3.2 Const ra in ts and Objectives
A disciplined convex program may either be an optimization problem consist-
ing of a single objective and zero or more constraints, or a feasibility problem
Page 7
Graph Implementations for Nonsmooth Convex Programs 101
consisting of one or more constraints and no objective. The rules for objectives
and constraints are as follows:
9 A valid objective is
- the minimization of a convex expression;
- the maximizat ion of a concave expression.
9 A valid constraint is
- a set membership relation (E) in which the left-hand side (LHS) is affine
and the r ight-hand side (RHS) is a convex set.
- an equality (=) with an affine LHS and an affine RHS.
- a less-than inequality (_<) with a convex LHS and a concave RHS.
- a greater- than i equality (>_) with a concave LHS and a convex RHS.
For any problem that conforms to these rules, the constraint set is convex.
These rules, however, require more than just convexity of the constraint set:
They constrain how the constraint set is described. For example, the constraint
square (x)==0, where x is a scalar variable, defines the convex set {0}. But it is
rejected by the rules above, since the LHS of this equality constraint is not affine.
When the constraint is written in the equivalent form x==O, however, which is
accepted by the rules above, since both sides are affine.
3.3 S imple Express ions
Disciplined convex programming determines the curvature of numeric and set
expressions by recursively applying the following rules. This list may seem long,
but it is for the most part an enumerat ion of basic rules of convex analysis for
combining convex, concave, and affine forms: sums, multipl ication by scalars,
and so forth. For the basics of convex analysis, see, e.g., \[2, 4, 6, 15, 20\].
9 A valid affine expression is
- a valid constant expression;
- a declared variable;
- a valid call to a function with an affine result;
- the sum or difference of affine expressions;
- the product of an affine expression and a constant.
9 A valid convex expression is
- a valid constant or affine expression;
- a valid call to a function with a convex result;
- the sum of two or more convex expressions;
- the difference between a convex expression and a concave expression;
- the product of a convex expression and a nonnegative constant;
- the product of a concave expression and a nonpositive constant;
- the negation of a concave expression.
9 A valid concave expression is
- a valid constant or affine expression;
- a valid call to a function in the atom library with a concave result;
- the sum of two or more concave expressions;
consisting of one or more constraints and no objective. The rules for objectives
and constraints are as follows:
9 A valid objective is
- the minimization of a convex expression;
- the maximizat ion of a concave expression.
9 A valid constraint is
- a set membership relation (E) in which the left-hand side (LHS) is affine
and the r ight-hand side (RHS) is a convex set.
- an equality (=) with an affine LHS and an affine RHS.
- a less-than inequality (_<) with a convex LHS and a concave RHS.
- a greater- than i equality (>_) with a concave LHS and a convex RHS.
For any problem that conforms to these rules, the constraint set is convex.
These rules, however, require more than just convexity of the constraint set:
They constrain how the constraint set is described. For example, the constraint
square (x)==0, where x is a scalar variable, defines the convex set {0}. But it is
rejected by the rules above, since the LHS of this equality constraint is not affine.
When the constraint is written in the equivalent form x==O, however, which is
accepted by the rules above, since both sides are affine.
3.3 S imple Express ions
Disciplined convex programming determines the curvature of numeric and set
expressions by recursively applying the following rules. This list may seem long,
but it is for the most part an enumerat ion of basic rules of convex analysis for
combining convex, concave, and affine forms: sums, multipl ication by scalars,
and so forth. For the basics of convex analysis, see, e.g., \[2, 4, 6, 15, 20\].
9 A valid affine expression is
- a valid constant expression;
- a declared variable;
- a valid call to a function with an affine result;
- the sum or difference of affine expressions;
- the product of an affine expression and a constant.
9 A valid convex expression is
- a valid constant or affine expression;
- a valid call to a function with a convex result;
- the sum of two or more convex expressions;
- the difference between a convex expression and a concave expression;
- the product of a convex expression and a nonnegative constant;
- the product of a concave expression and a nonpositive constant;
- the negation of a concave expression.
9 A valid concave expression is
- a valid constant or affine expression;
- a valid call to a function in the atom library with a concave result;
- the sum of two or more concave expressions;
Page 8
102 M.C. Grant and S.P. Boyd
- the difference between a concave expression and a convex expression;
- the product of a concave expression and a nonnegative constant;
- the product of a convex expression and a nonposit ive constant;
- the negation of a convex expression.
A valid convex set expression is
- a valid reference to a convex set in the atom library;
- the intersection of two or more convex set expressions;
- the sum or difference of convex set expressions;
- the sum or difference of a convex set expression and a constant;
- the product of a convex set expression and constant.
If an expression cannot be categorized by this ruleset, then it is rejected by
cvx. For matr ix and array expressions, these rules are applied on an elementwise
basis. We note that the set of rules listed above is redundant; there are much
smaller, equivalent sets of rules.
Of part icular note is that these expression rules forbid products between non-
constant expressions. We call this the no-product rule for obvious reasons. For
example, the expression xv/x , wr itten in cvx as x ,sqr t (x), is convex (at least
when x is positive) but is rejected by cvx as violating the above rules. Fortu-
nately, cvx provides a function called pou_pos (x, p) that implements the convex
and concave branches of x^p, so this expression can be written as pow(x ,3 /2 ) .
3.4 Compositions
A basic rule of convex analysis is that convexity is closed under composit ion
with an atone mapping. This is part of the DCP ruleset as well:
9 A convex, concave, or atone function may accept as an argument an ai~ne
expression (assuming it is of compatible size).
For example, consider the function square , which is provided in the cvx atom
library. This function squares its argument; i.e., it computes x. ,x. (For array
arguments, it squares each element independently.) It is known to be convex,
provided its argument is real. So if x is a real variable, then
is accepted by cvx; and, thanks to the above rule, so is
square( A 9 x + b )
if A and b are constant matrices of compatible size.
The DCP ruleset also provides for certain nonlinear composit ions as well. The
four composit ion rules are:
9 If a convex function is nondecreasing in a given argument, then that argument
may be convex.
9 If a convex function is nonincreasing in a given argument, then that argument
may be concave.
- the difference between a concave expression and a convex expression;
- the product of a concave expression and a nonnegative constant;
- the product of a convex expression and a nonposit ive constant;
- the negation of a convex expression.
A valid convex set expression is
- a valid reference to a convex set in the atom library;
- the intersection of two or more convex set expressions;
- the sum or difference of convex set expressions;
- the sum or difference of a convex set expression and a constant;
- the product of a convex set expression and constant.
If an expression cannot be categorized by this ruleset, then it is rejected by
cvx. For matr ix and array expressions, these rules are applied on an elementwise
basis. We note that the set of rules listed above is redundant; there are much
smaller, equivalent sets of rules.
Of part icular note is that these expression rules forbid products between non-
constant expressions. We call this the no-product rule for obvious reasons. For
example, the expression xv/x , wr itten in cvx as x ,sqr t (x), is convex (at least
when x is positive) but is rejected by cvx as violating the above rules. Fortu-
nately, cvx provides a function called pou_pos (x, p) that implements the convex
and concave branches of x^p, so this expression can be written as pow(x ,3 /2 ) .
3.4 Compositions
A basic rule of convex analysis is that convexity is closed under composit ion
with an atone mapping. This is part of the DCP ruleset as well:
9 A convex, concave, or atone function may accept as an argument an ai~ne
expression (assuming it is of compatible size).
For example, consider the function square , which is provided in the cvx atom
library. This function squares its argument; i.e., it computes x. ,x. (For array
arguments, it squares each element independently.) It is known to be convex,
provided its argument is real. So if x is a real variable, then
is accepted by cvx; and, thanks to the above rule, so is
square( A 9 x + b )
if A and b are constant matrices of compatible size.
The DCP ruleset also provides for certain nonlinear composit ions as well. The
four composit ion rules are:
9 If a convex function is nondecreasing in a given argument, then that argument
may be convex.
9 If a convex function is nonincreasing in a given argument, then that argument
may be concave.
Page 9
Graph Implementations for Nonsmooth Convex Programs 103
9 If a concave function is nondecreasing in a given argument, then that argu-
ment may be concave.
9 If a concave function is nonincreasing in a given argument, then that argu-
ment may be convex.
(In each case, we assume that the argument is of compatible size.) In fact, nearly
every rule in the DCP ruleset can be derived from these composition rules.
For example, the pointwise maximum of convex functions is convex, because
the maximum function is convex and nondecreasing. Thus if x is a vector variable
then
max( abs( x ) )
obeys the first of the four composition rules and is therefore accepted by cvx.
In fact, the infinity-norm function norm( x, Inf ) is defined in exactly this
manner. Affine functions must obey these composition rules as well; but because
they are both convex and concave, they prove a bit more flexible. So, for example,
the expressions
are both valid nonlinear compositions in cvx since the rules for both the convex-
nondecreasing and convex-nonincreasing cases apply to sum.
3.5 The Ru leset in P ract ice
As we stated in the introduction to this section, the DCP rules are sufficient
but not necessary conditions for the convexity (or concavity) of an expression,
constraint, or objective. Some expressions which are obviously convex or concave
will fail to satisfy them. For example, if x is a cvx vector variable, then the
expression
sqrt( sum( square( x ) ) )
is rejected by cvx, because there is no rule governing the composition of a concave
nondecreasing function with a convex function. Fortunately, there is a simple
workaround in this case: use norm ( x ) instead, since norm is in the atom library
and is known by cvx to be convex.
This is an example of what is meant by our statement in the introduction that
disciplined convex programming requires the modeler to supply "just enough"
structure to enable the automation of the solution process. Obviously, both norm
and the longer, non-compliant version are equivalent numerically, but the latter
form enables cvx to complete the verification and conversion process. Of course,
because the library is finite, there will inevitably be instances where a simple
substitution is not possible. Thus to insure generality, the atom library must be
expandable.
9 If a concave function is nondecreasing in a given argument, then that argu-
ment may be concave.
9 If a concave function is nonincreasing in a given argument, then that argu-
ment may be convex.
(In each case, we assume that the argument is of compatible size.) In fact, nearly
every rule in the DCP ruleset can be derived from these composition rules.
For example, the pointwise maximum of convex functions is convex, because
the maximum function is convex and nondecreasing. Thus if x is a vector variable
then
max( abs( x ) )
obeys the first of the four composition rules and is therefore accepted by cvx.
In fact, the infinity-norm function norm( x, Inf ) is defined in exactly this
manner. Affine functions must obey these composition rules as well; but because
they are both convex and concave, they prove a bit more flexible. So, for example,
the expressions
are both valid nonlinear compositions in cvx since the rules for both the convex-
nondecreasing and convex-nonincreasing cases apply to sum.
3.5 The Ru leset in P ract ice
As we stated in the introduction to this section, the DCP rules are sufficient
but not necessary conditions for the convexity (or concavity) of an expression,
constraint, or objective. Some expressions which are obviously convex or concave
will fail to satisfy them. For example, if x is a cvx vector variable, then the
expression
sqrt( sum( square( x ) ) )
is rejected by cvx, because there is no rule governing the composition of a concave
nondecreasing function with a convex function. Fortunately, there is a simple
workaround in this case: use norm ( x ) instead, since norm is in the atom library
and is known by cvx to be convex.
This is an example of what is meant by our statement in the introduction that
disciplined convex programming requires the modeler to supply "just enough"
structure to enable the automation of the solution process. Obviously, both norm
and the longer, non-compliant version are equivalent numerically, but the latter
form enables cvx to complete the verification and conversion process. Of course,
because the library is finite, there will inevitably be instances where a simple
substitution is not possible. Thus to insure generality, the atom library must be
expandable.
Page 10
104 M.C. Grant and S.P. Boyd
4 Graph Implementations
Any modeling framework for optimization must provide a computational de-
scription of the functions its supports to the underlying solver. For a smooth
function, this traditionally consists of code to compute the value an derivatives
of the function at requested points. In cvx, it is possible to define a convex
or a concave function as the solution of a parameterized DCP. We call such a
definition a graph implementation, a term first coined in \[10\] and inspired by
the properties of epigraphs and hypographs of convex and concave functions,
respectively.
4.1 The Basics
Recall the definition of the epigraph of a function f :R n --~ (R U +oc):
epi f _a { (x, y) e R n x a I f(x) _ y }. (11)
A fundamental principle of convex analysis states that f is a convex function
if and only if epi f is a convex set. The relationship between the two can be
expresed in a reverse fashion as well:
f(x) =_ inf { y I (x, y) C epi f }. (12)
(We adopt the convention that the infimum of an empty set is +oc.) Equation
(12) expresses f as the solution to a convex optimization problem---or, more
accurately, a family of such problems, parameterized by the argument x.
A graph implementation f f takes the relationship in (12) and makes it
concrete, by expressing epi f in a solvable manner-- that is, with an equivalent
collection of constraints in x and y that are compatible with the target solver.
For example, consider the real absolute value function Abs(X) = IX I. Its epigraph
can be represented as an intersection of two linear inequalities:
epi fabs <_ < y , -x < y } (13)
A graph implementation is just a description or encapsulation of that transfor-
mation, justified mathematically through a simple equivalency of sets.
In cvx, graph implementations can be specified using the same syntax as other
cvx models, and are subject to the same DCP ruleset as well. The following
cvx/MATLAB@ code is a representation of faDs"
function y = f_abs(x)
cvx begin
variable y
minimize( y )
subject to
x <=y;
-x <=y;
cvx_end
4 Graph Implementations
Any modeling framework for optimization must provide a computational de-
scription of the functions its supports to the underlying solver. For a smooth
function, this traditionally consists of code to compute the value an derivatives
of the function at requested points. In cvx, it is possible to define a convex
or a concave function as the solution of a parameterized DCP. We call such a
definition a graph implementation, a term first coined in \[10\] and inspired by
the properties of epigraphs and hypographs of convex and concave functions,
respectively.
4.1 The Basics
Recall the definition of the epigraph of a function f :R n --~ (R U +oc):
epi f _a { (x, y) e R n x a I f(x) _ y }. (11)
A fundamental principle of convex analysis states that f is a convex function
if and only if epi f is a convex set. The relationship between the two can be
expresed in a reverse fashion as well:
f(x) =_ inf { y I (x, y) C epi f }. (12)
(We adopt the convention that the infimum of an empty set is +oc.) Equation
(12) expresses f as the solution to a convex optimization problem---or, more
accurately, a family of such problems, parameterized by the argument x.
A graph implementation f f takes the relationship in (12) and makes it
concrete, by expressing epi f in a solvable manner-- that is, with an equivalent
collection of constraints in x and y that are compatible with the target solver.
For example, consider the real absolute value function Abs(X) = IX I. Its epigraph
can be represented as an intersection of two linear inequalities:
epi fabs <_ < y , -x < y } (13)
A graph implementation is just a description or encapsulation of that transfor-
mation, justified mathematically through a simple equivalency of sets.
In cvx, graph implementations can be specified using the same syntax as other
cvx models, and are subject to the same DCP ruleset as well. The following
cvx/MATLAB@ code is a representation of faDs"
function y = f_abs(x)
cvx begin
variable y
minimize( y )
subject to
x <=y;
-x <=y;
cvx_end
Page 11
Graph Implementations for Nonsmooth Convex Programs 105
(The absolute value function abs in cvx is actually imp lemented a bit differently;
for example, it supports complex values and vector-valued arguments, in an
elementwise fashion.)
If f _abs is called with a numer ic value of x, then the cvx specification it con-
tains will construct a linear program with a single variable and two inequalities.
Upon reaching cvx_end, cvx will call the underlying solver and compute the
correct result--at least to within the tolerances of the solver. This is, of course,
a rather impractical way to compute the absolute value; in the real implemen-
tation of abs in cvx we avoid this inefficiency. But it is, at least, technically
correct, and it is also a useful way to debug a graph implementation.
The more interesting case is when f _abs is used within a cvx model, with
an affine cvx expression for an argument. In this case, the cvx specification
will be incomplete, because the value of x is not yet known. What cvx does in
this c ircumstance is to incorporate the specification
itself, in a manner not unlike the expansion of a in l ine function in C++. For
example, if z is a scalar cvx variable, then the constraint
f _abs(z -3 ) <= I;
will be translated internally by cvx as follows:
y<= i;
x == z-3;
x<=y;
-x <=y;
(Steps are taken as needed to avoid name conflicts with existing variables.) The
constraint is now in a form compatible with an efficient solver. Of course, two
new variables and several new constraints have been added, but in the long run
the added costs of expansions like this are far outweighed by the fact that a
much more efficient solver can now be used, because the nondifferentiability has
been eliminated.
Of course, the transformation of the absolute value function into an efficiently
solvable form is relatively well known. But while it may be obvious to some, it
is certainly not to everyone; and it is certainly convenient to have the transfor-
mation automated. For more advanced functions, the benefits should be more
clear.
4.2 Advanced Usage
Graph implementations of convex functions are not, in fact, limited to strict
epigraph representations. Suppose that S c R n x R m is a convex set and f 9
(R n R m) ~ (R U +ce) is jointly convex in x and y; then
f " a n ~ (a u -~-cx)), f (x) ~- inf { f(x, y) \[ (x, y) C S } (14)
is a convex function of x. If m -- 1 and f(x, y) a_ Y, then the epigraph form (12)
is recovered; but cvx fully supports this more general form.
(The absolute value function abs in cvx is actually imp lemented a bit differently;
for example, it supports complex values and vector-valued arguments, in an
elementwise fashion.)
If f _abs is called with a numer ic value of x, then the cvx specification it con-
tains will construct a linear program with a single variable and two inequalities.
Upon reaching cvx_end, cvx will call the underlying solver and compute the
correct result--at least to within the tolerances of the solver. This is, of course,
a rather impractical way to compute the absolute value; in the real implemen-
tation of abs in cvx we avoid this inefficiency. But it is, at least, technically
correct, and it is also a useful way to debug a graph implementation.
The more interesting case is when f _abs is used within a cvx model, with
an affine cvx expression for an argument. In this case, the cvx specification
will be incomplete, because the value of x is not yet known. What cvx does in
this c ircumstance is to incorporate the specification
itself, in a manner not unlike the expansion of a in l ine function in C++. For
example, if z is a scalar cvx variable, then the constraint
f _abs(z -3 ) <= I;
will be translated internally by cvx as follows:
y<= i;
x == z-3;
x<=y;
-x <=y;
(Steps are taken as needed to avoid name conflicts with existing variables.) The
constraint is now in a form compatible with an efficient solver. Of course, two
new variables and several new constraints have been added, but in the long run
the added costs of expansions like this are far outweighed by the fact that a
much more efficient solver can now be used, because the nondifferentiability has
been eliminated.
Of course, the transformation of the absolute value function into an efficiently
solvable form is relatively well known. But while it may be obvious to some, it
is certainly not to everyone; and it is certainly convenient to have the transfor-
mation automated. For more advanced functions, the benefits should be more
clear.
4.2 Advanced Usage
Graph implementations of convex functions are not, in fact, limited to strict
epigraph representations. Suppose that S c R n x R m is a convex set and f 9
(R n R m) ~ (R U +ce) is jointly convex in x and y; then
f " a n ~ (a u -~-cx)), f (x) ~- inf { f(x, y) \[ (x, y) C S } (14)
is a convex function of x. If m -- 1 and f(x, y) a_ Y, then the epigraph form (12)
is recovered; but cvx fully supports this more general form.
Page 12
106 M.C. Grant and S.P. Boyd
For example, consider the unit-halfwidth Huber penalty function h(x):
h" R~ n, h(x) A Ixl_<l
21xl- 1 Ixl _> 1 (15)
This function cannot be used in an optimization algorithm utilizing Newton's
method, because its Hessian is discontiuous at x = +1, and zero for Ix\[ _> 1.
However, it can be expressed in the form (14) in this manner:
h(x) a_inf{2v+w 2 \ [ \ [x \ [ _<v+w, <_ l} (16)
We can implement he Huber penalty function in cvx as follows:
funct ion cvx_optval = huber( x )
cvx_begin
var iab les w v;
min imize( 2 * v + square( w ) );
subject to
abs( x ) <= w + v;
cvx_end
If huber is called with a numeric value of x, then cvx will solve the resulting
QP and return the numeric result. (As with f_abs, there is a simpler way to
compute the Huber penalty when its argument is a numeric constant.) But
if huber is called from within a larger cvx specification, then cvx will use this
implementation to transform the call into a form compatible with the underlying
solver. Note that the precise transformation depends on how square and abs are
themselves implemented; multilevel transformations like this are quite typical.
There is a corresponding development for concave functions as well. Given
the set S above and a concave function g: ( Rn Rm) --+ (R \[3 +oo) is concave,
the function
/ . R (a v f(x) A { g(x, y) I (x, y) c s } (17)
is also a concave function. If 9(x, y) -~ y, then
f(x) A sup { y I (x, y) E S } (18)
_
gives the hypograph representation of f; that is, S - hypo f. In cvx, a concave
incomplete specification is simply one that uses a maximize objective instead of
a minimize objective.
Some functions are not thought of as nondifferentiable in a casual setting but
are technically so, and must be dealt with as such in an optimization algorithm.
Consider, for example, the real square root function (9) above. This function is
concave, and is smooth for positive x, but not at x - 0. Its hypograph, however, is
hypo fsqrt -~ { (x, y) \[ x _> 0, ~ _> y } - { (x, y) \[ max{y, 0} 2 _< x } (19)
For example, consider the unit-halfwidth Huber penalty function h(x):
h" R~ n, h(x) A Ixl_<l
21xl- 1 Ixl _> 1 (15)
This function cannot be used in an optimization algorithm utilizing Newton's
method, because its Hessian is discontiuous at x = +1, and zero for Ix\[ _> 1.
However, it can be expressed in the form (14) in this manner:
h(x) a_inf{2v+w 2 \ [ \ [x \ [ _<v+w, <_ l} (16)
We can implement he Huber penalty function in cvx as follows:
funct ion cvx_optval = huber( x )
cvx_begin
var iab les w v;
min imize( 2 * v + square( w ) );
subject to
abs( x ) <= w + v;
cvx_end
If huber is called with a numeric value of x, then cvx will solve the resulting
QP and return the numeric result. (As with f_abs, there is a simpler way to
compute the Huber penalty when its argument is a numeric constant.) But
if huber is called from within a larger cvx specification, then cvx will use this
implementation to transform the call into a form compatible with the underlying
solver. Note that the precise transformation depends on how square and abs are
themselves implemented; multilevel transformations like this are quite typical.
There is a corresponding development for concave functions as well. Given
the set S above and a concave function g: ( Rn Rm) --+ (R \[3 +oo) is concave,
the function
/ . R (a v f(x) A { g(x, y) I (x, y) c s } (17)
is also a concave function. If 9(x, y) -~ y, then
f(x) A sup { y I (x, y) E S } (18)
_
gives the hypograph representation of f; that is, S - hypo f. In cvx, a concave
incomplete specification is simply one that uses a maximize objective instead of
a minimize objective.
Some functions are not thought of as nondifferentiable in a casual setting but
are technically so, and must be dealt with as such in an optimization algorithm.
Consider, for example, the real square root function (9) above. This function is
concave, and is smooth for positive x, but not at x - 0. Its hypograph, however, is
hypo fsqrt -~ { (x, y) \[ x _> 0, ~ _> y } - { (x, y) \[ max{y, 0} 2 _< x } (19)
Page 13
Graph Implementations for Nonsmooth Convex Programs 107
Thus a graph implementation can solve the nondifferentiability problem. In cvx,
this function can be implemented as follows:
function y = f_sqrt(x)
cvx_begin
variable y
maximize( y )
subject to
square( y ) <= x
cvx end
This particular type of nondifferentiability also occurs in the concave entropy
function; it can be eliminated with a similar transformation.
4.3 Conic Solver Support
The most obvious benefit of graph implementations is their ability to describe
nonsmooth functions in a computationally efficient manner. But the solvers used
in the first publicly released versions of cvx posed a different challenge: they did
not support smooth functions either. Rather, these solvers solved semidefinite-
quadratic-linear programs (SQLPs)--problems of the form
minimize c T x
subject to Ax = b
X C K:I K~2 x . . .~L
(20)
where x is the optimization variable, .4 is a linear operator, b and c are vectors,
and the sets K:i are convex cones from a select list: the nonnegative orthant R~_,
the second-order cone Qn, and the semidefinite cone S~:
~n ~_A { (X, y) e R n R \] Ilxll2 <_ y } (21)
~; A { X C a nxn \] Z - X T, ~min(X) ~ 0 } (22)
Clearly, SQLPs are very closely related to SDPs; in fact, all SQLPs can be solved
as SDPs. For more information about these problems, consult \[12, 19\], or the
documentation on the solvers themselves \[16, 17\].
In practice, few application-driven models naturally present themselves as
SQLPs; rather, modelers have simply recognized that their problems can be
transformed into that form. In fact, as is known to readers of certain well-known
texts on the subject \[1, 5, 12, 14\], SQLPs are very versatile, and can represent
a wide variety of smooth and nonsmooth convex programs. The challenge, then,
lies in finding an SQLP representation f of a given convex program--assuming
one exists.
Using graph implementations, a variety of both smooth and nonsmooth func-
tions were added to the cvx atom library for SQLP solvers, including minimums
and maximums, absolute values, quadratic forms, convex and concave branches
of the power function x p, ~p norms, convex and concave polynomials, geometric
Thus a graph implementation can solve the nondifferentiability problem. In cvx,
this function can be implemented as follows:
function y = f_sqrt(x)
cvx_begin
variable y
maximize( y )
subject to
square( y ) <= x
cvx end
This particular type of nondifferentiability also occurs in the concave entropy
function; it can be eliminated with a similar transformation.
4.3 Conic Solver Support
The most obvious benefit of graph implementations is their ability to describe
nonsmooth functions in a computationally efficient manner. But the solvers used
in the first publicly released versions of cvx posed a different challenge: they did
not support smooth functions either. Rather, these solvers solved semidefinite-
quadratic-linear programs (SQLPs)--problems of the form
minimize c T x
subject to Ax = b
X C K:I K~2 x . . .~L
(20)
where x is the optimization variable, .4 is a linear operator, b and c are vectors,
and the sets K:i are convex cones from a select list: the nonnegative orthant R~_,
the second-order cone Qn, and the semidefinite cone S~:
~n ~_A { (X, y) e R n R \] Ilxll2 <_ y } (21)
~; A { X C a nxn \] Z - X T, ~min(X) ~ 0 } (22)
Clearly, SQLPs are very closely related to SDPs; in fact, all SQLPs can be solved
as SDPs. For more information about these problems, consult \[12, 19\], or the
documentation on the solvers themselves \[16, 17\].
In practice, few application-driven models naturally present themselves as
SQLPs; rather, modelers have simply recognized that their problems can be
transformed into that form. In fact, as is known to readers of certain well-known
texts on the subject \[1, 5, 12, 14\], SQLPs are very versatile, and can represent
a wide variety of smooth and nonsmooth convex programs. The challenge, then,
lies in finding an SQLP representation f of a given convex program--assuming
one exists.
Using graph implementations, a variety of both smooth and nonsmooth func-
tions were added to the cvx atom library for SQLP solvers, including minimums
and maximums, absolute values, quadratic forms, convex and concave branches
of the power function x p, ~p norms, convex and concave polynomials, geometric
Page 14
108 M.C. Grant and S.P. Boyd
means, eigenvalue and singular value functions, and determinants. Key omissions
include logarithms, exponentials, and entropy; such functions imply cannot be
exactly represented in an SQLP solver. (On the other hand, smooth solvers can-
not solve many of the eigenvalue and determinant problems for which SQLP
solvers excel.)
For a simple example, consider the function fsq(X) a_ x2; its epigraph form
(12) can be expressed using a single semidefinite cone:
fsq(X) A inf { y l \ [ y x x \]C }, (23)
The cvx version of this function is
function y = f_sq(x)
cvx_begin
variable y
minimize( y )
\[ y, x ; x, I \] == semidefinite(2);
cvx end
(Since MATLAB| does not have a set membership c operator, cvx uses equality
constraints and functions like semidef in i te to accomplish the same result.)
For a somewhat more complex example, consider the matrix fractional func-
tion f~f: (R n R n --~ (R U +oc), where
l xTy-1 yT
f~f(x, Y) - ~ x Y - ~- 0 (24)
+oc otherwise
This function is convex in both arguments, and implicitly constrains Y to be
both symmetric and positive definite. Its epigraph representation is
fmf(X,Y) Asup{z :\] ES~ +1 } (25)
so it may be implemented in cvx as follows:
funct ion cvx_optval = f_mf( x, Y )
n = length( x );
cvx_begin
var iab le z ;
minimize( z ) ;
sub ject to
\[ Y, x ; x ' , z \] == semidef in i te (n+l ) ;
cvx_end
Both f_sq and f_mf are relatively simple examples in comparison to other
functions in the cvx library. The complexity of some SQLP implementations is in
some cases quite striking. For example, the ~p norm can be represented exactly in
an SQLP whenever p = n/d is rational. The number of cone constraints required
to represent i , however, depends not only on the size of the vector involved, but
also in the pattern of bits in a binary representation of n and d! Needless to
say, performing such transformations by hand is quite impractical--but once
implemented, quite reasonable for a computer.
means, eigenvalue and singular value functions, and determinants. Key omissions
include logarithms, exponentials, and entropy; such functions imply cannot be
exactly represented in an SQLP solver. (On the other hand, smooth solvers can-
not solve many of the eigenvalue and determinant problems for which SQLP
solvers excel.)
For a simple example, consider the function fsq(X) a_ x2; its epigraph form
(12) can be expressed using a single semidefinite cone:
fsq(X) A inf { y l \ [ y x x \]C }, (23)
The cvx version of this function is
function y = f_sq(x)
cvx_begin
variable y
minimize( y )
\[ y, x ; x, I \] == semidefinite(2);
cvx end
(Since MATLAB| does not have a set membership c operator, cvx uses equality
constraints and functions like semidef in i te to accomplish the same result.)
For a somewhat more complex example, consider the matrix fractional func-
tion f~f: (R n R n --~ (R U +oc), where
l xTy-1 yT
f~f(x, Y) - ~ x Y - ~- 0 (24)
+oc otherwise
This function is convex in both arguments, and implicitly constrains Y to be
both symmetric and positive definite. Its epigraph representation is
fmf(X,Y) Asup{z :\] ES~ +1 } (25)
so it may be implemented in cvx as follows:
funct ion cvx_optval = f_mf( x, Y )
n = length( x );
cvx_begin
var iab le z ;
minimize( z ) ;
sub ject to
\[ Y, x ; x ' , z \] == semidef in i te (n+l ) ;
cvx_end
Both f_sq and f_mf are relatively simple examples in comparison to other
functions in the cvx library. The complexity of some SQLP implementations is in
some cases quite striking. For example, the ~p norm can be represented exactly in
an SQLP whenever p = n/d is rational. The number of cone constraints required
to represent i , however, depends not only on the size of the vector involved, but
also in the pattern of bits in a binary representation of n and d! Needless to
say, performing such transformations by hand is quite impractical--but once
implemented, quite reasonable for a computer.
Page 15
Graph Implementations forNonsmooth Convex Programs 109
5 Final Words
We believe that disciplined convex programming closes a significant gap between
the theory and practice of convex optimization. A large fraction of useful con-
vex programs are nonsmooth; and until now, those who wished to solve them
were faced with unattractive options: transform them by hand to a different,
more easily solved form; develop a custom solver; utilize a poorly-performing
subgradient-based method; or approximate. A modeling framework that sup-
ports disciplined convex programming provides a truly attractive alternative in
most of these cases.
References
.
.
10.
11.
12.
13.
14.
15.
Alizadeh, F., Goldfarb, D.: Second-order cone programming (January 2004)
Bertsekas, D.P.: Convex Analysis and Optimization. In: Nedi6, A., Ozdaglar, A.E.
(eds.) Athena Scientific (2003)
Bland, R., Goldfarb, D., Todd, M.: The ellipsoid method: A survey. Operations
Research 29(6), 1039-1091 (1981)
Borwein, J., Lewis, A.: Convex Analysis and Nonlinear Optimization: Theory and
Examples. Springer, Heidelberg (2000)
Ben-Tal, A., Nemirovski, A.: Lectures on Modern Convex Optimization: Analysis,
Algorithms and Engineering Applications. MPS/SIAM Series on Optimization.
SIAM, Philadelphia (2001)
Boyd, S., Vandenberghe, L.: Convex Optimization. Cambridge Univ. Press, Cam-
bridge (2004), http://www, stanford, edu/~boyd/cvxbook.html
Dantzig, G.: Linear Programming and Extensions. Princeton University Press,
Princeton (1963)
Grant, M., Boyd, S" CVX" MATLAB| software for disciplined convex program-
ming, version 1.1 (September 2007), http://www, stanford, edu/~ boyd/cvx/
Grant, M., Boyd, S., Ye, Y.: Disciplined convex programming. In: Liberti, L., Mac-
ulan, N. (eds.) Global Optimization: from Theory to Implementation, Nonconvex
Optimization and Its Applications, pp. 155-210. Springer Science+Business Me-
dia, Inc., New York (2006)
Grant, M.: Disciplined Convex Programming. PhD thesis, Department ofElectrical
Engineering, Stanford University (December 2004)
LSfberg, J." YALMIP: A toolbox for modeling and optimization in
MATLAB (B) In: Proceedings of the CACSD Conference, Taipei, Taiwan (2004),
http ://control. ee. ethz. ch/~ j oloef/yalmip, php
Lobo, M., Vandenberghe, L., Boyd, S., Lebret, H.: Applications of second-order
cone programming. Linear Algebra and its Applications 284, 193-228 (1998) (spe-
cial issue on Signals and Image Processing)
MOSEK ApS. Mosek (software package) (September 2007),
http://www, mosek, tom
Nesterov, Yu., Nemirovsky, A.: Interior-Point Polynomial Algorithms in Convex
Programming: Theory and Algorithms of Studies in Applied Mathematics, vol. 13.
SIAM Publications, Philadelphia, PA (1993)
Rockafellar, R.T.: Convex Analysis. Princeton University Press, Princeton (1970)
5 Final Words
We believe that disciplined convex programming closes a significant gap between
the theory and practice of convex optimization. A large fraction of useful con-
vex programs are nonsmooth; and until now, those who wished to solve them
were faced with unattractive options: transform them by hand to a different,
more easily solved form; develop a custom solver; utilize a poorly-performing
subgradient-based method; or approximate. A modeling framework that sup-
ports disciplined convex programming provides a truly attractive alternative in
most of these cases.
References
.
.
10.
11.
12.
13.
14.
15.
Alizadeh, F., Goldfarb, D.: Second-order cone programming (January 2004)
Bertsekas, D.P.: Convex Analysis and Optimization. In: Nedi6, A., Ozdaglar, A.E.
(eds.) Athena Scientific (2003)
Bland, R., Goldfarb, D., Todd, M.: The ellipsoid method: A survey. Operations
Research 29(6), 1039-1091 (1981)
Borwein, J., Lewis, A.: Convex Analysis and Nonlinear Optimization: Theory and
Examples. Springer, Heidelberg (2000)
Ben-Tal, A., Nemirovski, A.: Lectures on Modern Convex Optimization: Analysis,
Algorithms and Engineering Applications. MPS/SIAM Series on Optimization.
SIAM, Philadelphia (2001)
Boyd, S., Vandenberghe, L.: Convex Optimization. Cambridge Univ. Press, Cam-
bridge (2004), http://www, stanford, edu/~boyd/cvxbook.html
Dantzig, G.: Linear Programming and Extensions. Princeton University Press,
Princeton (1963)
Grant, M., Boyd, S" CVX" MATLAB| software for disciplined convex program-
ming, version 1.1 (September 2007), http://www, stanford, edu/~ boyd/cvx/
Grant, M., Boyd, S., Ye, Y.: Disciplined convex programming. In: Liberti, L., Mac-
ulan, N. (eds.) Global Optimization: from Theory to Implementation, Nonconvex
Optimization and Its Applications, pp. 155-210. Springer Science+Business Me-
dia, Inc., New York (2006)
Grant, M.: Disciplined Convex Programming. PhD thesis, Department ofElectrical
Engineering, Stanford University (December 2004)
LSfberg, J." YALMIP: A toolbox for modeling and optimization in
MATLAB (B) In: Proceedings of the CACSD Conference, Taipei, Taiwan (2004),
http ://control. ee. ethz. ch/~ j oloef/yalmip, php
Lobo, M., Vandenberghe, L., Boyd, S., Lebret, H.: Applications of second-order
cone programming. Linear Algebra and its Applications 284, 193-228 (1998) (spe-
cial issue on Signals and Image Processing)
MOSEK ApS. Mosek (software package) (September 2007),
http://www, mosek, tom
Nesterov, Yu., Nemirovsky, A.: Interior-Point Polynomial Algorithms in Convex
Programming: Theory and Algorithms of Studies in Applied Mathematics, vol. 13.
SIAM Publications, Philadelphia, PA (1993)
Rockafellar, R.T.: Convex Analysis. Princeton University Press, Princeton (1970)
Page 16
110 M.C. Grant and S.P. Boyd
16.
17.
18.
19.
20.
Sturm, J." Using SeDuMi 1.02, a MATLAB| toolbox for optimization over sym-
metric cones. Optimization Methods and Software 11, 625-653 (1999), Updated
version available at http://sedum ca
Toh, K., Todd, M., Tutuncu, R." SDPT3 a MATLAB | software package for
semidefinite programming. Optimization Methods and Software 11,545-581 (1999)
Vanderbei, R.: LOQO: An interior point code for quadratic programming. Opti-
mization Methods and Software 11, 451-484 (1999)
Vandenberghe, L. Boyd, S.: Semidefinite programming. SIAM Review 38(1), 49-95
(1996)
van Tiel, J.: Convex Analysis. An Introductory Text. John Wiley & Sons, Chich-
ester (1984)
16.
17.
18.
19.
20.
Sturm, J." Using SeDuMi 1.02, a MATLAB| toolbox for optimization over sym-
metric cones. Optimization Methods and Software 11, 625-653 (1999), Updated
version available at http://sedum ca
Toh, K., Todd, M., Tutuncu, R." SDPT3 a MATLAB | software package for
semidefinite programming. Optimization Methods and Software 11,545-581 (1999)
Vanderbei, R.: LOQO: An interior point code for quadratic programming. Opti-
mization Methods and Software 11, 451-484 (1999)
Vandenberghe, L. Boyd, S.: Semidefinite programming. SIAM Review 38(1), 49-95
(1996)
van Tiel, J.: Convex Analysis. An Introductory Text. John Wiley & Sons, Chich-
ester (1984)
Sign up today - FREE
Mendeley saves you time finding and organizing research. Learn more
- All your research in one place
- Add and import papers easily
- Access it anywhere, anytime
Start using Mendeley in seconds!
Readership Statistics
28 Readers on Mendeley
by Discipline
21% Engineering
by Academic Status
32% Ph.D. Student
14% Assistant Professor
7% Doctoral Student
by Country
32% United States
18% Sweden
14% China




