1 Introduction

Multipole magnets are essential components of particle accelerators and are of paramount importance for the success of particle physics experiments that are performed in accelerator facilities [1]. Quadrupole magnets, in particular, are crucial for keeping particle beams focused on their desired trajectories [2]. The very nature of particle physics experiments places very high demands on the operation and performance of accelerator magnets. Therefore, their production must be based on meticulous design procedures.

Focusing on the case of quadrupole magnet design, common practice dictates to formulate the design objectives into an optimization problem with respect to the geometric parameters of the quadrupole, while certain operational parameters must also be taken into account during the optimization process. Therein, the electromagnetic phenomena taking place inside the magnet are typically simulated using a digital magnet model and are included into the optimization as performance measures [3,4,5,6,7]. However, such geometry optimization problems are notoriously hard to solve, in fact, NP-hard [8], due to the fact that their computational complexity increases exponentially with the number of solution candidates. In many cases, the only viable option is to employ search algorithms that are capable of comprehensively exploring the parameter space and finding an adequate configuration at a reasonable computational cost. Popular methods of choice are Monte Carlo algorithms [9,10,11], simulated annealing [12, 13] or genetic algorithms (GAs) [14,15,16,17], all of which have been successfully applied to a number of geometry optimization problems [18,19,20].

This work focuses on the use of GAs for the purpose of quadrupole design. Originally, GAs have been developed for unconstrained, single-objective optimization problems, which constitute their natural domain of application [21]. However, most geometry optimization applications, also including quadrupole magnet design, feature multiple and often conflicting objectives. In such cases, a multi-objective optimization (MOO) [22, 23] must be solved instead. Therein, the goal is to find so-called Pareto optimal solutions, which cannot be further improved with respect to one objective without worsening another [24]. Such MOO problems are faced and tackled increasingly more often in various engineering applications that concern geometry optimization [25,26,27,28]. To address these problems, traditional GAs have been extended, e.g., in the form of so-called non-dominated sorting genetic algorithms (NSGAs) [29,30,31,32].

Regarding the quadrupole magnet design problem considered in this work, the objectives of the MOO are: (a) the maximization of magnetic field quality within the aperture of the quadrupole magnet and (b) the minimization of the magnet’s radius. The former objective is aligned with the desired magnet operation with respect to beam focusing. The latter objective aims at designs that use the minimum necessary amount of magnet material, so that production costs remain acceptable. The magnetic field quality is first computed using a magnetostatic finite element (FE) magnet model and then expressed in the form of relative multipole coefficients on a reference radius. The evaluation of the relative multipole coefficients is integrated into the fitness function of an NSGA, such that only solutions which maximize the magnetic field quality are allowed to propagate through the evolution process, as dictated by the first optimization objective. In particular, the algorithm known as NSGA-III [31] is employed. The solutions are further constrained by the second objective, i.e., the need for a minimal magnet radius. The Pareto optimal solutions, i.e., those that provide an acceptable balance with respect to both objectives, are then analyzed such that the best magnet design candidates are identified.

While works featuring GA-based MOO algorithms for the optimization of accelerator systems do appear in the literature [33,34,35,36,37,38], the application of such optimization algorithms to accelerator magnet design seems to have been so far neglected. In fact, the only relevant work that the authors are aware of is [1], which mentions the option of optimizing accelerator magnets by means of MOO based on GAs, however, without providing any verification in the form of numerical experiments. The present work aims to fill this gap.

The rest of this paper is organized as follows. Section 2 presents the problem formulation with respect to computing the magnetic field of the magnet for a given design, the magnet model considered in this work, and the computation of the magnetic field quality in the aperture of the magnet. Section 3 presents the general formulation of MOO problems and discusses GAs suitable for the solution of such problems, in particular the NSGA-III. In Sect. 4, the MOO problem with respect to the quadrupole magnet design is formulated. The numerical results obtained by means of the NSGA-III algorithm are presented and extensively discussed in Sect. 5. Finally, conclusions are drawn in Sect. 6.

2 Problem formulation and magnet model

The physical behavior of a quadrupole magnet can be fully described by the Maxwell equations, which provide the mathematical foundation for classical electrodynamics. However, in most cases, it suffices to provide an approximate description of the electromagnetic phenomena appearing in a given problem setting, thus simplifying the underlying equations and the resulting simulation model. For our particular application of a quadrupole magnet with nonlinear materials, it is sufficient to consider a magnetostatic representation of the underlying magnetic field quantities. Therefore, we employ the magnetic vector potential formulation in the steady-state regime.

Fig. 1
figure 1

2D cross section of the quadrupole magnet. The computational domain, its boundaries, and the different material-based subdomains are presented as in the legend. The identifiers \(1 - 6\) and the letters A, B, denote the geometrical parameters of the magnet, as described in Table 1 (color figure online)

Considering the 3D case, the magnetic vector potential formulation is given as

$$\begin{aligned} \nabla \times (\nu (\textbf{b}) \nabla \times \textbf{a}) = \textbf{j}, \end{aligned}$$
(1)

where \(\nu \) is the magnetic reluctivity tensor, \(\textbf{b}\) the magnetic flux density, \(\textbf{a}\) the magnetic vector potential, and \(\textbf{j}\) the current density. Equation (1) is discretized by employing a projection on (1) with a test function \(\textbf{v}\) on a computational domain \(\Omega \) with boundary \(\partial \Omega = \partial \Omega _\textrm{N} \cup \partial \Omega _\textrm{D}\), where \(\partial \Omega _\textrm{N}\) and \(\partial \Omega _\textrm{D}\), respectively, denote the boundary parts where Neumann and Dirichlet boundary conditions (BCs) are imposed [39]. The corresponding weak formulation reads:

$$\begin{aligned}&\textrm{Find} \ \textbf{a} \in \textbf{L}_0(\textrm{curl},\Omega ) \ \text {such that} \nonumber \\&\int _\Omega \nu (\textbf{b}) \nabla \times \textbf{a}\cdot \nabla \times \textbf{v}\, \textrm{d}\Omega = \int _\Omega \textbf{j}\cdot \textbf{v} \, \textrm{d}\Omega , \end{aligned}$$
(2)

for all test functions \(\textbf{v}\) in the space \(\textbf{L}_0(\textrm{curl},\Omega )\), defined as

$$\begin{aligned} \textbf{L}_0(\textrm{curl},\Omega ) = \{\textbf{u} \in \textbf{H}(\textrm{curl},\Omega ): \textbf{n}\times \textbf{u} = 0|_{\partial \Omega _\textrm{D}} \}. \end{aligned}$$
(3)

In (3), \(\textbf{H}(\textrm{curl},\Omega )\) is the space of square-integrable functions with square-integrable weak curl. Note that the Neumann boundary integral arising in the deduction of (2) vanishes by applying the Neumann BC \(\textbf{n}\cdot \left( \nu \left( \textbf{b} \right) \textbf{b}\right) =0\), where \(\textbf{n}\) is the outer normal unit vector. The Dirichlet BC \(\textbf{n}\times \textbf{a}=0\) is enforced in \(\textbf{L}_0(\textrm{curl},\Omega )\).

The magnetic vector potential is approximated within a finite element space as

$$\begin{aligned} \textbf{a}=\sum _{j=1}^{E} \hat{a}_{j} \textbf{w}_j, \end{aligned}$$
(4)

where \(\hat{a}_j\) are the degrees of freedom (dofs), E is the number of dofs, and \(\textbf{w}_j\) denotes Nédélec basis functions of the first kind and the first order [40]. We apply the Ritz–Galerkin procedure, such that the set of test functions is the same as the set of shape (basis) functions.

2.1 2D magnet model

The magnet model is further simplified taking into account the translation invariance of the magnet along the z-axis. Therefore, we may consider a magnetic vector potential perpendicular to a 2D cross section of the 3D domain, in which case \(\textbf{a} = [0,0,a_z = a_z(x,y)]^\top \) and \(\textbf{j} = [0,0,j_z]^\top \). We denote the computational domain of the 2D cross section of the quadrupole magnet with \(\Omega _{\text {2D}}:=\{\textbf{x}\in \mathbb {R}^2 \,\, | \,\, \left\Vert \textbf{x}\right\Vert _2\le R\}\), which corresponds to a circle with radius \(R\in \mathbb {R}\) around the origin. Figure 1 depicts the full 2D quadrupole magnet model contained in \(\Omega _{\text {2D}}\), where the corresponding geometry descriptors and numerical identifiers are given in Table 1. The Dirichlet BC \(\textbf{n}\times \textbf{a} = 0\) is imposed on the boundary \(\partial \Omega _\textrm{D}\), also shown in Fig. 1.

Table 1 also presents the intervals \([a_i, b_i]\), within which the geometrical parameters are allowed to vary during the optimization procedure, i.e., \(a_i \le x_i \le b_i\), \(i=1,\dots ,6\). Parameters with constant values throughout the optimization are denoted with the identifiers A and B. Shims are included in the quadrupole model as important pole adjustments, which can lead to significant improvements in the homogeneity of the magnetic field, thus, to field quality improvements as well [41]. Further improvements can also be achieved through pole shape optimization as in [42]. The nonlinear material of the yoke and the poles is modeled with a Brauer curve approximation [43] upon 1010-Steel and implemented in a FE solver with the Newton method [44]. The model is implemented using three open-source tools, namely the mesh generator Gmsh [45], the GetDP FE solver [44], and the ONELAB interface [46].

2.2 Convergence of the finite element discretization

The convergence of the FE discretization of the magnet model is investigated by solving Equation (1) for a repeatedly finer 2D mesh, while for each refinement step the magnetic energy in the computational domain \(\Omega \) is post-processed. Figure 2 depicts the resulting relative error of the magnetic energy over the number of dofs, indicating a first-order polynomial convergence with respect to the number of 2D mesh nodes. For the further results in this paper, the magnetostatic problem is solved with 18665 2D mesh nodes and 9081 triangular elements for each model evaluation of the quadrupole magnet.

2.3 Aperture field quality

One of the most important quantities of interest to be taken into account during the design of a quadrupole magnet is the field quality here represented by the harmonic distortion factor Q, which can be computed upon the multipole coefficients of the calculated field in the magnet’s aperture. The harmonic distortion factor captures the relationship between the desired multipoles such as the quadrupole components, and undesired multipoles such as duodecapole components and higher-order terms. Therefore, Q is a measure for the magnetic field quality of the quadrupole magnet and can be calculated as follows: The FE solution \(a_z\) is evaluated at a reference circle with radius \(r_\text {ref}\). The result is then represented by a Fourier series with Fourier coefficients \(a_p\) and \(b_p\), such that

$$\begin{aligned} a_z(r_\text {ref},\varphi ) = \sum _{p=0}^{\infty }\left( a_p \cos {(p\varphi )}+ b_p \sin {(p\varphi )}\right) , \end{aligned}$$
(5)

using the polar coordinate system \(\left( r, \varphi \right) \). Then, the Fourier characterization of the magnetic vector potential and the magnetic flux density in the beam aperture are given as [1]

$$\begin{aligned} a_z(r,\varphi )&= \sum _{p=0}^{\infty } \left( \frac{r}{r_\text {ref}}\right) ^p \left( a_p \cos {(p\varphi )}+ b_p \sin {(p\varphi )}\right) , \end{aligned}$$
(6)
$$\begin{aligned} b_r(r,\varphi )&= \sum _{p=1}^{\infty }\left( \frac{r}{r_\text {ref}}\right) ^p \frac{p}{r} \left( -a_p \sin {(p\varphi )}+ b_p \cos {(p\varphi )}\right) , \end{aligned}$$
(7)
$$\begin{aligned} b_\varphi (r,\varphi )&= \sum _{p=1}^{\infty }\left( \frac{r}{r_\text {ref}}\right) ^p \frac{p}{r} \left( -a_p \cos {(p\varphi )}- b_p \sin {(p\varphi )}\right) . \end{aligned}$$
(8)

The evaluation at \(r=r_\text {ref}\) for the radial magnetic flux density yields

$$\begin{aligned} b_r(r_\text {ref},\varphi ) = \sum _{p=1}^{\infty } \left( \underbrace{-a_p \frac{p}{r_\text {ref}}}_{B_p(r_\text {ref})} \sin {(p\varphi )} + \underbrace{b_p \frac{p}{r_\text {ref}}}_{A_p(r_\text {ref})} \cos {(p\varphi )}\right) , \end{aligned}$$
(9)

where \(B_p\) and \(A_p\) are called normal and skew harmonic coefficients, respectively. The harmonic distortion factor \(Q(r_\textrm{ref})\) in the aperture of a 2P-pole magnet considered at a reference radius \(r_\textrm{ref}\) can be obtained from the harmonic Fourier coefficients using the formula [1]

$$\begin{aligned} Q_P(r_\textrm{ref}) = \frac{1}{{A}^2_P(r_\textrm{ref})} \sum _{\begin{array}{c} p=1 \\ p \ne P \end{array}}^{\infty } \left( B^2_p(r_\textrm{ref}) + A^2_p(r_\textrm{ref})\right) . \end{aligned}$$
(10)

For a quadrupole magnet \(\left( P=2\right) \), with a quadrupole field gradient

$$\begin{aligned} g(r) = {A}_2(r), \end{aligned}$$
(11)

the magnetic field should be close to a pure quadrupole field, i.e., the field gradient g should be high in comparison with the other multipole coefficients \({A}_p\), with \(p=1,\dots ,C\), and \(p\ne 2\), where C refers to the truncation coefficient. Accordingly, the corresponding harmonic distortion factor for a quadrupole magnet, given by

$$\begin{aligned} Q_2(r_\textrm{ref}) = \frac{1}{g^2(r_\textrm{ref})} \sum _{\begin{array}{c} p=1 \\ p \ne 2 \end{array}}^{C} \left( B^2_p(r_\textrm{ref}) + A^2_p(r_\textrm{ref})\right) , \end{aligned}$$
(12)

should be in the order of \(10^{-4}\) [1].

Table 1 Geometrical parameters of the quadrupole magnet
Fig. 2
figure 2

Convergence of the FE discretization. Four refinements of the 2D FE mesh have been executed, ranging from 990 dofs to 161028 dofs (color figure online)

3 Multi-objective optimization

In MOO, we seek to minimize (or maximize, depending on the problem at hand) a set of—possibly conflicting—objective functions \(f_i(\textbf{x}): \mathcal {X} \rightarrow \mathbb {R}\), \(i = 1,...,k\), \(k \ge 2\), where \(\textbf{x} = \left( x_1,\dots ,x_n\right) \in \mathcal {X}\) denotes the vector of decision variables, equivalently, optimization parameters, and the domain \(\mathcal {X} \subset \mathbb {R}^n\) is referred to as the feasible decision region [22, 23]. For a feasible parameter vector \(\textbf{x} \in \mathcal {X}\), a corresponding feasible objective vector \(\textbf{z} = \left( f_1(\textbf{x}), \dots , f_k(\textbf{x})\right) \) is obtained, where \(\textbf{z} \in \mathcal {Z}\) and \(\mathcal {Z} \subset \mathbb {R}^k\) is called the feasible objective region.

The structure of \(\mathcal {X}\) is induced by a set of constraints applied to the decision variables. In the specific case of geometry optimization, these constraints are often given in the form of bounding box intervals, similar to the ones shown in Table 1, such that \(\mathcal {X}:= [a_1, b_1]\otimes \cdots \otimes [a_n, b_n]\), where \(a_i \le x_i \le b_i\), \(i=1,\dots ,n\). Given this set of constraints, the MOO problem reads

$$\begin{aligned} \min _{\textbf{x} \in \mathcal {X}} \left\{ f_1(\textbf{x}),...,f_k(\textbf{x}) \right\} . \end{aligned}$$
(13)

In most cases, a parameter vector that minimizes all objective functions simultaneously does not exist. It is therefore necessary to have a method of comparing a set of solutions while taking into account the satisfaction of all objectives. This issue is resolved using the concept of dominating solutions. Assuming two parameter vectors \(\textbf{x}, \tilde{\textbf{x}} \in \mathcal {X}\) arising in a minimization procedure, then \(\tilde{\textbf{x}}\) dominates \(\textbf{x}\) if

$$\begin{aligned} f_i(\tilde{\textbf{x}}) < f_i(\textbf{x}) \text { and } f_j(\tilde{\textbf{x}}) \le f_j(\textbf{x}), \forall i,j \in \{1,...,n\},\, i\ne j. \end{aligned}$$
(14)

A parameter vector that cannot be dominated is called Pareto optimal [24]. In essence, Pareto optimality means that the current solution cannot be further improved with respect to one of the objectives, without simultaneously deteriorating another objective. The set of Pareto optimal solutions is referred to as the Pareto front. A Pareto front is bounded by the ideal and nadir objective vectors, respectively, denoted with \(\mathbf {z^*}\) and \(\textbf{z}^{\text {nad}}\). The former is obtained by individually optimizing the objective functions and the latter by approximating the worst objective values of the Pareto front.

3.1 Genetic algorithms

GAs belong to a class of population based, stochastic optimization algorithms which solve optimization problems by only allowing candidate solutions with a promising “gene pool” to reproduce and propagate through generations \(t=1,2,\dots , T\), where T is the final generation [15, 16]. This generation-based evolution of candidates is realized by creating a sequence of subsets \(\mathcal {P}\) in the feasible decision space called populations, which eventually converge to a set of minimizers. In that way, a sequence \((\mathcal {P}_t)_{t\in \mathbb {N}} \subset \mathcal {X}\) with

$$\begin{aligned} \mathcal {P}_t \xrightarrow {t\rightarrow \infty }\mathcal {P^*} \end{aligned}$$
(15)

is generated, such that each \(\textbf{x}\in \mathcal {P^*}\) is a minimizer of (13). To deal with the limitations of realistic and thus finite calculations, Equation (15) needs to be truncated by a final generation T, so that with

$$\begin{aligned} \mathcal {P}_t \xrightarrow {t\rightarrow T}\mathcal {P}_T, \end{aligned}$$
(16)

a set of generation-related minimizers \(\textbf{x}\in \mathcal {P}_T\) is considered.

The sequence of populations \(\left( \mathcal {P}_t\right) _{t=1,2,\dots ,T}\) is dictated by the genetic operators crossover \(C_{\sigma }\), mutation \(M_r\), and fitness selection F, such that

$$\begin{aligned} \mathcal {P}_{t+1}=F\circ M_m \circ C_{\sigma }\left( \mathcal {P}_t\right) , \end{aligned}$$
(17)

where \(\circ \) expresses the concatenation of the sequentially applied genetic operators on the current population \(\mathcal {P}_t\). The indices \(\sigma \) and m, respectively, denote the crossover and mutation rates of the corresponding operators, where \(\sigma , m \in [0,1]\). The crossover and mutation rates determine the probability that the given operator is applied to a given population. The crossover operator \(C_{\sigma }\) describes how sample solutions are recombined to generate new solutions for the next population. The mutation operator \(M_m\) describes random distortions to the elements of a population and is particularly significant for the convergence of the GA, as it ensures that the objective space \(\mathcal {X}\) is searched comprehensively and that the limit \(\mathcal {P^*}\) is initialization-independent. Last, the fitness selection operator F allocates a fitness value to the population members and selects those with the highest values to progress to the next generation.

In this work, simulated binary crossover [47, 48] and polynomial mutation [49, 50] are employed as crossover and mutation operators, respectively. For fitness evaluation, we use the FE model of the quadrupole to compute the magnetic field distribution in the magnet and evaluate the aperture field quality, which in turn determines the fitness of a given population. As a selection operator, we use binary tournament selection [51], due to its ease of implementation and robustness against stochastic noise.

3.2 Non-dominated sorting genetic algorithms & NSGA-III

As noted before, GAs were originally developed to solve single-objective optimization problems. Therefore, they cannot address a number of issues related to MOO, such as dealing with multiple objective functions and ensuring diversity in the populations. These issues have been addressed with the introduction of NSGAs [29,30,31,32]. In this work, we resort to the so-called NSGA-III algorithm [31, 32], which is briefly discussed in the following.

First, NSGA-III deals with the issue of optimizing numerous objective functions by preferentially handling solutions that dominate other members of a population according to definition (14), by using non-dominated sorting. Given the current population \(\mathcal {P}\), non-domination sorting partitions the population \(\mathcal {P}=\mathcal {F}_1\cup \cdots \cup \mathcal {F}_{N-1}\) into disjoint sets \(\mathcal {F}_i\), which form the hierarchy \(\mathcal {F}_1<\mathcal {F}_2<\cdots <\mathcal {F}_{N-1}\). This hierarchy is induced according to a domination factor \(n_p=0,1,...,N-1\), which indicates how many solutions from an equal or lower hierarchy level dominate the given solution. The hierarchy construction is as follows: The set \(\mathcal {F}_1\) includes \(\textbf{x}\in \mathcal {P}\), which have \(n_p = 0\), i.e., they are not dominated by any solution. Then, we consider the set \(\mathcal {Q} = \mathcal {P} \backslash \mathcal {F}_2\) and decrement the domination factor for \(n_p\rightarrow n_p-1\) for all \(q\in \mathcal {Q}\) that are dominated by an element of \(\mathcal {F}_1\). This process is repeated iteratively, thus yielding a hierarchical set sequence. The sets with lower domination factors qualify to the next population, whereas the sets with higher domination factors are discarded. It is thus ensured that that the solutions propagating to future generations are Pareto optimal with respect to the current population they belong to.

To ensure population diversity, NSGA-III adds another operation to the fitness selection procedure. Therein, the objective vectors \(\textbf{z}\) are normalized to the unit cube by using the ideal objective vector \(\textbf{z}^*\) and the nadir objective vector \(\textbf{z}^{\text {nad.}}\). In that way, it is possible to consider objective functions that are scaled differently. Then, reference points on the unit hypercube are chosen, which lie on a simplex [52]. The reference points typically have a space-filling property and the objective vectors are projected to the reference points. The population members are then determined by an explicit diversity-preserving mechanism.

4 Quadrupole magnet optimization

The MOO concerns maximizing the absolute value of the field gradient g, as introduced in Sect. 2.3, while minimizing the outer radius R of the magnet. The optimization parameters are the six geometrical parameters listed in Table 1 and the current density \(\textbf{j}\). The latter takes values within the interval [1.0, 20.0] A/mm\(^{2}\) and in the following is denoted with \(x_7\). Then, the MOO problem reads

$$\begin{aligned} \min _{\textbf{x} \in \mathcal {X}} \left\{ -|g(\textbf{x})|, \, R(\textbf{x}) \right\} , \end{aligned}$$
(18)

where the feasible decision space is \(\mathcal {X}=[a_1, b_1]\otimes \cdots \otimes [a_7, b_7]\).

Instead of optimizing the full 2D magnet model shown in Fig. 1, we exploit the three mirror symmetries of the magnet model in order to reduce it to the one-eighth segment depicted in Fig. 3. This model reduction leads to a significant improvement in terms of the computational cost of the finite element method (FEM).

Besides constraints on the geometrical parameters and the current density, we also introduce constraints on the absolute duodecapole gradient \(g_\text {d}\), as well as on the saturation behavior of the iron yoke of the magnet, which read

$$\begin{aligned}&|g_\text {d}(\textbf{x})| \le |g(\textbf{x})| 10^{-2}, \end{aligned}$$
(19a)
$$\begin{aligned}&\tilde{b}_\text {in} \le b_\text {th}, \end{aligned}$$
(19b)
$$\begin{aligned}&\tilde{b}_\text {out} \le b_\text {th}. \end{aligned}$$
(19c)

Analogously to the quadrupole field gradient g in Equation (11), the duodecapole gradient is given by \(g_\text {d} = B_6(r_\text {ref})\). In any case, the additional constraints demand that the duodecapole gradient \(g_\text {d}\) should not exceed a certain percentage of the absolute field gradient g, as well as that the magnetic flux density entering the pole nose \(\tilde{b}_\text {in}\) and the magnetic flux density exiting the yoke bend \(\tilde{b}_\text {out}\) are bounded by a fixed saturation threshold value \(b_\text {th}\). The magnetic flux densities \(\tilde{b}_\text {in}\) and \(\tilde{b}_\text {out}\) are illustrated in Fig. 3. Both are obtained by post-processing the FE solution \(a_z\).

Fig. 3
figure 3

One-eighth of the 2D quadrupole magnet model (color figure online)

Fig. 4
figure 4

MOO results for three optimization runs, each corresponding to a different saturation threshold \(b_\text {th}\). The arrows show the Pareto front movement from the initial point (\(\times \)) towards the mass point of the final Pareto front ( ✖ ) (color figure online)

Fig. 5
figure 5

Relative skew harmonic coefficients of the Pareto front solutions associated with the highest, i.e., worst harmonic distortion factor for each saturation threshold \(b_\text {th}\), respectively (color figure online)

The solutions to the MOO problem defined by equations (18)-(19) are obtained, as previously noted, using the NSGA-III algorithm. In particular, the implementation of the algorithm which is available in the open-source, Python-based optimization software pymoo is used [53].

5 Numerical results

In this section, the numerical results of the MOO are presented, which are additionally employed to identify the best solutions, i.e., the ones corresponding to the most suitable magnet designs. The notion of the best solution is split into:

  • Best balanced solution, that is, the Pareto optimal solution with the lowest Euclidean distance to the ideal objective vector, where the latter is approximated with respect to the final Pareto front.

  • Best field gradient solution, that is, the Pareto optimal solution found in the final Pareto front, which results in the highest field gradient.

Fig. 6
figure 6

Best solutions (normalized) for different saturation threshold values \(b_\text {th}\). Additionally to the best solutions, the corresponding objective values R and |g| are given. Filled black circles: normalized parameter combinations of the best solutions. Transparent blue-colored circles: normalized parameter combinations of all final Pareto optimal solutions with respect to the different saturation thresholds (color figure online)

Using NSGA-III with a crossover rate \(\sigma = 1.0\) and a polynomial mutation rate \(m = 0.1\), each optimization run is performed for \(T=300\) generations, with an initial population of 80 individuals, and an offspring population of 56 individuals. These empirically enforced values remain fixed during several optimization runs, where the influence of different saturation behaviors of the iron is investigated. To analyze the saturation behavior, three optimization runs are performed, within which the saturation threshold \(b_\text {th}\), which is embedded in the optimization’s constraints as in Equations (19), is selected as 1.0T, 1.2T, or 1.4T, respectively. Each optimization run is performed upon the same feasible decision space \(\mathcal {X}\). The initial point is chosen to be the center point of \(\mathcal {X}\) and represents a naive but admissible choice of geometry with respect to the optimization constraints, see Fig. 4. The associated initial objective values are \(R={0.115}\hbox {m}\) and \(|g|={11.305}{\hbox {T} / \hbox {m}}\). Here, the initial point serves as a reference point to compare the locations of the different final Pareto fronts.

Figure 4 shows the Pareto front movement and the location of the final Pareto front after \(T=300\) generations for the three chosen saturation thresholds. Therein, the Pareto front movement is obtained by connecting the mass points of the fronts obtained from each generation of the NSGA-III, where the mass point is defined as the mean of all Pareto optimal solutions. As can be seen, both the final Pareto front and the front movement depend strongly on the chosen saturation threshold. For \(b_\text {th} = {1.0}{\hbox {T}}\) and \(b_\text {th} = {1.2}{\hbox {T}}\), the final Pareto fronts are biased toward low values of the outer radius R. In contrast, the Pareto front for \(b_\text {th} = {1.4}{\hbox {T}}\) is biased toward high field gradient values. As for the individual evolution of the different objective spaces, Fig. 7 in Appendix shows each of the optimization solutions and their Pareto front movements individually.

Figure 5 depicts the relative skew harmonic coefficients with respect to the quadrupole main component, of the Pareto front solutions associated with the highest, i.e., worst harmonic distortion factor \(Q_\text {max}\) for each saturation threshold \(b_\text {th}\), respectively. Further, it is verified that the Pareto optimal solutions of all optimization runs have a harmonic distortion factor Q below or of order \(10^{-4}\). This observation is consistent with the theoretical requirements for the harmonic distortion factor of a sufficiently undistorted quadrupole field, as mentioned in Sect. 2.3.

Next, focus is shifted to the best solutions of the final Pareto front for each saturation threshold. For a better visual comparison of the best solutions, the parameter combination corresponding to each solution is normalized to the unit cube \(\mathcal {X}_\text {norm} = [0, 1]^7\). Using this normalization, the parameter distributions and the associated objective values of the best solutions are depicted in Fig. 6. As can be observed, the saturation threshold has a strong influence on the magnet’s pole width, both for best balanced and for best field gradient solutions. This is attributed to the fact that higher saturation thresholds lead to a larger pole width design. It is further observed that larger pole widths lead to higher field gradients for both cases of best solutions. The saturation threshold has also a slight to moderate influence on the pole bending design. With regard to the current flow, it can be seen that, for both best solution cases, higher saturation thresholds allow higher current densities, as expected. In the case of the best balanced solutions (Fig. 6a), it is observed that changes in the saturation threshold have almost no impact on the dimensions of the pole height, yoke height, and the shim geometry. Contrarily, the dimension of the pole height is more important in the case of the best field gradient solution, as can be seen in Fig. 6b. Additionally, the choice of the shim geometry seems to be more important for best field gradient solutions than for best balanced solutions.

Fig. 7
figure 7

Pareto front movements for each saturation threshold. Colored points: Pareto fronts for different optimization generations. Gray arrow: Pareto front movement from the initial point (\(\times \)) to the mass point of the final Pareto front ( ✖ ) (color figure online)

6 Conclusion

This work presented a framework for optimizing predominantly the geometrical and secondarily the operational characteristics of a quadrupole magnet. The framework employs a MOO formulation, where two conflicting objectives must be satisfied, namely high magnetic field quality and acceptable production cost. The MOO problem is solved by means of the so-called NSGA-III algorithm, which is a GA suitably modified to address the issues arising in MOO. Therein, a magnetostatic FE model of the magnet is employed in order to assess the quality of the magnetic field in the aperture of the magnet. Finally, the MOO problem is complemented with additional constraints on the duodecapole gradient and the saturation threshold of iron.

The numerical results indicate that saturation has a major impact on the obtained Pareto optimal solutions. Further analyzing the connection between optimization parameters and Pareto fronts, it is possible to deduce useful information regarding the impact of the different geometrical characteristics of the magnet onto the optimization objectives. Importantly, all identified optimal magnet designs lead to a sufficiently low harmonic distortion factor, while it is possible to identify designs with an acceptable balance between field quality and production cost.

Future work should consider the utilization of a 3D magnet model, in order to consider fringe field effects during MOO studies. The impact of eddy currents and power losses should also be taken into account. As a result, MOO problems with \(k>2\) objectives can be formulated and investigated, leading to even more improved magnet designs. To limit the computational burden of MOO, especially for an increased number of objectives, surrogate modeling approaches could be considered [54].