L14 OptimizationSingleVariable
L14 OptimizationSingleVariable
and Practise
L14 - Optimization
2 3
• Unconstrained (e.g. min J(w), e.g J(w) = w , J(w) = w ,
2
J(w) = w + 54/w)
• constrained optimization (e.g. min J(w), w > 0)
2 3
• Single variable (e.g. min J(w), e.g J(w) = w , J(w) = w ,
2
J(w) = w + 54/w)
2 2
• multivariable (e.g. min J(w0, w1) = (w0 − 2) + (w1 − 2) )
2 3 4
• Single variable (e.g J(w) = w , J(w) = w , J(w) = w )
• min J(w)
• The value of w for which the function J(w) has the least (minimum) value
• Unimodal function
• Local minimum (in this case, this is also global minimum)
2
• J(w) = w
′ J(w)
• J (w) = dJ(w)/dw
dw ( dw )
2
′′ d J(w) d dJ
• J (w) = =
dw 2
′
• J (w) = dJ(w)/dw
• slope / tangent at a J(w)
point on the curve.
• Continuous curve
′
• J (w) = dJ(w)/dw
• slope / tangent at a J(w)
point on the curve.
• At minimum function
′
value, J (w) = 0
• The corresponding
w=w w
dw ( dw )
2
′′ d J(w) d dJ
• J (w) = =
dw 2
J(w)
• rate of change of
slope / tangent at a
point on the curve.
dw ( dw )
2
′′ d J(w) d dJ
• J (w) = =
dw 2
J(w)
• > 0 in the nbghd of
minimum point.
• Minimum
• Maximum
• Inflection
2
• J(w) = − w
′ J(w)
• J (w) = 0, at w = w,
′′
• At w, J (w) < 0
3
• J(w) = w
′ J(w)
• J (w) = 0, at w = w,
′′
• At w, J (w) is ?
′′′
• At w, J (w) is ?
4
• J(w) = w
′ J(w)
• J (w) = 0, at w = w,
′′
• At w, J (w) is ?
4
• J(w) = w
′ J(w)
• J (w) = 0, at w = w,
′′
• At w, J (w) is ?
′′′
• At w, J (w) is ?
′′′′
• At w, J (w) is ?
w
• Suppose at point w the first derivative is zero and the first nonzero higher
order derivative is denoted by n; then
• Given a point on the curve, whether it belongs to any of the optimal ones
• The more pressing one - Given a function J(w), how to find the optimal points
(in our case, mostly ‘min’)
• Given a point on the curve, whether it belongs to any of the optimal ones
• The more pressing one - Given a function J(w), how to find the optimal points
(in our case, mostly ‘min’)
• Bracketing methods
• Exhaustive search
• Bounding phase
• Region elimination approaches
• Interval halving
• Fibonacci search
• Golden section search
• Gradient-based ones
• Newton-Raphson
• Bisection
• Secant
• Step 1: J(w)
• Δw = (b − a)/n
• w1 = a, w2 = w1 + Δw, w3 = w2 + Δw
a w2 w3 b
w1
• Step 2:
• If J(w1) ≥ J(w2) ≤ J(w3)
J(w)
• then min lies between
(w1, w3)
• Else
a w1 w2 w3 b
• w1 = w2, w2 = w3, w3 = w2 + Δw
• Go to Step 3
• w1 = w2, w2 = w3, w3 = w2 + Δw
• Step 3:
J(w)
• Is w3 ≤ b, the go to
Step 2
• Otherwise, no min
exists between (a, b). a w1 w2 w3 b
a w1 w2 b
w3
• Step 1
• Choose
a, b, ϵ, wm = (a + b)/2, L = (b − a) J(w)
• Compute J(wm)
a w1 wm w2 b
• Step 2
• Set
w1 = a + L/4, w2 = b − L/4 J(w)
• Step 3
• If J(w1) < J(wm) J(w)
• set
b = wm, wm = w1, go
to Step 5 a w1 wm w2 b
• Else
• go to Step 4
• Step 4
• If J(w2) < J(wm) J(w)
• set
a = wm, wm = w2; go
to Step 5 a w1 wm w2 b
• Else a wm b
• a = w1, b = w2; go
to Step 5
• Step 5
• Calculate L = b − a
J(w)
• If | L | < ϵ
• Terminate a w1 wm w2 b
• Else
• go to Step 2
′
• uses J (w) = dJ(w)/dw
and other higher order
derivatives. J(w)
• Exact / Numerical
approach for derivative
(k)
• uses w to compute (1)
(k+1) w
w
J(w) w (1)
• k = 1 to N (num of iterations)
w
(1)
• Initial guess w is needed.
(1) ′ (1)
• Step 1: Choose w , ϵ, set k = 1. Compute J (w )
′′ (k)
• Step 2: Compute J (w )
′
(k+1) (k) J (w) ′ (k+1)
Step 3: Calculate w = w − . Compute J (w )
• J′′(w)
′ (k+1)
• Step 4: If | J (w ) < ϵ | , Terminate. Else set k = k + 1 go to Step 2