ce 191: civil and environmental engineering systems analysis - barrier penalty fcn.pdfbarrier...

31
CE 191: Civil and Environmental Engineering Systems Analysis LEC 12 : Barrier & Penalty Functions Professor Scott Moura Civil & Environmental Engineering University of California, Berkeley Fall 2014 Prof. Moura | UC Berkeley CE 191 | LEC 12 - Barrier & Penalty Fcns Slide 1

Upload: others

Post on 16-Jul-2020

6 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: CE 191: Civil and Environmental Engineering Systems Analysis - Barrier Penalty Fcn.pdfBarrier Function: Allow the objective function to increase towards infinity as x approaches the

CE 191: Civil and Environmental EngineeringSystems Analysis

LEC 12 : Barrier & Penalty Functions

Professor Scott MouraCivil & Environmental EngineeringUniversity of California, Berkeley

Fall 2014

Prof. Moura | UC Berkeley CE 191 | LEC 12 - Barrier & Penalty Fcns Slide 1

Page 2: CE 191: Civil and Environmental Engineering Systems Analysis - Barrier Penalty Fcn.pdfBarrier Function: Allow the objective function to increase towards infinity as x approaches the

Gradient Descent

Does not explicitly account for constraints.

Barrier and penalty functions approximate constraints by augmentingobjective function f(x)

Consider constrained minimization problem

minx

f(x),

s. to g(x) ≤ 0

converted tominx

f(x) + φ(x; ε)

where φ(x; ε) captures the effect of constraints & is differentiable, thusenabling gradient descent

Prof. Moura | UC Berkeley CE 191 | LEC 12 - Barrier & Penalty Fcns Slide 2

Page 3: CE 191: Civil and Environmental Engineering Systems Analysis - Barrier Penalty Fcn.pdfBarrier Function: Allow the objective function to increase towards infinity as x approaches the

Two Methods for φ(x; ε): Barrier & Penalty Functions

Barrier Function: Allow the objective function to increase towardsinfinity as x approaches the constraint boundary from inside thefeasible set. In this case, the constraints are guaranteed to be satisfied,but it is impossible to obtain a boundary optimum.

Penalty Function: Allow the objective function to increase towardsinfinity as x violates the constraints g(x). In this case, the constraintscan be violated, but it allows boundary optimum.

Prof. Moura | UC Berkeley CE 191 | LEC 12 - Barrier & Penalty Fcns Slide 3

Page 4: CE 191: Civil and Environmental Engineering Systems Analysis - Barrier Penalty Fcn.pdfBarrier Function: Allow the objective function to increase towards infinity as x approaches the

Constrained vs. Unconstrained Optimization

Example: find the optimum of the following function within the range[0,+∞)

Prof. Moura | UC Berkeley CE 191 | LEC 12 - Barrier & Penalty Fcns Slide 4

Page 5: CE 191: Civil and Environmental Engineering Systems Analysis - Barrier Penalty Fcn.pdfBarrier Function: Allow the objective function to increase towards infinity as x approaches the

Constrained vs. Unconstrained Optimization

Example: find the optimum of the following function within the range[0.5,1.5]

Prof. Moura | UC Berkeley CE 191 | LEC 12 - Barrier & Penalty Fcns Slide 5

Page 6: CE 191: Civil and Environmental Engineering Systems Analysis - Barrier Penalty Fcn.pdfBarrier Function: Allow the objective function to increase towards infinity as x approaches the

Main idea of barrier methods

Add a barrier function which is infinite outside of the constraint domain, i.e.[a,b]

Prof. Moura | UC Berkeley CE 191 | LEC 12 - Barrier & Penalty Fcns Slide 6

Page 7: CE 191: Civil and Environmental Engineering Systems Analysis - Barrier Penalty Fcn.pdfBarrier Function: Allow the objective function to increase towards infinity as x approaches the

Main idea of barrier methods

In practice, such continuous and smooth functions do not exist, so they haveto be approximated

Prof. Moura | UC Berkeley CE 191 | LEC 12 - Barrier & Penalty Fcns Slide 7

Page 8: CE 191: Civil and Environmental Engineering Systems Analysis - Barrier Penalty Fcn.pdfBarrier Function: Allow the objective function to increase towards infinity as x approaches the

Logarithmic Barrier Function

b(x) = −ε log((x− a)(b− x)), ε = 1

Prof. Moura | UC Berkeley CE 191 | LEC 12 - Barrier & Penalty Fcns Slide 8

Page 9: CE 191: Civil and Environmental Engineering Systems Analysis - Barrier Penalty Fcn.pdfBarrier Function: Allow the objective function to increase towards infinity as x approaches the

Logarithmic Barrier Function

b(x) = −ε log((x− a)(b− x)), ε = 1/2

Prof. Moura | UC Berkeley CE 191 | LEC 12 - Barrier & Penalty Fcns Slide 9

Page 10: CE 191: Civil and Environmental Engineering Systems Analysis - Barrier Penalty Fcn.pdfBarrier Function: Allow the objective function to increase towards infinity as x approaches the

Logarithmic Barrier Function

b(x) = −ε log((x− a)(b− x)), ε = 1/4

Prof. Moura | UC Berkeley CE 191 | LEC 12 - Barrier & Penalty Fcns Slide 10

Page 11: CE 191: Civil and Environmental Engineering Systems Analysis - Barrier Penalty Fcn.pdfBarrier Function: Allow the objective function to increase towards infinity as x approaches the

Logarithmic Barrier Function

b(x) = −ε log((x− a)(b− x)), ε = 1/8

Prof. Moura | UC Berkeley CE 191 | LEC 12 - Barrier & Penalty Fcns Slide 11

Page 12: CE 191: Civil and Environmental Engineering Systems Analysis - Barrier Penalty Fcn.pdfBarrier Function: Allow the objective function to increase towards infinity as x approaches the

Logarithmic Barrier Function

b(x) = −ε log((x− a)(b− x)), ε = 1/16

Prof. Moura | UC Berkeley CE 191 | LEC 12 - Barrier & Penalty Fcns Slide 12

Page 13: CE 191: Civil and Environmental Engineering Systems Analysis - Barrier Penalty Fcn.pdfBarrier Function: Allow the objective function to increase towards infinity as x approaches the

Logarithmic Barrier Function

b(x) = −ε log((x− a)(b− x)), ε = 1/32

Prof. Moura | UC Berkeley CE 191 | LEC 12 - Barrier & Penalty Fcns Slide 13

Page 14: CE 191: Civil and Environmental Engineering Systems Analysis - Barrier Penalty Fcn.pdfBarrier Function: Allow the objective function to increase towards infinity as x approaches the

Utilization of Barrier Function

Add the barrier function b(x) to the objective function f(x)1 inside the constraint set, barrier ≈ 02 outside the constraint set, barrier is infinite

If the barrier is almost zero inside the constraint set, the minimum of thefunction and the augmented function are almost the same.

Prof. Moura | UC Berkeley CE 191 | LEC 12 - Barrier & Penalty Fcns Slide 14

Page 15: CE 191: Civil and Environmental Engineering Systems Analysis - Barrier Penalty Fcn.pdfBarrier Function: Allow the objective function to increase towards infinity as x approaches the

Illustration of the convergence of the log barrier

Logarithmic barrier: ε = 1

Prof. Moura | UC Berkeley CE 191 | LEC 12 - Barrier & Penalty Fcns Slide 15

Page 16: CE 191: Civil and Environmental Engineering Systems Analysis - Barrier Penalty Fcn.pdfBarrier Function: Allow the objective function to increase towards infinity as x approaches the

Illustration of the convergence of the log barrier

Logarithmic barrier: ε = 1/2

Prof. Moura | UC Berkeley CE 191 | LEC 12 - Barrier & Penalty Fcns Slide 16

Page 17: CE 191: Civil and Environmental Engineering Systems Analysis - Barrier Penalty Fcn.pdfBarrier Function: Allow the objective function to increase towards infinity as x approaches the

Illustration of the convergence of the log barrier

Logarithmic barrier: ε = 1/4

Prof. Moura | UC Berkeley CE 191 | LEC 12 - Barrier & Penalty Fcns Slide 17

Page 18: CE 191: Civil and Environmental Engineering Systems Analysis - Barrier Penalty Fcn.pdfBarrier Function: Allow the objective function to increase towards infinity as x approaches the

Illustration of the convergence of the log barrier

Logarithmic barrier: ε = 1/8

Prof. Moura | UC Berkeley CE 191 | LEC 12 - Barrier & Penalty Fcns Slide 18

Page 19: CE 191: Civil and Environmental Engineering Systems Analysis - Barrier Penalty Fcn.pdfBarrier Function: Allow the objective function to increase towards infinity as x approaches the

Illustration of the convergence of the log barrier

Logarithmic barrier: ε = 1/16

Prof. Moura | UC Berkeley CE 191 | LEC 12 - Barrier & Penalty Fcns Slide 19

Page 20: CE 191: Civil and Environmental Engineering Systems Analysis - Barrier Penalty Fcn.pdfBarrier Function: Allow the objective function to increase towards infinity as x approaches the

Illustration of the convergence of the log barrier

Logarithmic barrier: ε = 1/32

Prof. Moura | UC Berkeley CE 191 | LEC 12 - Barrier & Penalty Fcns Slide 20

Page 21: CE 191: Civil and Environmental Engineering Systems Analysis - Barrier Penalty Fcn.pdfBarrier Function: Allow the objective function to increase towards infinity as x approaches the

Illustration of the convergence of the log barrier

Make a guess inside the constraint set.

Start with epsilon not too small.

repeat

minimize the augmented function (using e.g. gradient descent)

use the result as the guess for the next step

decrease the log barrier

Until barrier is almost zero inside the constraint set

One can prove that the result of this method converges to a minimum of theoriginal problem

Prof. Moura | UC Berkeley CE 191 | LEC 12 - Barrier & Penalty Fcns Slide 21

Page 22: CE 191: Civil and Environmental Engineering Systems Analysis - Barrier Penalty Fcn.pdfBarrier Function: Allow the objective function to increase towards infinity as x approaches the

Illustration of the convergence of the log barrier

Logarithmic barrier: ε = 1

Prof. Moura | UC Berkeley CE 191 | LEC 12 - Barrier & Penalty Fcns Slide 22

Page 23: CE 191: Civil and Environmental Engineering Systems Analysis - Barrier Penalty Fcn.pdfBarrier Function: Allow the objective function to increase towards infinity as x approaches the

Illustration of the convergence of the log barrier

Logarithmic barrier: ε = 1/2

Prof. Moura | UC Berkeley CE 191 | LEC 12 - Barrier & Penalty Fcns Slide 23

Page 24: CE 191: Civil and Environmental Engineering Systems Analysis - Barrier Penalty Fcn.pdfBarrier Function: Allow the objective function to increase towards infinity as x approaches the

Illustration of the convergence of the log barrier

Logarithmic barrier: ε = 1/4

Prof. Moura | UC Berkeley CE 191 | LEC 12 - Barrier & Penalty Fcns Slide 24

Page 25: CE 191: Civil and Environmental Engineering Systems Analysis - Barrier Penalty Fcn.pdfBarrier Function: Allow the objective function to increase towards infinity as x approaches the

Illustration of the convergence of the log barrier

Logarithmic barrier: ε = 1/8

Prof. Moura | UC Berkeley CE 191 | LEC 12 - Barrier & Penalty Fcns Slide 25

Page 26: CE 191: Civil and Environmental Engineering Systems Analysis - Barrier Penalty Fcn.pdfBarrier Function: Allow the objective function to increase towards infinity as x approaches the

Illustration of the convergence of the log barrier

Logarithmic barrier: ε = 1/16

Prof. Moura | UC Berkeley CE 191 | LEC 12 - Barrier & Penalty Fcns Slide 26

Page 27: CE 191: Civil and Environmental Engineering Systems Analysis - Barrier Penalty Fcn.pdfBarrier Function: Allow the objective function to increase towards infinity as x approaches the

Illustration of the convergence of the log barrier

Logarithmic barrier: ε = 1/32

Prof. Moura | UC Berkeley CE 191 | LEC 12 - Barrier & Penalty Fcns Slide 27

Page 28: CE 191: Civil and Environmental Engineering Systems Analysis - Barrier Penalty Fcn.pdfBarrier Function: Allow the objective function to increase towards infinity as x approaches the

Formal description of the algorithm

Start with epsilon not too small

repeat: solve

minx

f(x)− εb(x)

s. to no constriants

use the result as the guess for the next step

decrease the log barrier ε = ε = 2, or similar

Until barrier is almost zero inside the constraint set

Prof. Moura | UC Berkeley CE 191 | LEC 12 - Barrier & Penalty Fcns Slide 28

Page 29: CE 191: Civil and Environmental Engineering Systems Analysis - Barrier Penalty Fcn.pdfBarrier Function: Allow the objective function to increase towards infinity as x approaches the

Generalization to multiple dimensions

Transformation of a constrained problem into an unconstrained problem

minx

f(x),

s. to g(x) ≤ 0

Introduce log barrier function

b(x) = log(−g(x)) (1)

Problem to solve becomes (in the limit ε goes to zero):

minx

f(x)− εb(x)

s. to no constraints

Prof. Moura | UC Berkeley CE 191 | LEC 12 - Barrier & Penalty Fcns Slide 29

Page 30: CE 191: Civil and Environmental Engineering Systems Analysis - Barrier Penalty Fcn.pdfBarrier Function: Allow the objective function to increase towards infinity as x approaches the

Penalty Function Method

Transformation of a constrained problem into an unconstrained problem

minx

f(x),

s. to g(x) ≤ 0

Introduce quadratic penalty function

φ(x; ε) =

{0 if g(x) ≤ 012ε (x− g(x))2 otherwise

(2)

Problem to solve becomes (in the limit ε goes to zero):

minx

f(x) + φ(x; ε)

s. to no constraints

Prof. Moura | UC Berkeley CE 191 | LEC 12 - Barrier & Penalty Fcns Slide 30

Page 31: CE 191: Civil and Environmental Engineering Systems Analysis - Barrier Penalty Fcn.pdfBarrier Function: Allow the objective function to increase towards infinity as x approaches the

Additional Reading

Prof. Moura | UC Berkeley CE 191 | LEC 12 - Barrier & Penalty Fcns Slide 31