Semi-automatic transition from simulation to one-shot

Semi-automatic transition from simulation to one-shot
optimization with equality constraints
Lisa Kusch, Tim Albring, Andrea Walther, Nicolas Gauger
Chair for Scientific Computing, TU Kaiserslautern, www.scicomp.uni-kl.de
Institute of Mathematics, Universität Paderborn
September 15, 2016
AD 2016
Outline
1 The One-Shot Approach with Additional Constraints
2 AD-Based Discrete Adjoint in SU2
3 Multi-Objective Optimization
4 Application and Results
Application to Airfoil Design
Multi-Objective Optimization with Single Constraint
Multi-Objective Optimization with Multiple Constraints
Second-Order Adjoints
5 Summary and Outlook
Kusch,Albring,Walther,Gauger
From simulation to one-shot optimization with constraints
2/ 18
Problem Definition
PDE-constrained optimization problem
min f (y , u)
u,y
s.t. c(y , u) = 0,
→
fixed point iteration
||Gy || ≤ ρ < 1
min f (y , u)
u,y
s.t. G (y , u) = y ,
h(y , u) = 0
h(y , u) = 0
objective function f ∈ R, state y ∈ Y ⊂ Rn , design u ∈ U ⊂ Rm
state equation c : Y × U → Y , constraints h : Y × U → V ⊂ Rp
(notation: Ĝ = (G (y , u) − y , h(y , u))T )
⇒ one-shot approach using the AD-based discrete adjoint
[Hamdi, Griewank(2010)],[Walther, Gauger, Kusch, Richert(2016)]
L(ȳ , y , u) = f (y , u) + (G (y , u) − y )T ȳ + hT µ = N(y , ȳ , µ, u) − y T ȳ
Kusch,Albring,Walther,Gauger
From simulation to one-shot optimization with constraints
3/ 18
The One-Shot Approach with Additional Constraints
KKT point (discrete)
y∗
= Nȳ (y ∗ , ȳ ∗ , µ, u ∗ )T
= G (y ∗ , u)
ȳ ∗
= Ny (y ∗ , ȳ ∗ , µ, u ∗ )T
= fy (y ∗ , u ∗ )T + Gy (y ∗ , u ∗ )T ȳ ∗
0
= Nu (y ∗ , ȳ ∗ , µ, u ∗ )T
= fu (y ∗ , u ∗ )T + Gu (y ∗ , u ∗ )T ȳ ∗
0
= Nµ (y ∗ , ȳ ∗ , µ, u ∗ )T
= h(y ∗ , u ∗ )
One-shot approach with equality constraints
for k = 1, ...
yk+1 = G (yk , uk )
ȳk+1 = Ny (yk , ȳk , µk , uk )
uk+1 = uk − Bk−1 Nu (yk , ȳk , µk , uk )
µk+1 = µk − B̌k−1 h(yk , uk )
Kusch,Albring,Walther,Gauger
From simulation to one-shot optimization with constraints
4/ 18
Convergence Properties
doubly augmented Lagrangian
La (y , ȳ , µ, u) =
α
β
||Ĝ (y , u)||2 + ||Ny (y , ȳ , µ, u)T − ȳ ||2 + N − ȳ T y
2
2
correspondence and descent condition
p
β
αβ(1 − ρ) > 1 + ||Nyy ||
2
(1)
2
and α ≥ k2(Ĝu> )1...p (Ĝy> )+ (Nyu )1...p − (Nuu )1...p
1...p k/k(Ĝu )1...p k
⇒ exact penalty function, descent for all large symmetric pos. def. B, B̌
choice of B
T
B ≈ ∇2uu La (y , ȳ , u) ⇒ B = αĜuT Ĝu + βNyu
Nyu + Nuu
Kusch,Albring,Walther,Gauger
From simulation to one-shot optimization with constraints
5/ 18
Implementation Details
BFGS Update: B∆u ≈ ∇u La (y , ȳ , µ, u + ∆u) − ∇u La (y , ȳ , µ, u) =: r
calculate ∇u La = α∆ykT Gu + αhuT h + β∆ȳkT Nyu + Nu
Nu and ∆ykT Gu + huT h can be obtained with reverse mode of AD from ū
y = G (y , u)
v = f (y , u)
ū = fu (y , u)T v̄ + Gu (y , u)T ȳ + hu (y , u)T w̄
w = h(y , u)
finite difference over reverse / tangent over reverse
∆ȳkT Nyu ≈
1
(Nu (yk + h∆ȳk , ȳk , µk , uk ) − Nu (yk , ȳk , µk , uk ))
h
(2)
curvature condition: set Bk = I if rkT ∆uk ≤ 0
Kusch,Albring,Walther,Gauger
From simulation to one-shot optimization with constraints
6/ 18
Open-source multiphysics suite SU2
Under active development (Stanford University, TU Kaiserslautern, TU
Delft,...)
FV discretization of (U)RANS equations and turbulence models using
highly modular C++ code-structure, additional PDE solvers
Multi-grid and local time-stepping methods
Several space and time discretizations, MPI, python scripts
optimization environment based on continuous or discrete adjoint,
integrated AD support [Albring, Sagebaum, Gauger(2015)]
Kusch,Albring,Walther,Gauger
From simulation to one-shot optimization with constraints
7/ 18
Discrete-Adjoint Solver in SU2
operator overloading (frequent extensions/improvements)
shape optimization → mesh deformation as additional constraint in the
optimization problem M(u) = x
fixed-point form ȳk+1 = Ny (yk , ȳk , µk , uk )T
CoDiPack
open-source (https://github.com/SciCompKL/CoDiPack)
use of expression templates
different tape implementations
Performance SU2 (NASA Common Research Model)
Runtime Factor: 1.2
Memory Factor: 7.2
Kusch,Albring,Walther,Gauger
From simulation to one-shot optimization with constraints
8/ 18
Multi-Objective Optimization Problem
min
F(y , u)
s.t.
c(y , u) = 0,
y ,u
h(y , u) ≥ 0
(3)
(4)
Pareto dominance:
x dominates x if
∀i ∈ {1, ..., k} :
∃j ∈ {1, ..., k} :
fi (x) ≤ fi (x)
fj (x) < fj (x)
Kusch,Albring,Walther,Gauger
From simulation to one-shot optimization with constraints
9/ 18
Methods for Multi-Objective Optimization
common: weighted sum,
evolutionary algorithms
ε-constraint method
[Marglin(1967)]
min
fsj (y , u)
s.t.
c(y , u) = 0,
y ,u
(5)
h(y , u) = 0,
fi (x) ≤ fi
(j)
∀ i ∈ {1, ..., k} i 6= sj
connected: equality constraints
Kusch,Albring,Walther,Gauger
From simulation to one-shot optimization with constraints
10/ 18
Application (Airfoil Design)
aerodynamic shape optimization
of NACA 0012 airfoil
objectives: drag coefficient cd , lift
coefficient cl
bounded design variables:
38 Hicks-Henne bump functions
(bounds: [-0.005,0.005])
constraints: moment, thickness
steady Euler equations, transonic
flow (Mach 0.8 and AOA 1.25)
Kusch,Albring,Walther,Gauger
From simulation to one-shot optimization with constraints
11/ 18
Result: Lift Constraint
preconditioner B̌ = 20, µ0 = 0, target lift: 0.4
backtracking line search, trial step size: 1, α = 20, β = 2
10cd
cl
10||Nu ||
0.4
−2
primal residual
adjoint residual
−4
−6
0
−8
0
400
800
1,200
1,600
2,000 0
500
Iteration
Kusch,Albring,Walther,Gauger
From simulation to one-shot optimization with constraints
1,000 1,500 2,000
Iteration
12/ 18
Resulting Pareto-optimal Front
drag coefficient
3
·10−3
2
1
0
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
lift coefficient
Kusch,Albring,Walther,Gauger
From simulation to one-shot optimization with constraints
13/ 18
Result: Lift, Moment, Thickness Constraint
target lift: 0.3, moment: 0.0, thickness: 0.12
preconditioner diag(20, 20, 100), µi,0 = 0
10cd
cl
10||Nu ||
cm
thickn.
0.3
0
0
500
1,000
1,500
2,000
2,500
3,000
3,500
4,000
Iteration
Kusch,Albring,Walther,Gauger
From simulation to one-shot optimization with constraints
14/ 18
Resulting Pareto-optimal Front
drag coefficient
4
·10−3
3
2
1
0
0
0.2
0.4
0.6
lift coefficient
Kusch,Albring,Walther,Gauger
From simulation to one-shot optimization with constraints
15/ 18
Using Second-Order Adjoints
Tangent over Reverse: ∆ȳkT Nyu
ū˙ T = (ȳ T Guy + v̄ T fyu + w̄ T hyu )ẏ + other terms
(6)
⇒ Set v̄ = 1, w̄ = µ, ȳ = ȳ , ẏ = ∆ȳ , Read from ū˙ (Runtime Factor: 1.6)
DataType: ActiveReal<RealForward, ChunkTape<RealForward, int>>
GetMixedDerivative: tape.getGradient(x[adjPos++]).getGradient()
1
·10−2
objective second order
objective finite differences
0.5
0
−0.5
0
200
400
600
800
1,000 1,200 1,400 1,600 1,800 2,000
Iteration
Kusch,Albring,Walther,Gauger
From simulation to one-shot optimization with constraints
16/ 18
Summary and Outlook
Summary
Semi-automatic transition from simulation to optimization involving
AD-based discrete adjoint in SU2
constrained one-shot method and
deterministic multi-objective optimization
Outlook
different application in SU2 (multi-disciplinary)
investigations on preconditioner for constraints
Thank you for your attention!
Kusch,Albring,Walther,Gauger
From simulation to one-shot optimization with constraints
17/ 18
References
Hamdi, A. and Griewank, A.
Properties of an augmented lagrangian for design optimization.
Optimization Methods and Software 25(4), 645–664 (2010).
Walther, A., Gauger, N., Kusch, L., and Richert, N.
On an extension of one-shot methods to incorporate additional constraints.
Optimization Methods and Software (2016).
Albring, T., Sagebaum, M., and Gauger, N.
Development of a consistent discrete adjoint solver in an evolving aerodynamic design framework.
AIAA 2015-3240 (2015).
Marglin, S. A.
Public investment criteria.
Allen & Unwin London, (1967).
Kusch,Albring,Walther,Gauger
From simulation to one-shot optimization with constraints
18/ 18