A Genetic Algorithm for Chromaticity Correction in Diffraction Limited Storage Rings

A multi-objective genetic algorithm is developed for optimizing nonlinearities in diffraction limited storage rings. This algorithm determines sextupole and octupole strengths for chromaticity correction that deliver optimized dynamic aperture and beam lifetime. The algorithm makes use of dominance constraints to breed desirable properties into the early generations. The momentum aperture is optimized indirectly by constraining the chromatic tune footprint and optimizing the off-energy dynamic aperture. The result is an effective and computationally efficient technique for correcting chromaticity in a storage ring while maintaining optimal dynamic aperture and beam lifetime. This framework was developed for the Swiss Light Source (SLS) upgrade project.


I. INTRODUCTION
Multi-objective genetic algorithms have found much success providing non-intuitive solutions to problems that are not adequately solved by analytic methods. Such algorithms have been successfully applied to various aspects of accelerator design [2], [3], [4], [5], and [6]. In this paper, a genetic algorithm is developed for optimizing dynamic aperture and beam lifetime using sextupole and octupole strengths in next-generation diffraction limited storage rings (DLSR).
The 1-turn map for a DLSR contains strong nonlinearities. Such machines use stronger focusing and lower dispersion to achieve an emittance that is below the diffraction limit for some wavelengths of light. The strong focusing of these machines leads to a large chromaticity, which must be corrected by placing strong sextupoles in dispersive regions. Furthermore, the low dispersion necessitates that the sextupole strengths be even higher. Such strong sextupole moments add strong nonlinearities to the lattice.
These nonlinearities must be carefully designed to maintain adequate injection efficiency and beam lifetime. Nonlinearities induce tune shifts and increase the sensitivity of particles to machine imperfections. This reduces the dynamic aperture, which is the volume in 6D phasespace containing stable particle trajectories. Touschek scattering and residual gas scattering excite the phase space coordinates of particles stored in a ring. A particle is lost if it exits the dynamic aperture. This imposes a beam lifetime. A reduced dynamic aperture also complicates injection by reducing the capture efficiency of the machine. The problem of nonlinear optics in a storage ring is to correct the chromaticity without inducing nonlinearities that degrade the other lattice properties too much.
The established technique for optimizing nonlinearities in a storage ring is resonant driving term minimization and was developed for the original SLS [7]. It is a Lie algebra expansion of the transfer map in driving terms * michael.ehrlichman@psi.ch that are functions of the sextupole strength. These terms drive higher order chromatic tune shifts, amplitude dependent tune shifts, and resonances. A gradient optimizer is used to minimize a weighted vector of the driving terms. The weights are determined by judging from the tune diagram and frequency maps which resonances and tune shifts are most important. This technique is straightforward to wield up to second order in sextupole strength. Beyond second order, the number of driving terms which need to be minimized makes the method less robust. The complexity of the optimization space necessitates much trial and error to locate good local minima, and the procedure becomes a bit of a dark art.
A storage ring is a complicated nonlinear oscillator. Its transfer map is the concatenation of many hundreds of linear and nonlinear maps. Explicit algorithms yield only an incomplete control of particle motion in a storage ring. This lack of analytic clarity makes accelerators good candidates for genetic algorithms, which typically do not depend on knowledge of the system. Genetic algorithms optimize a system by selectively breeding trial solutions according to their fitness.
One example where a genetic algorithm performs better than perturbation techniques is in confining the chromatic and amplitude-dependent tune shifts. Second order perturbation theory is unable to bend the chromatic and amplitude dependent tune shifts beyond second order. The genetic algorithm developed here fits tune footprints into tighter areas using higher orders of correction.
A well-designed genetic algorithm will encourage behaviors in the evolving population that, further down the road, lead to solutions with optimal objective functions. For example, the algorithm presented here includes a dominance constraint (See Sec. III C) on the amplitude of the nonlinear dispersion. A small-amplitude nonlinear dispersion is not one of the objective functions, but it is a property that a lattice with good objective functions will have. By applying a dominance constraint to the nonlinear dispersion, we are, in a sense, breeding characteristics into the early generations, that in later generations will yield improved objective functions.
Genetic algorithms for the optimization of storage ring nonlinearities have been developed and evaluated elsewhere [4], [8], [9], [10], and [11]. The present applica-tion stands out in its use of dominance constraints to more efficiently evolve the population. The algorithm requires only modest computing resources. On a Linux cluster consisting of 64 E5-2670 Xeon cores, it delivers solutions to 10 variable problems in one or two days, and 20 variable problems in two or three days. The scheme consistently does as well or better than Lie algebra approaches, and repeated attempts with different random seeds on different lattice variants suggest that the solutions it finds are globally optimal. So the optimization scheme presented here allows for a lattice development cycle on the order of a couple days, and does not consume expensive computing resources.
Section II of this paper gives an overview of the system, listing the components out of which this optimization scheme is built. Section III introduces multi-objective genetic algorithms, and Sec. IV describes the optimization problem, including the physics behind the calculations of the objectives and constraints. In Sec. V the optimization scheme is applied to upgrade prototypes of SLS and the proposed Armenian light source CANDLE [12]. Misalignment studies are conducted on the SLS upgrade lattice in Sec. VI.

II. SYSTEM ARCHITECTURE
The optimizer is built within the PISA framework [13], which specifies that the sorting algorithm be separated from the rest of the optimizer. The sorting algorithm is implemented as a stand-alone binary that communicates with the rest of the optimizer using a text-file based API. This separation simplifies the coding and makes it trivial to switch between different sorting algorithms, such as SPEA2 [14] or NSGA2 [15].
We use the aPISA variant [6] of PISA. aPISA modifies the original PISA framework by supporting dominance constraints. aPISA was originally developed for the design of the Cornell ERL injector.
Accelerator physics calculations are handled by calls to the Bmad library [16]. The top-level coding, which includes population management and breeding, parallelization, and additional physics calculations, was developed at PSI and is coded in Fortran90. The parallelization paradigm is master-slave and is implemented using Coarrays, which in Intel's Fortran compiler is implemented as a high-level language on top of MPI.
The cluster management software is Sun Grid Engine (SGE). The cluster is composed of several 16-core E5-2670 compute nodes running 64-bit Scientific Linux. Typically 4 of these nodes are used in an optimization run.

III. MULTI-OBJECTIVE GENETIC ALGORITHMS
The multi-objective optimization problem is formulated as [17]: (1) f m are the objectives, which generally are competing. g j are inequality constraints and h k are equality constraints.
x (L) i and x (U) i are upper and lower bounds on variables. A vector of variable strengths x = (x 1 , x 2 , ..., x n ) T is called an individual.
A genetic algorithm manages a population of individuals. Every individual i in the population is represented by a vector of variables x (i) . For our purposes x (i) is realvalued, but in general it could contain integer, logical, and complex variables. Each individual i has an associated vector of objective values f (i) and constraint values g (i) and h (i) .
The output of a multi-objective optimizer is of a different nature than that of a single-objective optimizer. A single objective optimizer, or equivalently, an optimizer which reduces f (i) to a single value by weighting the individual objectives, gives the user one particular x that is the best solution to the optimization problem it could find. A multi-objective optimizer, on the other hand, returns a population of x's. This returned population is an optimal surface in the objective space called a Pareto front. For any individual on the Pareto front, no improvement to any one of its objectives can be achieved without worsening the others. The user of a multi-objective optimizer typically applies additional criteria when selecting a particular solution from the Pareto front.

A. Ranking the Population
The ranking of individuals in a single objective optimization problem is straightforward: the individual with the better objective value is preferred. Ranking in multi-objective optimization problem is more complicated. The core concept is the dominance relationship, which is a way of comparing any two individuals, say x (i) and x (j) . They are compared by asking the question: "Does x (i) dominate x (j) ?" The dominance relationship is defined as [17]: , if both of the following conditions are true: 1. x (i) is no worse than x (j) in all objectives.
2. x (i) is strictly better than x (j) in at least one objective.
A sorting algorithm applies the dominance relationship to sort the population from best to worst. There exist many different sorting algorithms. Two algorithms that we have used are NSGA2 and SPEA2. We obtain similar results with both algorithms, but find that the populations resulting from SPEA2 span the objective space more evenly.
For details on SPEA2 see Ref. [14]. In short summary, dominance is determined for every ordered pair of individuals in the population. Each individual in the population is assigned a strength which is the number of individuals it dominates. Then, each individual is assigned a fitness which is the sum of the strengths of all the individuals that dominate it. A lower fitness is better. A 'clumping' penalty is added to this fitness based on the shortest distance (in objective space) of the individual to another individual. This encourages the population to span a wider region of the objective space. Incidentally, the clumping penalty makes it unlikely for any two individuals to have the exact same fitness, even if they are both not dominated by any other individual.
Individuals are ordered according to their fitness value. The lowest ranked individuals are deleted from the population. This is typically the worst half or three-quarters of the population each generation. The population is replenished by mating the surviving individuals.
Mating pairs are determined by drawing integers in a procedure called a tournament. Two or more random integers are drawn between 1 and N , where N is the number of surviving individuals. 1 corresponds to the most fit, and N to the least fit. The individual corresponding to the smallest of the drawn integers is chosen for mating. Thus, individuals with better fitness are more likely to reproduce. Its mate is chosen through the same process. This is repeated until enough pairs have been selected to replenish the population. Each pair generates two offspring.
A two-step process generates two new children from each mating pair.
The first step is simulated binary cross-over [18].
Say the two parents are They will produce two offspring, x (c1) and x (c2) .
Start with variable x (·) 1 and draw a random real t between 0 and 1. Compare t to P c , which is a parameter between 0 and 1 that determines how likely it is that a variable is simply copied from parent to child, as opposed to applying a stochastic function. If t > P c , then variable x (p1) 1 is simply copied to the child x (c1) 1 . If t ≤ P c , then draw another random real q between 0 and 1. Then, where κ is a parameter that controls the width of the distribution. As depicted in Fig. 1, smaller values of κ cause the offspring to explore a broader parameter space. A typical value for P c is 0.8. This process is repeated for all n variables. Next a mutator is applied separately to x (c1) and x (c2) . For each variable i in x (c1) , draw a random real t between 0 and 1. Compare t to P m , a parameter that determines how likely it is for a variable to undergo mutation. If t > P m , the variable is not mutated. If t ≤ P m , then draw a second random real m. Variable x (c1) i is adjusted according to and A typical value for P m is n −1 , so that on average one variable is mutated per child. σ mut is typically set to about 10% of the reasonable variable strength. β m is depicted in Fig. 2.
After x (c1) , the mutation process is repeated on each variable in x (c2) and both are added to the population. New individuals are generated until the population is fully replenished.

B. Progression of Generations
Once the population is fully replenished, the worker processes calculate the objectives and constraints of the newly generated individuals. The population, consisting of both the parents and children, is resorted and the least fit are deleted. Some of the children will be more fit and displace the older individuals in the surviving population. So is the overall fitness of the population improved. This process of evaluation, sorting, deletion, and replenishment is looped continually. Each loop is referred to as a generation.
As implemented, there is not actually a clear line between one generation and the next. The algorithm is modified to improve computational efficiency. By far, the most time-consuming step is when the objectives and constraints of an individual are calculated. It could often be the case that many nodes in the cluster sit idle while the last few individuals of a given generation are being evaluated. To avoid this situation, the optimizer initially generates extra individuals equal to the number of cores in the cluster. For example, if the population is set to 300 and there are 64 nodes in the cluster, the optimizer will initially generate 364 individuals. Whenever a core finishes evaluating an individual, the individual is added to the population and the core is always immediately given a new unevaluated individual to process. Whenever the population reaches 300, it is resorted, culled, and new individuals are bred. These new individuals replenish the pool of individuals awaiting evaluation. This modification to the algorithm improves cluster efficiency. The loss of a clear demarcation between the generations does not seem to negatively impact the evolution of the population.

C. Dominance Constraints
Dominance constraints are a powerful type of constraint that is unique to multi-objective optimization. It is implemented by modifying the dominance relationship. We apply the dominance relationship as implemented in aPISA [6].
In addition to calculating objective values f x (i) for each individual i, we also calculate a vector of constraint values c x (i) . For example, say c 1 is a dominance constraint for the off-momentum horizontal closed orbit x inj at the injection point, and we wish to constrain |x inj | to be less than x max . Then, c 1 = x max − |x inj |. If c 1 is negative, it indicates that the constraint is violated. The magnitude of c 1 represents the degree to which it is violated. Dominance constraints are implemented by replacing the ordinary definition for dominance in Def. 1 with Def. 2. An individual is called infeasible if it violates any of its dominance constraints, else it is called feasible.
if any of the following conditions are true: 3. x (i) and x (j) are both infeasible, and both The behavior of a genetic algorithm implementing dominance constraints flows through three phases: 1. Random population, possibly containing no feasible individuals, spans variable space, sorted according to severity of constraint violations.
2. Entire population is feasible and spans feasible region of variable space, sorted according to objective values.
3. Population spans variable space that approaches the Pareto optimal objective space.
Notice that if an individual violates any of its dominance constraints, then its objective values are not taken into account during ranking. Therefore, to save computing time, objective values are calculated only for individuals which do not violate any dominance constraints. Dominance constraints are based on variable bounds, closed orbit amplitudes, and chromatic tune shifts. These quantities are orders of magnitude quicker to evaluate than objective values, which are based on particle tracking.

IV. EVALUATION OF INDIVIDUALS
The design problem is to correct the chromaticity while maintaining acceptable dynamic aperture and beam lifetime. The beam lifetime would be maximized by maximizing the momentum aperture, which is the largest momentum kick that an initially on-axis particle can receive The aperture is found using a binary search for particle loss.
In this plot N angle = 7.
without being lost downstream. The momentum aperture can vary throughout the lattice and is typically calculated element-by-element or in fixed steps. It is computationally expensive to calculate, so instead we optimize the off-energy dynamic aperture and apply a dominance constraint to the chromatic tune footprint. The results in Sec. V show that this is an effective proxy for the momentum aperture.

A. Objectives
The dynamic apertures are calculated relative to the linear aperture. The linear aperture is the smallest aperture found by projecting the beam chamber from each point in the lattice to the injection point using the linearization of the map about the particle momentum. The linear aperture, in general, depends on the particle momentum. The on-energy linear aperture does not depend on the sextupole and multipole strengths, but the offenergy linear aperture does. The objective function is formulated relative to the linear aperture such that 1.0 is perfectly bad and 0.0 is perfectly good, where N angle is the number of rays along which the aperture is calculated. L l is the length of the linear aperture ray. L da is the length of the dynamic aperture ray. L l and L da are depicted in Fig. 3. The conditional in Eq. 7 reflects our design philosophy that a machine with optimized nonlinearities should behave as if it were linear. The objective function is not rewarded when the dynamic aperture exceeds the linear aperture.
Three objectives are used in our multi-objective optimization problem: where ∆E +DA and ∆E -DA specify the energy offset where dynamic aperture is evaluated. Typical energy offsets are 2% or 3%.

B. Constraints
Three constraint techniques are used: dominance constraints, modified objective functions, and variable space projection.
Five constraints are implemented as dominance constraints. They are 1. c mag : Boundary on sextupole and multipole strength.
2. c +co : Global bound on nonlinear dispersion at ∆E +DA .
3. c −co : Global bound on nonlinear dispersion at ∆E -DA .
The constraint on sextupole and multipole strength is calculated as, where K i is the strength of magnet i, and x where x (co) is the maximum allowed closed orbit, usually set to millimeter or so. x co,i and η i are the closed orbit and ordinary dispersion at element i.
The positive chromatic footprint between 0 and ∆E +χ is constrained to cross neither the half-integer nor the integer resonances. It is calculated by dividing the interval from ∆E = 0 to ∆E = ∆E +χ into N χ equal segments. The horizontal and vertical tunes are calculated by linearizing the optics about each ∆E j ∈ {∆E 1 , ∆E 2 , ..., ∆E +χ }. The smallest of these energy offsets that results in an unstable transfer matrix, or a horizontal or vertical tune that crosses an integer or halfinteger resonance, is used to calculate the value of the dominance constraint. The value is calculated as, If all ∆E +j are stable and do not cross the half-integer or integer, c +χ is set to 0. A similar procedure is used to constrain the negative chromatic tune footprint c −χ . Two constraints are implemented by modifying the objective functions. The first is a constraint on the minimum size of the off-energy linear aperture and it modifies the off-energy objective functions f + and f − . The constraint prevents a failure condition where the optimizer improves the off-energy objectives by making the linear aperture tiny, rather than by growing the dynamic aperture. Setting this constraint to 2 or 3 mm is usually sufficient to avoid the condition. If the shortest linear aperture ray at ∆E +DA or ∆E -DA is shorter than this constraint, then f + or f − is set to a perfectly bad value of 1.
The second constraint implemented by modifying the objective functions modifies the on-energy objective function f 0 . It confines the on-energy amplitude dependent tune shift (ADTS). Along the two DA rays closest to the horizontal axis, the horizontal and vertical tunes are calculated. Along the vertical ray, the vertical tune is calculated. This is because the horizontal motion for large vertical and small horizontal offsets is dominated by coupling, rather than by the horizontal optics. The tunes are calculated by summing the element-by-element phase advance in normal mode coordinates. If the tunes of the particle cross the half-integer or integer resonances, then the tracking code considers the particle lost. The apertures along the two horizontal rays and one vertical ray define a 'clipping' box. When f 0 is calculated, all DA rays are clipped at the box.
The chromaticity correction is applied by projecting the N cs -dimensional space of chromatic sextupole strengths onto the (N cs − 2)-dimensional surface on which the horizontal and vertical chromaticities have the desired values. This is possible because chromaticity depends linearly on the sextupole strength. N cs is the number of chromatic sextupole families in the lattice. A chromaticity response matrix A is determined numerically, The Moore-Penrose pseudoinverse A p of A is calculated via singular value decomposition (SVD) [19]. Then the thin-QR decomposition [19] Q 1 of I − A p A is taken, where I is the N cs × N cs identity matrix. Note that Q 1 ∈ R Ncs×Ncs−2 . With A p and Q 1 in hand, take any vector ω ∈ R N cs−2 . The chromatic sextupole strengths K given by result in chromaticities of χ x0 and χ y0 . The algorithm does not operate directly on the chromatic sextupole strengths. Instead it operates on ω, thus constraining the chromaticities to the desired values and reducing the dimension of the variable space by 2.

V. APPLICATION
Here the genetic algorithm is applied to a prototype lattice for the SLS upgrade, and also the proposed Armenian light source CANDLE.
The SLS upgrade is a 2.4 GeV storage ring built of 12 arcs which consist of 5 longitudinal gradient bends (LGB) plus 2 half-bend longitudinal gradient dispersion suppressors. There are 3 types of straight (short, medium, and long) which reduce the periodicity to 3. The lattice uses anti-bends to focus the dispersion into the LGBs to minimize the radiation integral I 5 [20]. The lattice parameters are summarized in Tab. I. For the SLS upgrade lattice, the objective functions are the on-energy dynamic aperture and the dynamic aperture at −3% and +3%. The chromatic footprint between −5% and +5% is constrained such that 37.0 < Q x < 37.5 and 10.0 < Q x < 10.5. The amplitude-dependent tune shift as described in Sec. IV is constrained to this same region.
For CANDLE, the objective functions are the onenergy dynamic aperture and the dynamic aperture at −2% and +2%. The chromatic footprint between −3% and +3% is constrained such that 24.5 < Q x < 25.0 and 14.0 < Q x < 14.5. The amplitude-dependent tune shift as described in Sec. IV is constrained to these same regions.
The optimization parameters for both lattices are summarized in Tab A. SLS Upgrade Lattice

Layout and Linear Lattice Considerations
The following were taken into consideration during the design of the layout and linear optics of the SLS upgrade lattice in order to improve the nonlinearities.

The ADTS is suppressed if the horizontal tune is close to
where N is the periodicity of the machine and q is some integer [22,Chapter 14.3.1]. The periodicity of SLS is 3. Thus ADTS is reduced by selecting a horizontal tune near one of the following: {..., 34.5, 37.5, 40.5, ...}.
3. The arcs are constructed from five identical unit cells. The horizontal and vertical phase advances per unit cell are 0.4 and 0.1 radians, respectively. Over the five unit cells, the lowest order chromatic and geometric resonant driving terms are canceled out [7].

Optimization
The population size for the SLS upgrade optimization is 300 and begins with a pool of 364 unevaluated, randomly generated, individuals. Each individual is described by 21 variables representing the 23 magnet strengths. The strengths are bounded by c mag,sext. and c mag,oct. , as given in Tab. II. Each seed is farmed via MPI to a CPU which evaluates its constraint and objective values. As soon as 300 individuals have been evaluated, the population is sorted and the 150 least fit are deleted. A four-way tournament is used to select parent pairs from the surviving population. From each pair, simulated binary crossover plus mutation is used to generate two new children. The new children are added to the pool of unevaluated individuals, and the process repeats.
The initial random population contains no individuals which satisfy the dominance constraints (i.e. all individuals are infeasible). Therefore the population members initially compete for who has the least-bad constraint violations. For the particular optimizer run shown here, the first feasible individual appears at generation 21, and at generation 41 the population consists entirely of individuals which satisfy all of the dominance constraints. From generation 1 to 20 requires 2 minutes, and from generation 20 to 41 requires 14 minutes. This first stage of the optimization proceeds quickly because infeasible individuals are evaluated only for off-momentum closed orbit amplitudes and tune footprints. During the remainder of the optimization run, individuals are competing based on dynamic aperture. The entire optimization completes after 45 hours to converge at generation 616. Computing resources are 64 E5-2670 Xeon cores. These compute time requirements are generally indicative of the resources required by the algorithm on the SLS upgrade.
Following the optimization run, the seeds with the most promising objective function values are selected by hand for further evaluation. Further evaluation includes on-and off-energy rastered survival plots, higher resolution chromatic and ADTS tune footprints, momentum aperture, and Touschek lifetime evaluation. Using these additional evaluations, the lattice designer selects a best individual.
The dynamic aperture of this individual at 0%, −3%, and +3% is shown in Fig. 4. Figure 5 compares the momentum aperture and linear momentum aperture. The linear momentum aperture is calculated by linearizing the one-turn map at each element. The reference Touschek lifetime is calculated from the linear RF bucket height, and is taken as the benchmark against which to judge the effectiveness of the algorithm.
The assumptions used for the Touschek lifetime calculation are shown in Tab. III. The lifetime exceeds the reference lifetime because the nonlinearity of the longitudinal phase space causes it to exceed the dimensions of the linear RF bucket, and the momentum aperture is not otherwise limited by the transverse nonlinearities.
Recall that the genetic algorithm does not directly optimize the Touschek lifetime nor momentum aperture. Rather, it constraints the chromatic and amplitudedependent tune footprints and maximizes the dynamic aperture area at 0% and ±3%. The element-by-element variation in the momentum aperture is small. This indicates that the Touschek lifetime is limited by the longitudinal dynamics, and not by nonlinearities in the transverse optics. Judging by this result, an off-momentum dynamic aperture optimization plus tune footprint constraint is a valid proxy for optimizing the Touschek lifetime and momentum aperture.  Fig. 6 are x-p x and y-p y phase space portraits for the optimized SLS upgrade lattice. The portraits are calculated using 4D tracking for 100 turns. The lack of large resonance islands and lack of thick chaotic layers Momentum aperture of SLS upgrade. Linear aperture is calculated using an element-by-element linearization of the optics. The 6D aperture is calculated with full 6D tracking including radiation damping and synchrotron oscillation for 2.5 periods of the linear synchrotron tune. The asymmetry of the 6D momentum aperture is the influence of nonlinear momentum compaction. The RF voltage is set such that the linear calculation gives a ±5% bucket. inside the stable region is a positive result that should contribute to the robustness of the solution when misalignments are added. Figure 7 shows the chromatic tune footprint and ADTS along ±x. The chromatic tunes are calculated by linearizing the off-energy optics. The ADTS is calculated by summing element-by-element phase advances in normal mode coordinates. The ADTSs along +x and −x mostly overlap.

B. CANDLE
CANDLE is a proposed 3 GeV, 216 m Armenian light source project [21] providing 8.54 nm horizontal beam emittance. According to the recent developments in storage ring lattice design and magnet technologies a new upgrade prototype has been designed [12], which is constructed of sixteen 4BA cells and provides 1.1 nm horizontal beam emittance. The study shown here is on this new 1.1 nm prototype. Each cell is composed of combined function bends with both quadrupole and sextupole moments. Some properties are shown in Tab. I. Two features which contribute to CANDLE's nonlinearities are: 1) The sextupole moments are spread out across a broad phase advance. 2) All sextupole moments are in dispersive regions.  The dynamic aperture on-energy and at ±2% are shown in Fig. 8. The horizontal ADTS and chromatic footprint out to ±3% are shown in Fig. 9.
Touschek lifetime results and assumptions are shown in Tab. III. The momentum aperture calculated from 6D tracking is shown in Fig. 10. The aperture is determined entirely by the RF bucket and not limited by the transverse optics. The phase space portraits are shown in Fig. 11. Optimizing the ±2% dynamic aperture and con-  straining the chromatic tune footprint to ±3% has successfully optimized the global momentum aperture to at least ±3%.

VI. TOLERANCE TO MACHINE MISALIGNMENTS
The tolerance of the optimized SLS upgrade lattice to machine misalignments is tested. The genetic algorithm is applied to the ideal lattice and a single solution is selected by the lattice designer. The lattice is then misaligned according to Tab. IV and corrected as described below. The beam lifetime and on-energy dynamic aperture of the resulting misaligned and corrected lattice is calculated. This procedure is repeated for many misalignment seeds.   The correction procedure begins by flattening the horizontal and vertical orbits using an orbit response matrix and SVD. Then a simultaneous horizontal phase, vertical phase, and horizontal dispersion correction is applied using a combined phase and dispersion response matrix. The residual coupling after these corrections ranges from 0.4 to 3.2%. A dedicated coupling correction is not included in this study.
So 30 misalignment seeds are generated and corrected. One of these seeds fails to have a closed orbit and is discarded. The on-energy dynamic aperture and momentum aperture for the remaining 29 are calculated and the results are shown in Fig. 12 and Fig. 13. 50% of the misaligned and corrected lattices have a lifetime longer than 3.8 hr, and 95% have a lifetime longer than 3.6 hr. The reference lifetime is 4.4 hr.
The misalignment and correction procedure applied here is pessimistic. The fully developed SLS upgrade misalignment model will take into account that the LGBs will be aligned relative to the girders, and the girders relative to one another. Furthermore, coupling correction and vertical dispersion correction will be applied in the actual machine. Despite the pessimistic scenario, the calculated dynamic aperture and lifetimes of the misaligned  and corrected lattices are acceptable. From this we conclude that the sextupole and octupole scheme generated by the genetic algorithm is sufficiently robust against imperfections. The sensitivity of the chromaticity correction scheme to beta beating is tested by applying gradient errors to the quadrupole moments in quadrupoles and gradient bends. Errors with RMS values of 0.05%, 0.10%, 0.15%, and 0.20%, subject to a 2-σ cutoff, are tested. No corrections are applied. 1000 seeds are generated for each of the four cases. For each seed, the on-energy dynamic aperture and mean percent beta beat is calculated. Plotted in Fig. 14 is the mean for each case and the convex hulls that contain 50% and 90% of the seeds closest to the mean. In the original SLS, beta-beating is measured to be 2% [23]. We therefore anticipate a reduction in the on-energy dynamic aperture area in the SLS upgrade due to beta-beating of less than 20%.

VII. CONCLUSION
The genetic algorithm presented here offers a robust and computationally affordable technique for generating globally optimal chromaticity correction schemes for FIG. 14. Area of the +y dynamic aperture versus percent beta beating induced by quadrupole gradient errors. The solid enclosure is the convex hull containing 50% of the seeds nearest the mean, the dashed enclosure contains 90% of the seeds.
diffraction limited light sources. The resulting correction schemes have good on-energy dynamic aperture which should help injection efficiency and give a wide momentum aperture for long beam lifetime. The schemes are sufficiently robust against misalignments.
One feature of this algorithm is the use of dominance constraints to encourage individuals in the early population to take on properties that will later on contribute to healthy objective values.
A second feature is the use of off-energy dynamic aperture along with tune footprint constraints as a proxy for the computationally expensive direct momentum aperture calculation.
Based on development efforts at SLS and results shared by the CANDLE collaboration [12], this genetic algorithm delivers results that are as good or better than those obtained by applying 2nd order resonant driving term minimization. The genetic algorithm converges in a couple days on commonly available computing resources. This turn-around time is comparable to that required for a lattice designer to develop a scheme using resonant driving term minimization. Thus the genetic algorithm presented here is a practical solution for optimizing sextupole and octupole strengths in a diffraction limited light source project.

ACKNOWLEDGMENTS
I would like to thank David Sagan of Cornell University for supporting the development of this genetic algorithm through his work on the Bmad [16] library. Many aspects of this work benefited greatly from discussions with Masamitsu Aiba and Michael Böge. I would like to thank Andreas Streun for his mentorship in storage ring nonlinearities, and for the well-designed SLS upgrade lattice. I would like to thank Artsrun Sargsyan for the opportunity to contribute to the development of CANDLE.