Optimization
Mathematical optimization
Optimization arises everywhere.
But most of them are intractable.
Exception is the tractable Convex optimization.
Convex optimization
Problem definition (standard form)
- equality constraints are linear
- are convex.
Solvers
CVXPY
from cvxpy import *
x = Variable(n)
cost = sum_squares(A*x-b) + gamma*norm(x,1)
prob = Problem(Minimize(cost), [norm(x, "inf")<=1])
opt_val = prob.solve()
solution = x.valuepython
Applications
Portfolio Optimization
Regression variation
Model fitting
Regularized loss minimization
- Regression Problem
-
Regularized Loss
m examples, each has n dimensions.
- scales regularization.
- all lead to convex fitting problems.
Constructive Convex Analysis & DCP
Convex Optimization
Conic form
- is convex cone.
- linear objective, equality constraints.
How to solve a convex optimization problem?
Curvature
- convex (凹)
- definition:
- can be constructed using basic functions that are convex or concave, and using transformations that preserve convexity.
- concave (凸)
- is convex
- affine
- both concave and convex.
- has the form
Basic convex functions
- , affine
Less basic ones:
- , jointly convex for x and y.
- , jointly convex for x and y.
- sum of largest k entries
Basic concave functions
Less basic ones:
Calculus rules that keeps convexity
-
nonnegative scaling
-
sum
-
affine composition
-
pointwise maximum (non-differentiability)
-
general composition rule:
is convex when is convex and for each :
- is increasing in argument , and is convex, or
- is decreasing in argument , and is concave, or
- is affine
eg. show the following function is convex:
Constructive Convexity verification
view the function as an expression tree, and use the general composition rule to determine the convexity.
sufficient, but not necessary for convexity.
- is convex, but can't be proved by Constructive Convexity verification.
Disciplined Convex Program (DCP)
framework for describing convex optimization problems based on constructive convex analysis.
Definition
a DCP has
- zero or one objective with form
- minimize {scalar convex expression} or
- maximize {scalar concave expression}
- zero or more constraints, with form
- {convex expression} <= {concave expression} or
- {concave expression} >= {convex expression} or
- {affine expression} == {affine expression}
Expressions are formed from variables, constants, and functions have known convexity, monotonicity and sign properties.
Canonicalization
DCP is very easy to build a parser/analyzer, and be transformed to cone form, then solved by some generic solver.
CVXPY will raise error if the constraints not obey the DCP rules.