• No results found

Convex Optimization Overview

N/A
N/A
Protected

Academic year: 2021

Share "Convex Optimization Overview"

Copied!
50
0
0

Loading.... (view fulltext now)

Full text

(1)

Convex Optimization Overview

Stephen Boyd Steven Diamond Enzo Busseti Akshay Agrawal Junzi Zhang

EE & CS Departments Stanford University

1

(2)

Outline

Mathematical Optimization Convex Optimization

Solvers & Modeling Languages Examples

Summary

2

(3)

Outline

Mathematical Optimization Convex Optimization

Solvers & Modeling Languages Examples

Summary

Mathematical Optimization 3

(4)

Optimization problem

minimize f

0

(x )

subject to f

i

(x ) ≤ 0, i = 1, . . . , m g

i

(x ) = 0, i = 1, . . . , p

I

x ∈ R

n

is (vector) variable to be chosen

I

f

0

is the objective function, to be minimized

I

f

1

, . . . , f

m

are the inequality constraint functions

I

g

1

, . . . , g

p

are the equality constraint functions

I

variations: maximize objective, multiple objectives, . . .

Mathematical Optimization 4

(5)

Finding good (or best) actions

I

x represents some action, e.g.,

I

trades in a portfolio

I

airplane control surface deflections

I

schedule or assignment

I

resource allocation

I

transmitted signal

I

constraints limit actions or impose conditions on outcome

I

the smaller the objective f

0

(x ), the better

I

total cost (or negative profit)

I

deviation from desired or target outcome

I

fuel use

I

risk

Mathematical Optimization 5

(6)

Engineering design

I

x represents a design (of a circuit, device, structure, . . . )

I

constraints come from

I

manufacturing process

I

performance requirements

I

objective f

0

(x ) is combination of cost, weight, power, . . .

Mathematical Optimization 6

(7)

Finding good models

I

x represents the parameters in a model

I

constraints impose requirements on model parameters (e.g., nonnegativity)

I

objective f

0

(x ) is the prediction error on some observed data (and possibly a term that penalizes model complexity)

Mathematical Optimization 7

(8)

Inversion

I

x is something we want to estimate/reconstruct, given some measurement y

I

constraints come from prior knowledge about x

I

objective f

0

(x ) measures deviation between predicted and actual measurements

Mathematical Optimization 8

(9)

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 −f

0

(x ) finds worst possible parameter values

I

if the worst possible value of f

0

(x ) is tolerable, you’re OK

I

it’s good to know what the worst possible scenario can be

Mathematical Optimization 9

(10)

Optimization-based models

I

model an entity as taking actions that solve an optimization problem

I

an individual makes choices that maximize expected utility

I

an organism acts to maximize its reproductive success

I

reaction rates in a cell maximize growth

I

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

(11)

Optimization-based models

I

model an entity as taking actions that solve an optimization problem

I

an individual makes choices that maximize expected utility

I

an organism acts to maximize its reproductive success

I

reaction rates in a cell maximize growth

I

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

(12)

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

(13)

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

(14)

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

(15)

Outline

Mathematical Optimization Convex Optimization

Solvers & Modeling Languages Examples

Summary

Convex Optimization 12

(16)

Convex optimization problem

convex optimization problem:

minimize f

0

(x )

subject to f

i

(x ) ≤ 0, i = 1, . . . , m Ax = b

I

variable x ∈ R

n

I

equality constraints are linear

I

f

0

, . . . , f

m

are convex: for θ ∈ [0, 1],

f

i

(θx + (1 − θ)y ) ≤ θf

i

(x ) + (1 − θ)f

i

(y ) i.e., f

i

have nonnegative (upward) curvature

Convex Optimization 13

(17)

Why

I

beautiful, nearly complete theory

I

duality, optimality conditions, . . .

I

effective algorithms, methods (in theory and practice)

I

get global solution (and optimality certificate)

I

polynomial complexity

I

conceptual unification of many methods

I

lots of applications (many more than previously thought)

Convex Optimization 14

(18)

Why

I

beautiful, nearly complete theory

I

duality, optimality conditions, . . .

I

effective algorithms, methods (in theory and practice)

I

get global solution (and optimality certificate)

I

polynomial complexity

I

conceptual unification of many methods

I

lots of applications (many more than previously thought)

Convex Optimization 14

(19)

Why

I

beautiful, nearly complete theory

I

duality, optimality conditions, . . .

I

effective algorithms, methods (in theory and practice)

I

get global solution (and optimality certificate)

I

polynomial complexity

I

conceptual unification of many methods

I

lots of applications (many more than previously thought)

Convex Optimization 14

(20)

Why

I

beautiful, nearly complete theory

I

duality, optimality conditions, . . .

I

effective algorithms, methods (in theory and practice)

I

get global solution (and optimality certificate)

I

polynomial complexity

I

conceptual unification of many methods

I

lots of applications (many more than previously thought)

Convex Optimization 14

(21)

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

(22)

The approach

I

try to formulate your optimization problem as convex

I

if you succeed, you can (usually) solve it (numerically)

I

using generic software if your problem is not really big

I

by developing your own software otherwise

I

some tricks:

I

change of variables

I

approximation of true objective, constraints

I

relaxation: ignore terms or constraints you can’t handle

Convex Optimization 16

(23)

The approach

I

try to formulate your optimization problem as convex

I

if you succeed, you can (usually) solve it (numerically)

I

using generic software if your problem is not really big

I

by developing your own software otherwise

I

some tricks:

I

change of variables

I

approximation of true objective, constraints

I

relaxation: ignore terms or constraints you can’t handle

Convex Optimization 16

(24)

Outline

Mathematical Optimization Convex Optimization

Solvers & Modeling Languages Examples

Summary

Solvers & Modeling Languages 17

(25)

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

(26)

Large-scale solvers

I

100k – 1B variables, constraints

I

solved using custom (often problem specific) methods

I

limited memory BFGS

I

stochastic subgradient

I

block coordinate descent

I

operator splitting methods

I

require custom implementation, tuning for each problem

I

used in machine learning, image processing, . . .

Solvers & Modeling Languages 19

(27)

Modeling languages

I

(new) high level language support for convex optimization

I

describe problem in high level language

I

description automatically transformed to a standard form

I

solved by standard solver, transformed back to original form

I

implementations:

I

YALMIP, CVX (Matlab)

I

CVXPY (Python)

I

Convex.jl (Julia)

I

CVXR (R)

Solvers & Modeling Languages 20

(28)

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

A, b, gamma are constants (gamma nonnegative)

I

after cvx_end

I

problem is converted to standard form and solved

I

variable x is over-written with (numerical) solution

Solvers & Modeling Languages 21

(29)

CVXPY

(Diamond & Boyd, 2013); (Agrawal et al., 2018)

import cvxpy as cp x = cp.Variable(n)

cost = cp.sum_squares(A*x-b) + gamma*cp.norm(x,1) prob = cp.Problem(cp.Minimize(cost),

[cp.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

(30)

Convex.jl

(Udell et al., 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

(31)

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

(32)

Outline

Mathematical Optimization Convex Optimization

Solvers & Modeling Languages Examples

Summary

Examples 25

(33)

Radiation treatment planning

I

radiation beams with intensities x

j

≥ 0 directed at patient

I

radiation dose y

i

received in voxel i

I

y = Ax

I

A ∈ R

m×n

comes from beam geometry, physics

I

goal is to choose x to deliver prescribed radiation dose d

i

I

d

i

= 0 for non-tumor voxels

I

d

i

> 0 for tumor voxels

I

y = d not possible, so we’ll need to compromise

I

typical problem has n = 10

3

beams, m = 10

6

voxels

Examples 26

(34)

Radiation treatment planning via convex optimization

minimize P

i

f

i

(y

i

)

subject to x ≥ 0, y = Ax

I

variables x ∈ R

n

, y ∈ R

m

I

objective terms are

f

i

(y

i

) = w

iover

(y

i

− d

i

)

+

+ w

iunder

(d

i

− y

i

)

+

I

w

iover

and w

iunder

are positive weights

I

i.e., we charge linearly for over- and under-dosing

I

a convex problem

Examples 27

(35)

Example

I

real patient case with n = 360 beams, m = 360000 voxels

I

optimization-based plan essentially the same as plan used

I

but we computed the plan in a few seconds on a GPU

I

original plan took hours of least-squares weight tweaking

Examples 28

(36)

Example

I

real patient case with n = 360 beams, m = 360000 voxels

I

optimization-based plan essentially the same as plan used

I

but we computed the plan in a few seconds on a GPU

I

original plan took hours of least-squares weight tweaking

Examples 28

(37)

Image in-painting

I

guess pixel values in obscured/corrupted parts of image

I

total variation in-painting: choose pixel values x

ij

∈ R

3

to minimize total variation

TV(x ) = X

i ,j

 x

i +1,j

− x

ij

x

i ,j +1

− x

ij



2 I

a convex problem

Examples 29

(38)

Example

512 × 512 grayscale image (n ≈ 300000 variables)

Examples 30

(39)

Example

Examples 31

(40)

Example

512 × 512 color image (n ≈ 800000), 80% of pixels removed

Examples 32

(41)

Example

80% of pixels removed

Examples 33

(42)

Control

minimize P

T −1

t=0

`(x

t

, u

t

) + `

T

(x

T

) subject to x

t+1

= Ax

t

+ Bu

t

(x

t

, u

t

) ∈ C, x

T

∈ C

T

I

variables are

I

system states x

1

, . . . , x

T

∈ R

n

I

inputs or actions u

0

, . . . , u

T −1

∈ R

m

I

` is stage cost, `

T

is terminal cost

I

C is state/action constraints; C

T

is terminal constraint

I

convex problem when costs, constraints are convex

I

applications in many fields

Examples 34

(43)

Example

I

n = 8 states, m = 2 inputs, horizon T = 50

I

randomly chosen A, B (with A ≈ I )

I

input constraint ku

t

k

≤ 1

I

terminal constraint x

T

= 0 (‘regulator’)

I

`(x , u) = kx k

22

+ kuk

22

(traditional)

I

random initial state x

0

Examples 35

(44)

Example

Examples 36

(45)

Support vector machine classifier with `

1

-regularization

I

given data (x

i

, y

i

), i = 1, . . . , m

I

x

i

∈ R

n

are feature vectors

I

y ∈ {±1} are associated boolean outcomes

I

linear classifier ˆ y = sign(β

T

x − v )

I

find parameters β, v by minimizing (convex function) (1/m) X

i



1 − y

i

T

x

i

− v ) 

+

+ λkβk

1

I

first term is average hinge loss

I

second term shrinks coefficients in β and encourages sparsity

I

λ ≥ 0 is (regularization) parameter

I

simultaneously selects features and fits classifier

Examples 37

(46)

Example

I

n = 20 features

I

trained and tested on m = 1000 examples each

Examples 38

(47)

Example

β

i

vs. λ (regularization path)

Examples 39

(48)

Outline

Mathematical Optimization Convex Optimization

Solvers & Modeling Languages Examples

Summary

Summary 40

(49)

Summary

I

convex optimization problems arise in many applications

I

convex optimization problems can be solved effectively

I

using generic methods for not huge problems

I

by developing custom methods for huge problems

I

high level language support

(CVX/CVXPY/Convex.jl/CVXR) makes prototyping easy

Summary 41

(50)

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, CVXR all available online

Summary 42

References

Related documents

The current study evaluated the effects of video modeling and video feedback on two Olympic weightlifting lifts (clean and jerk and snatch) to improve performance based on a task

• Extend the path-following code to solve quadratic programming problems using the algorithm shown in Figure 24.3.. • Further extend the code so that it can solve convex

Convex sets, (Univariate) Functions, Optimization problem Unconstrained Optimization: Analysis and Algorithms Constrained Optimization: Analysis and Algorithms

• Your Google Account username should be an email address from which you currently send and receive mail, unless you'd prefer to sign up for Gmail. • Creating a Google

To mitigate rising healthcare costs and FFS (Fee for Service) charges, large healthcare organizations are beginning to restructure their models for providing patient services..

For instance, it immediately implies that, in the full-information versions of the d-armed bandit and online geometric optimization problems (or, for instance, the convex

Catherine Meriano, JD, MHS, OTR/L, Quinnipiac University, Hamden, CT; Donna Latella, EdD, OTR/L, Quinnipiac University, Hamden, CT 560 pp, Soft Cover, 2008 ISBN

I First application of code generation to convex optimization CVXGEN. I Fastest solvers