Optimizing LCLS2 taper profile with genetic algorithms: preliminary results X. Huang, J. Wu, T. Raubenhaimer, Y. Jiao, S. Spampinati, A. Mandlekar, G. Yu 2/29/2012 2/29/2012 1 An Overview of Multi-Objective Genetic Algorithms • Multi-objective optimization – Goal: to find the Pareto optimal set – Traditional approach: Weighted sum of objectives and its variants. – Evolutionary approach: converge to the Pareto front in one run. • Genetic algorithms – Manipulate a set of solutions (a population) toward the optimal front with operations that simulate biological evolution. – Three operators • Selection – apply the evolution pressure toward the optimal front • Crossover – create new solution (child) by combining two solutions (parents) • Mutation – alters an existing solution to create a new one. 2/29/2012 2 • Pros and Cons – Obtain global optimum (more likely) despite complexity of the problem. – Optimize multiple objectives simultaneously. – Easy to apply constraints. – But it can be much slower than gradient-based methods. 2/29/2012 3 Domination and the Pareto set 2/29/2012 4 The NSGA-II algorithm • NSGA (non-dominated sorting genetic algorithm) -II Selection (of parents) Crossover Mutation K. Deb, IEEE Transtions On Evolutionary Computation Vol 6, No 2,April 2002 2/29/2012 5 NSGA-II with parallel computation • Use Matlab script for control and processing – The algorithm is implemented in matlab – Post-processing is in matlab • Parallel computation via submitting multiple jobs to a cluster – Use file input/output as communication between external program (Genesis) and matlab. – I/O time limits the average number of nodes in use when computation time is short. 35 min per generation with up to 60 processors, or 4.5 s per evaluation, up from 20 s for individual evaluation. However the speed gain from parallel computing will be much higher for timedependent runs. 2/29/2012 6 LCLS2 Taper Optimization • Undulator tapering is required for LCLS2 to reach TW power because of SASE saturation. • Taper profile optimization is critical to capture as many electrons as possible in coherent emission. – Exploration of profile models is necessary. • Should phase between undulator segments be included in optimization? 2/29/2012 7 Taper Models Considered For z z0 Basic 8 variables Aw ( z) Aw0[1 a( z z0 )b ] Cubic 9 variables Aw ( z) Aw0[1 a( z z0 ) b( z z0 )2 c( z z0 )3 ] Quartic 8 variables Aw ( z) Aw0[1 a( z z0 )2 b( z z0 )4 ] Focusing scheme K 0 , z z1 K ( z ) K 0 (1 r1 z ), z1 z z2 , K 0 (1 r2 z ), z z2 Adding phase shift variables to the above models. So far we only varied the first few phase shifts after exponential growth. 2/29/2012 8 GA setup • Objectives: 2 – Power – “Emittance”: beam size x divergence at the exit, a convenient way to introduce diversity • Population: 600 • Termination condition: about 100 generations or converged. • Evolving mutation and crossover probability 2/29/2012 9 The basic 8 variable model (0118) gen 1 gen 11 gen 21 gen 41 gen 61 gen 81 gen 103 1.8 power (TW) 1.6 1.4 1.2 1 0.8 0.6 0.06 0.08 (a, z0) 2/29/2012 0.1 0.12 0.14 0.16 emittance (b, K0) 0.18 0.2 0.22 0.24 Aw Aw0 [1 a( param eter low a 0.01 z0 10 b 1.1 K0 20 r1 -0.005 z1 20 r2 -0.01 z2-z1 0 (r1, z1) z z0 b ) ] Lu z0 high delta best 0.3 0.001 0.1043 40 0.2 13.1 3.3 0.01 2.0359 40 0.1 34.4 0.005 0.00005 0.0018 80 0.2 80.0 0.01 0.00005 0.0061 70 0.2 28.9 (r2, z2-z1) 10 The basic 8 variable model with 7 phase shifts (0115b) gen 1 gen 16 gen 31 gen 46 gen 61 gen 76 gen 91 gen 100 1.8 1.6 power (TW) 1.4 1.2 1 0.8 0.6 0.4 0.06 0.07 (a, z0) 2/29/2012 0.08 0.09 0.1 0.11 0.12 emittance 0.13 (b, K0) 0.14 0.15 0.16 Introduce phase shifts in gaps following undulators 5 to 11. param eter low a 0.01 z0 10 b 1.1 K0 20 r1 -0.005 z1 20 r2 -0.01 z2-z1 0 (r1, z1) high delta best 0.3 0.001 0.114 40 0.2 16.8 3.3 0.01 2.072 40 0.1 34.9 0.005 0.00005 0.0008 80 0.2 74.3 0.01 0.00005 0.0022 70 0.2 9.3 (r2, z2-z1) 11 power (TW) The cubic model (9 variables) (0119) 01192012 1.8 Aw ( z ) Aw0 [1 a( L0 100 m 1.6 1.4 1.2 gen 1 gen 11 gen 21 gen 41 gen 61 gen 81 gen 101 1 0.8 0.6 0.05 0.1 (z0, a1) 2/29/2012 0.15 0.2 0.25 emittance 0.3 (a2, a3) 0.35 z z0 z z0 2 z z0 3 ) b( ) c( ) ] L0 L0 L0 parame ter z0 a1 a2 a3 K0 r1 z1 r2 z2-z1 Low 10 -0.1 0.001 -0.1 20 -0.01 20 -0.01 0 high 40 0.1 0.3 0.1 40 0.01 80 0.01 70 delta best 0.2 18.8 0.001 0.0118 0.001 0.0551 0.001 0.0538 0.1 27.9 0.0005 -0.005 0.2 38.1 0.0005 -0.009 0.2 66.8 0.4 (K0, r1) (z1,r2) 12 The quadratic and quartic model (0112) 1.8 gen 1 gen 21 gen 41 gen 61 gen 81 gen 104 power (TW) 1.6 1.4 Aw ( z ) Aw0 [1 a( z z0 2 z z0 4 ) b( ) ] Lu z0 Lu z0 1.2 1 0.8 0.06 0.07 (a, z0) 2/29/2012 0.08 0.09 0.1 0.11 0.12 emittance 0.13 (b, K0) 0.14 0.15 0.16 (r1, z1) (r2, z2-z1) 13 Summary of time-independent results case Nvar inc in 10 emittance capture generation population max Power gen (um) taper ratio ratio # "01182012" basic 8 "01152012b " 8+7 "01152012b" no phase # TW % um % 103 600 1.760 0.20% 0.0753 0.075 43.0% 1+a x^b 100 600 1.830 0.27% 0.0790 0.0816 41.1% from random 0.0816 35.1% 1.563 "01212012" phase 7 109 600 1.805 0.00% 0.0751 0.0762 based on 01182012 43.4% @ gen 47, 1.753 TW "01192012" cubic 9 100 600 1.743 0.00% 0.0702 0.0722 44.3% 1+a x+b x^2+c x^3 "01202012" 9+7 115 600 1.842 0.31% 0.0794 0.0804 42.0% 0.0804 34.7% 0.0783 42.1% 1+a x^2 + b x^4 "01202012" no phase "01122012" quartic 8 2/29/2012 1.521 104 600 1.799 0.00% 0.0757 14 Effects of phase shift variables comparison of phase variables 2/2/2012 0.3 Based on case 0118. 0.2 phase 8+7 7 phase 9+7 0.1 0 -0.1 -0.2 1 2 3 4 wiggler index-4 5 6 7 Inside undulators, phase rotation and energy loss both change. In the gaps, the two can be decoupled. Can this improve the performance? 2/29/2012 15 0.7 1.2 0.6 1 0.5 0.8 0.4 0118: basic 0119: cubic 0112: quartic 0.4 0.2 20 40 60 z (m) 80 100 0 0 120 n 0.15 (nm) 0.155 80 100 120 0 0.5 1 1.5 2 s (um) 2.5 50 2.4 2.35 2.3 0118: basic 0119: cubic 0112: quartic 2.25 0.145 60 z (m) 0118: basic 0119: cubic 0112: quartic 2.2 0 20 40 60 z (m) 80 100 3 3.5 4 0118: basic 0119: cubic 0112: quartic 2.45 b (bunching factor) P( ) (arb. units) -10 40 1.2 0.8 2.5 0118: basic 0119: cubic 0112: quartic -5 20 1.4 1 0118: basic 0119: cubic 0112: quartic 0.1 0 0 10 1.6 0.3 0.2 10 1.8 bn (bunching factor) 0.6 2 Power (TW) 1.4 bn Power (TW) Time dependent results with the taper profiles 0 -50 0 20 40 60 z (m) 80 100 120 The three model attain similar power. More study is needed to understand the results. Taper profile slightly shifted (detuned to maximize for average power for the slices) to maintain high power (but not optimized) 2/29/2012 16 Time dependent simulation with phase shifts 2 0118: basic 0121: phase only 0115b: basic+phase Power (TW) 0.6 n 1 0.8 0118: basic 0121: phase only 0115b: basic+phase b Power (TW) 1.5 0.4 0.5 1.5 1 0118: basic 0121: phase only 0115b: basic+phase 0.2 0 0 20 40 60 z (m) 80 100 0 0 120 20 40 60 z (m) 80 100 0.5 0 120 1 2 s (um) 3 4 40 -10 10 0.146 0.148 0.15 0.152 (nm) 0.154 0.156 2.45 2.4 2.35 2.3 n -5 10 b (bunching factor) 0118: basic 0121: phase only 0115b: basic+phase bn (bunching factor) P( ) (arb. units) 2.5 0118: basic 0121: phase only 0115b: basic+phase 2.25 20 40 60 z (m) 0 80 100 0118: basic 0121: phase only 0115b: basic+phase -20 -40 0 2.2 0 20 20 40 60 z (m) 80 100 120 The effects of phase shifts are not conclusive from results we got so far. 2/29/2012 17 Summary • All cases without phase shifts converge to solutions with similar beam power and taper ratio, with a capture ratio of about 43%. • Phase shifts only slightly increase beam power. But they can considerably change capture ratio (e.g., from 35% to 41%). • We will continue the exploration – Other taper profile models – Introduce other objective functions – More time dependent studies 2/29/2012 18