Download Convex Optimization Overview

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Pattern recognition wikipedia , lookup

Lateral computing wikipedia , lookup

Perturbation theory wikipedia , lookup

Theoretical ecology wikipedia , lookup

Computational electromagnetics wikipedia , lookup

Natural computing wikipedia , lookup

Open energy system models wikipedia , lookup

Operations research wikipedia , lookup

Knapsack problem wikipedia , lookup

Artificial intelligence wikipedia , lookup

Mathematical physics wikipedia , lookup

Travelling salesman problem wikipedia , lookup

Simplex algorithm wikipedia , lookup

Least squares wikipedia , lookup

Theoretical computer science wikipedia , lookup

Inverse problem wikipedia , lookup

Computational complexity theory wikipedia , lookup

Drift plus penalty wikipedia , lookup

Multiple-criteria decision analysis wikipedia , lookup

Genetic algorithm wikipedia , lookup

Mathematical economics wikipedia , lookup

Multi-objective optimization wikipedia , lookup

Mathematical optimization wikipedia , lookup

Transcript
Convex Optimization Overview
Stephen Boyd
Steven Diamond
Jaehyun Park
EE & CS Departments
Stanford University
SIST, Shanghai, March 26-28 2016
1
Outline
Mathematical Optimization
Convex Optimization
Solvers & Modeling Languages
Examples
Summary
2
Outline
Mathematical Optimization
Convex Optimization
Solvers & Modeling Languages
Examples
Summary
Mathematical Optimization
3
Optimization problem
minimize f0 (x)
subject to fi (x) ≤ 0, i = 1, . . . , m
gi (x) = 0, i = 1, . . . , p
I
x ∈ Rn is (vector) variable to be chosen
I
f0 is the objective function, to be minimized
I
f1 , . . . , fm are the inequality constraint functions
I
g1 , . . . , gp are the equality constraint functions
I
variations: maximize objective, multiple objectives, . . .
Mathematical Optimization
4
Finding good (or best) actions
I
x represents some action, e.g.,
I
I
I
I
I
I
I
trades in a portfolio
airplane control surface deflections
schedule or assignment
resource allocation
transmitted signal
constraints limit actions or impose conditions on outcome
the smaller the objective f0 (x), the better
I
I
I
I
total cost (or negative profit)
deviation from desired or target outcome
fuel use
risk
Mathematical Optimization
5
Engineering design
I
I
x represents a design (of a circuit, device, structure, . . . )
constraints come from
I
I
I
manufacturing process
performance requirements
objective f0 (x) is combination of cost, weight, power, . . .
Mathematical Optimization
6
Finding good models
I
x represents the parameters in a model
I
constraints impose requirements on model parameters
(e.g., nonnegativity)
I
objective f0 (x) is the prediction error on some observed data
(and possibly a term that penalizes model complexity)
Mathematical Optimization
7
Inversion
I
x is something we want to estimate/reconstruct, given
some measurement y
I
constraints come from prior knowledge about x
I
objective f0 (x) measures deviation between predicted and
actual measurements
Mathematical Optimization
8
Worst-case analysis (pessimization)
I
variables are actions or parameters out of our control
(and possibly under the control of an adversary)
I
constraints limit the possible values of the parameters
I
minimizing −f0 (x) finds worst possible parameter values
I
if the worst possible value of f0 (x) is tolerable, you’re OK
I
it’s good to know what the worst possible scenario can be
Mathematical Optimization
9
Optimization-based models
I
model an entity as taking actions that solve an optimization
problem
I
I
I
I
an individual makes choices that maximize expected utility
an organism acts to maximize its reproductive success
reaction rates in a cell maximize growth
currents in an electric circuit minimize total power
Mathematical Optimization
10
Optimization-based models
I
model an entity as taking actions that solve an optimization
problem
I
I
I
I
an individual makes choices that maximize expected utility
an organism acts to maximize its reproductive success
reaction rates in a cell maximize growth
currents in an electric circuit minimize total power
I
(except the last) these are very crude models
I
and yet, they often work very well
Mathematical Optimization
10
Summary
I
summary: optimization arises everywhere
Mathematical Optimization
11
Summary
I
summary: optimization arises everywhere
I
the bad news: most optimization problems are intractable
i.e., we cannot solve them
Mathematical Optimization
11
Summary
I
summary: optimization arises everywhere
I
the bad news: most optimization problems are intractable
i.e., we cannot solve them
I
an exception: convex optimization problems are tractable
i.e., we (generally) can solve them
Mathematical Optimization
11
Outline
Mathematical Optimization
Convex Optimization
Solvers & Modeling Languages
Examples
Summary
Convex Optimization
12
Convex optimization problem
convex optimization problem:
minimize f0 (x)
subject to fi (x) ≤ 0,
Ax = b
i = 1, . . . , m
I
variable x ∈ Rn
I
equality constraints are linear
I
f0 , . . . , fm are convex: for θ ∈ [0, 1],
fi (θx + (1 − θ)y ) ≤ θfi (x) + (1 − θ)fi (y )
i.e., fi have nonnegative (upward) curvature
Convex Optimization
13
Why
I
beautiful, nearly complete theory
I
duality, optimality conditions, . . .
Convex Optimization
14
Why
I
beautiful, nearly complete theory
I
I
duality, optimality conditions, . . .
effective algorithms, methods (in theory and practice)
I
I
get global solution (and optimality certificate)
polynomial complexity
Convex Optimization
14
Why
I
beautiful, nearly complete theory
I
I
effective algorithms, methods (in theory and practice)
I
I
I
duality, optimality conditions, . . .
get global solution (and optimality certificate)
polynomial complexity
conceptual unification of many methods
Convex Optimization
14
Why
I
beautiful, nearly complete theory
I
I
duality, optimality conditions, . . .
effective algorithms, methods (in theory and practice)
I
I
get global solution (and optimality certificate)
polynomial complexity
I
conceptual unification of many methods
I
lots of applications (many more than previously thought)
Convex Optimization
14
Application areas
I
machine learning, statistics
I
finance
I
supply chain, revenue management, advertising
I
control
I
signal and image processing, vision
I
networking
I
circuit design
I
combinatorial optimization
I
quantum mechanics
I
flux-based analysis
Convex Optimization
15
The approach
I
I
try to formulate your optimization problem as convex
if you succeed, you can (usually) solve it (numerically)
I
I
using generic software if your problem is not really big
by developing your own software otherwise
Convex Optimization
16
The approach
I
I
try to formulate your optimization problem as convex
if you succeed, you can (usually) solve it (numerically)
I
I
I
using generic software if your problem is not really big
by developing your own software otherwise
some tricks:
I
I
I
change of variables
approximation of true objective, constraints
relaxation: ignore terms or constraints you can’t handle
Convex Optimization
16
Outline
Mathematical Optimization
Convex Optimization
Solvers & Modeling Languages
Examples
Summary
Solvers & Modeling Languages
17
Medium-scale solvers
I
1000s–10000s variables, constraints
I
reliably solved by interior-point methods on single machine
(especially for problems in standard cone form)
I
exploit problem sparsity
I
not quite a technology, but getting there
I
used in control, finance, engineering design, . . .
Solvers & Modeling Languages
18
Large-scale solvers
I
I
100k – 1B variables, constraints
solved using custom (often problem specific) methods
I
I
I
I
limited memory BFGS
stochastic subgradient
block coordinate descent
operator splitting methods
I
require custom implementation, tuning for each problem
I
used in machine learning, image processing, . . .
Solvers & Modeling Languages
19
Modeling languages
I
(new) high level language support for convex optimization
I
I
I
I
describe problem in high level language
description automatically transformed to a standard form
solved by standard solver, transformed back to original form
implementations:
I
I
I
YALMIP, CVX (Matlab)
CVXPY (Python)
Convex.jl (Julia)
Solvers & Modeling Languages
20
CVX
(Grant & Boyd, 2005)
cvx_begin
variable x(n)
% declare vector variable
minimize sum(square(A*x-b)) + gamma*norm(x,1)
subject to norm(x,inf) <= 1
cvx_end
I
I
A, b, gamma are constants (gamma nonnegative)
after cvx_end
I
I
problem is converted to standard form and solved
variable x is over-written with (numerical) solution
Solvers & Modeling Languages
21
CVXPY
(Diamond & Boyd, 2013)
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.value
I
A, b, gamma are constants (gamma nonnegative)
I
solve method converts problem to standard form, solves,
assigns value attributes
Solvers & Modeling Languages
22
Convex.jl
(Udell, Hong, Mohan, Zeng, Diamond, Boyd, 2014)
using Convex
x = Variable(n);
cost = sum_squares(A*x-b) + gamma*norm(x,1);
prob = minimize(cost, [norm(x,Inf) <= 1]);
opt_val = solve!(prob);
solution = x.value;
I
A, b, gamma are constants (gamma nonnegative)
I
solve! method converts problem to standard form, solves,
assigns value attributes
Solvers & Modeling Languages
23
Modeling languages
I
enable rapid prototyping (for small and medium problems)
I
ideal for teaching (can do a lot with short scripts)
I
slower than custom methods, but often not much
I
current work focuses on extension to large problems
Solvers & Modeling Languages
24
Outline
Mathematical Optimization
Convex Optimization
Solvers & Modeling Languages
Examples
Summary
Examples
25
Radiation treatment planning
I
radiation beams with intensities xj ≥ 0 directed at patient
I
radiation dose yi received in voxel i
I
y = Ax
I
A ∈ Rm×n comes from beam geometry, physics
goal is to choose x to deliver prescribed radiation dose di
I
I
I
di = 0 for non-tumor voxels
di > 0 for tumor voxels
I
y = d not possible, so we’ll need to compromise
I
typical problem has n = 103 beams, m = 106 voxels
Examples
26
Radiation treatment planning via convex optimization
P
minimize
i fi (yi )
subject to x ≥ 0, y = Ax
I
variables x ∈ Rn , y ∈ Rm
I
objective terms are
fi (yi ) = wiover (yi − di )+ + wiunder (di − yi )+
I
wiover and wiunder are positive weights
I
i.e., we charge linearly for over- and under-dosing
I
a convex problem
Examples
27
Example
I
I
real patient case with n = 360 beams, m = 360000 voxels
optimization-based plan essentially the same as plan used
Examples
28
Example
I
I
real patient case with n = 360 beams, m = 360000 voxels
optimization-based plan essentially the same as plan used
I
I
Examples
but we computed the plan in a few seconds on a GPU
original plan took hours of least-squares weight tweaking
28
Image in-painting
I
guess pixel values in obscured/corrupted parts of image
I
total variation in-painting: choose pixel values xij ∈ R3 to
minimize total variation
X xi+1,j − xij TV(x) =
xi,j+1 − xij 2
i,j
I
a convex problem
Examples
29
Example
512 × 512 color image (n ≈ 800000 variables)
Original
Examples
Corrupted
30
Example
Original
Examples
Recovered
31
Example
80% of pixels removed
Original
Examples
Corrupted
32
Example
80% of pixels removed
Original
Examples
Recovered
33
Control
PT −1
minimize
t=0 `(xt , ut ) + `T (xT )
subject to xt+1 = Axt + But
(xt , ut ) ∈ C, xT ∈ CT
I
variables are
I
I
system states x1 , . . . , xT ∈ Rn
inputs or actions u0 , . . . , uT −1 ∈ Rm
I
` is stage cost, `T is terminal cost
I
C is state/action constraints; CT is terminal constraint
I
convex problem when costs, constraints are convex
I
applications in many fields
Examples
34
Example
I
n = 8 states, m = 2 inputs, horizon T = 50
I
randomly chosen A, B (with A ≈ I )
I
input constraint kut k∞ ≤ 1
I
terminal constraint xT = 0 (‘regulator’)
I
`(x, u) = kxk22 + kuk22 (traditional)
I
random initial state x0
Examples
35
Example
Examples
36
Support vector machine classifier with `1 -regularization
I
given data (xi , yi ), i = 1, . . . , m
I
I
xi ∈ Rn are feature vectors
y ∈ {±1} are associated boolean outcomes
I
linear classifier ŷ = sign(β T x − v )
I
find parameters β, v by minimizing (convex function)
X
(1/m)
1 − yi (β T xi − v ) + λkβk1
i
I
I
I
I
+
first term is average hinge loss
second term shrinks coefficients in β and encourages sparsity
λ ≥ 0 is (regularization) parameter
simultaneously selects features and fits classifier
Examples
37
Example
I
I
n = 20 features
trained and tested on m = 1000 examples each
Examples
38
Example
βi vs. λ (regularization path)
Examples
39
Outline
Mathematical Optimization
Convex Optimization
Solvers & Modeling Languages
Examples
Summary
Summary
40
Summary
I
convex optimization problems arise in many applications
I
convex optimization problems can be solved effectively
I
I
I
using generic methods for not huge problems
by developing custom methods for huge problems
high level language support (CVX/CVXPY/Convex.jl)
makes prototyping easy
Summary
41
Resources
many researchers have worked on the topics covered
I
Convex Optimization (book)
I
EE364a (course slides, videos, code, homework, . . . )
I
software CVX, CVXPY, Convex.jl
all available online
Summary
42