Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Unconstrained Optim.
McMaster University
Department of Chemical Engineering
1111111111111111111111111
0000000000000000000000000
ChE 4G03: Optimization in Chemical Engineering
opportunity, 1-d linesearch constrained
objective, constraints Newton’s method optimization theory
unconstrained search direction &
optimization theory linesearch combination
Benoı̂t Chachuat (McMaster University) NLP: Multivariable, Constrained 4G03 1 / 29 Benoı̂t Chachuat (McMaster University) NLP: Multivariable, Constrained 4G03 2 / 29
minimize:
n
f (x)
This lesson Numerical Analytical x∈IR
Solution Methods Solution Methods
subject to: gj (x) ≤ 0, j = 1, . . . , mi
hj (x) = 0, j = 1, . . . , me
Constructing and Solving Penalty Models Pros and Cons of Penalty Models
Class Exercise: Consider the optimization problem Pros:
∆ Straightforward approach
min f (x) = x
x
∆
Possible use of fast and robust algorithms for unconstrained NLP
s.t. g (x) = 2 − x ≤ 0 (e.g., BFGS quasi-Newton search)
1 Solve this problem by inspection Cons:
2 Construct a penalty model using a square penalty function, then solve Large penalty multipliers lead to ill-conditioned penalty models
the unconstrained NLP as a function of the penalty multiplier µ ◮ Subject to slow convergence (small steps)
◮ Possible early termination (numerical errors)
5 5
4
In practice: Sequential Unconstrained Penalty Algorithm
µ
µ=
4
µ=5
f (x) + µp(x)
µ=
µ=5
=
µ
0.5
3
1.5
1.5
3
p(x)
0
1 solution obtained for the previous problem (xk )
-1 0 Produces a sequence of infeasible points, whose limit is an optimal
-1 -0.5 0 0.5 1 1.5 2 2.5 3 -1 -0.5 0 0.5 1 1.5 2 2.5 3
x x solution to the original NLP (exterior penalty function approach)
Benoı̂t Chachuat (McMaster University) NLP: Multivariable, Constrained 4G03 6 / 29 Benoı̂t Chachuat (McMaster University) NLP: Multivariable, Constrained 4G03 7 / 29
Sequential Unconstrained Penalty Algorithm Barrier Methods
Step 0: Initialization
◮ Form penalty model; choose initial guess x0 , penalty multiplier µ0 > 0, Idea: Transform a constrained NLP into an unconstrained NLP
escalation factor β > 1, and stopping tolerance ǫ > 0; set k ← 0
Step 1: Unconstrained Optimization Consider the NLP problem with inequality constraints only
k
◮ Direction: Starting from x , solve penalty optimization problem
minimize:
n
f (x)
me mi x∈IR
∆
X X
min F (x) = f (x) + µ pje (x) + pji (x) , subject to: gj (x) ≤ 0, j = 1, . . . , mi
x
j=1 j=1
Barrier Functions for Inequality Constrained NLPs Constructing and Solving Barrier Models
Ideal Barrier Function: gj (x) ≤ 0 Class Exercise: Consider the same optimization problem as previously
∆
bj (x) = 0, if gj (x) < 0 min f (x) = x
x
bj (x) = +∞, otherwise ∆
s.t. g (x) = 2 − x ≤ 0
Common Barrier Functions: 1 Construct a barrier model using the inverse barrier function, then
∆ 1 ∆ solve the unconstrained NLP as a function of the barrier multiplier µ
bj (x) = − , bj (x) = − ln (−gj (x))
gj (x) 5 6
5.5
4
f (x) + µb(x)
5
Properties of Barrier Functions µ = 1.5
3 4.5
b(x)
The optimum of a barrier model can never equal the optimum of the µ = 1.5 4
µ = 0.5
original NLP model if µ > 0 and that optimum lies on the boundary 2 3.5
µ = 0.5 µ = 0.1
of the feasible domain 1
3
µ = 0.1 2.5
However, as µ ց 0, the unconstrained optimum comes closer and 0 2
2 2.5 3 3.5 4 2 2.5 3 3.5 4
closer to the constrained solution (as with penalty methods) x x
Benoı̂t Chachuat (McMaster University) NLP: Multivariable, Constrained 4G03 10 / 29 Benoı̂t Chachuat (McMaster University) NLP: Multivariable, Constrained 4G03 11 / 29
Pros and Cons of Barrier Models Sequential Unconstrained Barrier Algorithm
Pros: Step 0: Initialization
Straightforward approach ◮ Form barrier model; choose initial guess x0 , barrier multiplier µ0 > 0,
reduction factor 0 < β < 1, and stopping tolerance ǫ > 0; set k ← 0
Possible use of fast and robust algorithms for unconstrained NLP
(e.g., BFGS quasi-Newton search) Step 1: Unconstrained Optimization
Cons: ◮ Direction: Starting from xk , solve barrier optimization problem
Small barrier multipliers lead to ill-conditioned barrier models me
Subject to slow convergence (small steps) ∆
◮
X
min F (x) = f (x) + µ bj (x),
◮ Possible early termination (numerical errors) x
j=1
Benoı̂t Chachuat (McMaster University) NLP: Multivariable, Constrained 4G03 14 / 29 Benoı̂t Chachuat (McMaster University) NLP: Multivariable, Constrained 4G03 15 / 29
Constructing and Solving Direction-Finding LP LP-based Search Direction: Penalty Approach
Class Exercise: Consider the optimization problem
∆
min f (x) = 2x12 + 2x22 − 2x1 x2 − 4x1 − 6x2 Feasibility of the LP-based search direction problem can be enforced
x
via softening the constraints by penalization in the LP objective:
∆
s.t. g1 (x) = 3x12 − 2x2 ≤ 0
∆
g2 (x) = x1 + 2x2 − 7 ≤ 0 mi me
minimize: f (x̄) + ∇f (x̄)T ∆x + µ
X X
T yj + (zj+ + zj− )
Formulate, then solve, the direction-finding LP at x0 = ( 21 , 1) , for δ = 1
2
∆x,y,z±
j=1 j=1
3.5 3.5 T
subject to: gj (x̄) + ∇gj (x̄) ∆x ≤ yj , yj ≥ 0, j = 1, . . . , mi
3 3
hj (x̄) + ∇hj (x̄)T ∆x = zj+ − zj− , zj+ , zj− ≥ 0, j = 1, . . . , me
2.5 2.5
− δi ≤ ∆xi ≤ δi , i = 1, . . . , n
2 2
x2
x2
1.5 1.5
∆x with µ > 0 a suitable (large enough) penalty multiplier
1 1
x0 x0
0.5 0.5
0 0
0 0.5 1 1.5 2 2.5 3 3.5 0 0.5 1 1.5 2 2.5 3 3.5
x1 x1
Benoı̂t Chachuat (McMaster University) NLP: Multivariable, Constrained 4G03 16 / 29 Benoı̂t Chachuat (McMaster University) NLP: Multivariable, Constrained 4G03 17 / 29
Benoı̂t Chachuat (McMaster University) NLP: Multivariable, Constrained 4G03 20 / 29 Benoı̂t Chachuat (McMaster University) NLP: Multivariable, Constrained 4G03 21 / 29
Idea: Solve the nonlinear system of (n+m) equations using Quadratic Programs
a Newton-like iterative method A constrained nonlinear program is a quadratic program, or QP, if its
objective function is quadratic and all its constraints are linear:
Newton’s method to find y ∈ IRn such that F(y) = 0: 1
minimize: cT x + xT Qx
x∈IR n
2
yk+1 = yk − ∇F(yk )−1 F(yk ); y0 given
subject to: Ai x ≤ bi
∆ ∆ Ae x = be
With F = ∇L and y = (x, λ),
with Q ∈ IRn×n , c ∈ IRn , Ai ∈ IRmi ×n , bi ∈ IRmi , Ae ∈ IRme ×n , be ∈ IRme
!
T
∆xk+1 ∇f (xk )
∇2xx L(xk , λk ) −∇h(xk )
=−
∇h(xk ) 0 λk+1 h(xk )
QPs are [strictly] convex programs provided that the matrix Q in the
∆ objective function is positive semi-definite [positive definite]
where ∆xk+1 = xk+1 − xk
Like LPs, powerful and reliable techniques/codes are available to solve
But, no distinction between local minima and local maxima! convex QPs, including very large-scale QPs
Benoı̂t Chachuat (McMaster University) NLP: Multivariable, Constrained 4G03 22 / 29 Benoı̂t Chachuat (McMaster University) NLP: Multivariable, Constrained 4G03 23 / 29
Search Direction: QP-based Approach Search Direction: Problems with Inequality Constraints
Consider the general NLP:
Solutions (∆xk+1 , λk+1 ) to the direction-finding system
! minimize:
n
f (x)
T x∈IR
∆xk+1 ∇f (xk )
2 k k k
∇xx L(x , λ ) −∇h(x )
=− subject to: gj (x) ≤ 0, j = 1, . . . , mi
∇h(xk ) 0 λk+1 h(xk )
hj (x) = 0, j = 1, . . . , me
exactly match stationary points to the Lagrangian of QP
The search direction ∆xk+1 at xk can be obtained from:
T 1
minimize: ∇f (xk ) ∆x + ∆xT ∇2xx L(xk , λk )∆x T 1
∆x 2 minimize: ∇f (xk ) ∆x + ∆xT ∇2xx L(xk , ν k , λk )∆x
T ∆x 2
subject to: hj (xk ) + ∇hj (xk ) ∆x = 0, j = 1, . . . , me T
subject to: gj (xk ) + ∇gj (xk ) ∆x ≤ 0, j = 1, . . . , mi
with λk+1 corresponding to the QP Lagrange multipliers k T
hj (xk ) + ∇hj (x ) ∆x = 0, j = 1, . . . , me
Constructing and Solving Direction-Finding Problem Constructing and Solving Direction-Finding Problem
Class Exercise: Consider the optimization problem Class Exercise: Consider the optimization problem
∆ ∆
min f (x) = 2x12 + 2x22 − 2x1 x2 − 4x1 − 6x2 min f (x) = 2x12 + 2x22 − 2x1 x2 − 4x1 − 6x2
x x
∆ ∆
s.t. g1 (x) = 3x12 − 2x2 ≤ 0 s.t. g1 (x) = 3x12 − 2x2 ≤ 0
∆ ∆
g2 (x) = x1 + 2x2 − 7 ≤ 0 g2 (x) = x1 + 2x2 − 7 ≤ 0
T T
Formulate, then solve, the direction-finding QP problem at x0 = ( 21 , 1) Formulate, then solve, the direction-finding QP problem at x0 = ( 21 , 1)
3.5 3.5
T
4x10 − 2x20 − 4 4 − 6ν10 −2
1 T 3 3
min ∆x + ∆x ∆x
∆x −2x10 + 4x20 − 6 2 −2 4 2.5 2.5
T
6x10
2 2
0 2 0
s.t. 3(x1 ) − 2x2 + ∆x ≤ 0
x2
x2
−2 1.5 1.5 ∆x
T ∆x
0 0 1 1 1
x1 + 2x2 − 7 + ∆x ≤ 0 x0 x0
2 0.5 ν10 = 0, ν20 = 0 0.5 ν10 = −1, ν20 = 0
0 0
The QP depends on the KKT multiplier ν1 associated to g1 0 0.5 1 1.5
x1
2 2.5 3 3.5 0 0.5 1 1.5
x1
2 2.5 3 3.5
Benoı̂t Chachuat (McMaster University) NLP: Multivariable, Constrained 4G03 26 / 29 Benoı̂t Chachuat (McMaster University) NLP: Multivariable, Constrained 4G03 26 / 29
Sequential Quadratic Programming Method SQP Algorithm — Minimize Problem
Step 0: Initialization
Follows the improving-search paradigm
◮ Choose initial guess x0 , initial multipliers λ0 and ν 0 ≥ 0, positive
Update search direction ∆xk+1 repeatedly via the solution of a QP definite matrix D0 , penalty multiplier µ > 0, and stopping tolerance
subproblem ǫ > 0; set k ← 0
Linesearch can be performed along a given direction by using a
Step 1: QP-based Search Direction
suitable merit function that measures progress — Typical choice:
◮ Compute gradients ∇f (xk ), ∇gi (xk ) and ∇hi (xk )
mi me
◮ Solve direction-finding QP,
∆
X X
F (x, µ) = f (x) + µ max{0, gi (x)} + |hi (x)| T 1
min ∇f (xk ) ∆x + ∆xT Dk ∆x
j=1 j=1 ∆x 2
T
s.t. gj (xk ) + ∇gj (xk ) ∆x ≤ 0, j = 1, . . . , mi
with a suitable penalty multiplier µ > 0
k T
Possibility to construct an approximation Dk of the second-order hj (xk ) + ∇hj (x ) ∆x = 0, j = 1, . . . , me
derivatives ∇2xx L(xk , ν k , λk ) — E.g., based on a BFGS recursive
scheme to produce ∆xk+1 , λk+1 and ν k+1
◮ Positive definiteness of Dk provides robustness Step 2: Stopping
◮ Reduces computational effort ◮ If ∆xk+1 < ǫ, stop — report xk (approximate KKT point)
Benoı̂t Chachuat (McMaster University) NLP: Multivariable, Constrained 4G03 27 / 29 Benoı̂t Chachuat (McMaster University) NLP: Multivariable, Constrained 4G03 28 / 29
Step 4: Update
◮ Iterate: xk+1 ← xk + αk+1 ∆xk+1
ggT k T k
◮ BFGS: D k+1
← D + gT d − DdTddDk Dd ,
k
SQP usually much faster and more reliable than first-order methods
◮ Analytical derivatives highly recommended for reliability
◮ Method of choice for optimization of complex, first-principle models
Available in general purpose modeling systems (GAMS, AMPL)
◮ Use within a modeling manager recommended
◮ Often need to adjust parameters for good performance (more tuning!)
Used routinely in engineering optimization products
Benoı̂t Chachuat (McMaster University) NLP: Multivariable, Constrained 4G03 29 / 29