USING GENETIC ALGORITHMS FOR COMPENSATING THE LOCAL MAGNETIC PERTURBATION OF A SHIP IN THE EARTH’S MAGNETIC FIELD

This paper shows a practical application of genetic algorithms (GAs) for compensating the local magnetic perturbation produced by a ship, while moving in the earth’s magnetic field. The compensation is achieved by modifying the number of turns and the current magnitude across the so-called degaussing coils distributed along the ship. A GA scheme for automatic optimisation of these parameters is used. A new objective-function strategy, called a boundary method, is proposed. It is shown that the convergence of the GA is greatly improved when the new objective function is used. Different selection mechanisms, objective function strategies, and scaled methods are revised in this paper. The results show that GAs can be efficiently used to reduce drastically the magnetic field levels of real practical ships. © 2005 Wiley Periodicals, Inc. Microwave Opt Technol Lett 47: 281–287, 2005; Published online in Wiley InterScience (www.interscience.wiley.com). DOI 10.1002/mop.21147


INTRODUCTION
In a ship, a degaussing system consists of several coils distributed along its structure. They are used for compensating the local magnetic perturbation introduced by the ship while moving inside the earth's magnetic field. If very low levels of the magnetic field are allowed, the whole procedure becomes very time consuming, since very precise values for the currents and for the number of turns in each coil are needed [1].
In general, the procedure for minimizing the magnetic anomalies created by ships is based on experiments [1][2][3][4], especially due to external factors that influence the process [5][6][7]. In any case, these experiments rely on the availability of a fast-optimization algorithm, which must calculate the values of the currents and number of turns needed to produce a magnetic field, which is able to compensate the magnetic field created by the ship. The whole procedure is carried out in an iterative fashion, in which the measurement of the magnetic field is firstly taken. Then, a first set of parameters (currents and turns) is computed for compensation. With this set of parameters, new measurements are taken, which are again compensated with the next set of parameters.
In this paper, we present a novel method based on genetic algorithms (GAs) in order to obtain the value of the parameters needed for each compensation in such an iterative algorithm. GAs have been widely used in many optimization problems involving a wide variety of applications. These applications range from the optimal design of magnetostatic devices to the design of complex antenna arrays and other radiofrequency circuits [8]. However, to the authors' knowledge, this is the first time that GAs have been used for the calibration of the magnetic-field perturbation in a ship. Different selection mechanisms, objective-function strategies, and scaled methods are investigated, and their advantages and drawbacks are outlined, including the convergence rate attained with each option.
A new objective-function strategy, that we call a boundary method, is proposed in this paper. This new objective-function strategy is based on the minimization of peak boundary values, rather than on the minimization of the energy created by a given perturbation. By minimizing the energy, one introduces ripple around the objective function in the optimization process. This ripple introduces serious errors while computing cross-coupled magnetic-field components, therefore leading to a slower convergence of the iterative process. It is shown in this paper that with the use of the new objective-function strategy, this ripple is reduced, thus greatly enhancing the convergence rate of the iterative procedure. In addition, the minimization of the energy leads to fast variations of the magnetic-field gradient. The strong variations of the gradient are not desired in many applications, as for instance in mining detection. On the contrary, the use of the new objectivefunction strategy is shown to lead to very low variations of the magnetic-field gradient, which is suitable for these critical applications.
In addition, a commonly used practice for optimization is to define an objective function to be maximized (or minimized) for the sought-for solution. In our work, we have introduced a novel inverse scaling function of the so-called fitness procedure [9]. This newly introduced inverse scaling factor avoids the problems of overflow that can occur when using inverse functions for optimization. The results obtained show that the derived techniques are very efficient, and can be used for a fast and effective calibration of the magnetic-field perturbation in a real ship. The results also show that with the novel techniques, lower magnetic fields are obtained, as compared to other standard optimization procedures.

MAGNETIC COMPENSATION IN A SHIP
We can consider a vessel to be formed by a series of magnetizations oriented following the three axes in space and referred locally to the ship (longitudinal, vertical, and transversal, see Fig. 1).

Figure 1
Geometrical axis in the ship used to describe magnetic-field components Consequently, with respect to this local system, we can refer to the magnetic-field components as vertical, longitudinal, and transversal. In addition, we can distinguish between permanent and induced magnetization, which affect the ship. The permanent magnetization is due to the magnetic material of the ship (hull, motors, and other ferromagnetic materials), and its components do not change direction with respect to the local reference axis [1]. In a similar way, this ferromagnetic material induces other magneticfield components due to the movement of the ship inside the earth's magnetic field. These components of the field are called the induced magnetization. Due to this complex magnetic-field distribution, a degaussing system (SDG) has vertical, longitudinal, and transversal coils for compensating the permanent magnetization, and it has similarly oriented coils for compensating the induced magnetization. The magnetic compensation is achieved by applying the equilibrium currents to this set of SDG coils.
To initiate the compensation, an initial situation must be established. Normally, this initial situation is obtained by measuring the magnetic flux density with the degaussing system disconnected. Alternatively, the initial situation can be obtained from a previous calibration. In any case, the total magnetic flux density produced by the ship at a given instant is due to the initial magnetization plus the magnetic flux density produced by the Degaussing system, given by is the total magnetic flux density of the ship for a given heading p , measured by a set of magnetic sensors oriented into the s direction and placed at depth z 0 . Moreover B ជ Ј[S] h(p,s) ( x, y, z 0 ) is the initial magnetic flux density of the ship, and B ជ [B] SDG h,L o is the magnetic flux density produced by the SDG coils. Taking into account the permanent and induced magnetization, the first term in this expression can also be written as where we have split the total magnetic field into two main contributions. The first one is due only to the peak value of the magnetic flux density produced by the permanent and induced magnetization [{␤ Sm }] L o h(p , s ). The second one, B ជ {M Sm }( x, y, z 0 ), is dependent on the heading of the running of the ship, the orientation of the set of magnetic sensors, and the geographical zone where the measurements are taken.
The second term in Eq. (1), B ជ [B] SDG h,L o , is the magnetic flux density produced by the degaussing coils for a heading h in a specific zone L o of the earth. This last term can be best written by separating the effects of the coil currents, the number of turns in the coils, and the variations of the induced magnetic field. The variations of the induced magnetic field can be due to a change in the heading of the ship and a change in the zone of the earth where the ship is moving: The problem of the magnetic compensation of a ship is reduced to the adjustment of the values of the number of turns n ks and current amplitudes i ks of the coils, so as to minimize the total magnetic field of the ship in its influence area. In this work, we propose using a new GA to optimize n ks and i ks for this purpose. The total objective function to be minimized can be expressed as where GA[n KS , i KS ] represents the number of turns and current amplitudes in each coil, calculated through optimization using the GA.

DEGAUSSING COMPENSATION USING GENETIC ALGORITHMS
GAs are searching algorithms that use the basic principles of natural evolution. These algorithms have proved to be very efficient, for instance, in the optimization and design of electromagnetic devices [8,10,11]. In this section, we show an application for compensating the magnetic field of a ship using the degaussing system described in the previous section. The GA is based on an initial population, which is created randomly. The evolution of the generations is controlled by three fundamental operators, namely, selection, cross, and mutation [2,6,8,10,12]. The operator "selection" chooses the parents for the next generation according to their fitness. The cross operator is used to interchange the genetic code between the selected parents. Finally, the mutation operator changes a given gene of one of their possibly alleles. The probability of mutation is less than the cross probability. Both operators change the chromosomes, hence producing new ones which will be used to replace the old population. The algorithm finishes when a given convergence condition is reached.
One of the difficulties associated with the implementation of the GA is determining the structure of the variables that will be used to represent the values of the parameters involved in the optimization. For our problem, we use a structure based on binary words. To encode the values of the currents and the number of coils, a binary alphabet of finite length is proposed. The length of each variable is fixed using the maximum and minimum possible values of the associated parameters, together with the desired precision (number of relevant digits allowed by the magneticcompensation system). The length of the chromosomes of the population is thus specified as where Str 2 [n KS ] is the length of the binary variable that codifies the number of turns for coil KS (K can be vertical, horizontal, or longitudinal, and S can be permanent or induced). In a similar way, is the length of the binary variable that codifies the value of the current for coil KS.
All the binary chromosomes are initially generated randomly, and then they evolute according to the implemented GA. For each new generated population, the stream of bits must be decoded in order to obtain the real values of all the associated variables. This is accomplished with the following simple algorithm: ; l pks ϭ l nks , l iks (6) where Dec{[Str 2 ] i } is the decimal value of the binary substring associated with one of the variables, l pks is the binary length of the variable ( p: turns or current; k: vertical, longitudinal, or transversal; s: permanent or induced), and min, max are the minimum and maximum values allowed to this variable, respectively. To increase the convergence and thus avoid strong differences between the individuals in the population, a scaling method of the fitness function is used. In addition, we use the scaling function to select the minimum of the objective function, instead the traditional maximum of a natural selection (best individual). This is accomplished by applying an inverse mechanism to the scaling method. In the implemented inverse mechanism, we have avoided the computation of the inverse of the objective function, since it leads to numerical instabilities for small values. Instead, we have used the difference between the objective function and its fitness. The scaling functions that we have developed in this paper are based on other well-known techniques such as sigma-truncated, linear, and exponential methods [12,13].
To show the usefulness of using inverse scaling instead of the inverse of the objective function, we have run an initial experiment for the degaussing of a ship. The magnetic field obtained after optimization using GAs is presented in Figure 2, where both strategies are applied. We can observe in the figure that both results are satisfactory, although the inverse scaling technique leads to a more uniform solution with less gradient.
The linear inverse scaling shown in Eqs. (7)-(9) that we have developed is based on distributing the fitness of all individuals linearly. When we apply the inversion concept, the best-fitted individual produces the minimum difference between the objective function and the fitness (the minimum). This scaling function is based on the definition of two fixed parameters, the average () and the minimum ( f min ), which are kept constant before and after the scaling. The average is constant throughout the scaling process, and the minimum is proportional to this average. Moreover, f max is the maximum value of the objective function. The scaling procedure modifies the fitness of each individual in the following way: where c is a slope parameter that takes a value between 1.2 and 2 [12], and fЈ is the new computed inverse fitness. The inverse-sigma truncated-scaling technique eliminates all individuals whose fitness (ability to adapt to the environment), is greater than the average plus one, or alternatively, greater than a few typical deviations. The inverse mechanism, then, selects the individuals that produce a minimum difference between the objective function and fitness. This scaling procedure is more radical than the previous one. The members that can prosper suffer a change in their fitness capability, following a linear pattern with Ϫ45°slope. This algorithm can be mathematically written as where, again, C is a constant parameter (evaluated empirically) that usually takes a value between 1 and 3 [12]. Finally, the exponential inverse scaling is similar to the one presented in [14], but using a negative exponent in the fitness function fЈ ϭ f Ϫk .
In order to create a new generation from a previous one, a selection mechanism is used. It is based on the fitness of an individual with respect to the average fitness of the whole population. This factor will establish the number of genetic copies of this individual, which will be present in the next generation. The two mechanisms of selection of individuals used in this paper are the so-called roulette wheel and its derivative, called tournament [12].
In the roulette-wheel selection method, each individual has a probability of adaptation to the environment, which depends on the fitness of the population [13,15]: where (I i ) is the fitness of the individual I i , and ¥ jϭ1 n (I i ) is the fitness of the population (n individuals). The selection procedure is completed by generating a random probability P random . A given individual (I r Ϫ 1) is selected, when the sum of the probabilities of all the individuals up to this one (I r Ϫ 1) is less or equal than the random probability P random and, in addition, the sum of the probabilities of all the individuals up to the next one (I r ) is greater than this random probability. This selection mechanism is given by Also, the tournament selection method is based on the previous method. Now the algorithm selects two individuals consecutively using condition (12), and then it rejects the worst of them.
The operators that can be used to affect the evolution are as follows.
• Cross: with this mechanism, chromosomes change the genetic information between parents. This operator simulates the process of recombination of natural evolution. In this study, we use only one point of cross. The probability of cross is fixed between values from 0.6 to 0.9 [8]. • Mutation: the mechanism of mutation produces a variation of some particular genes of the individuals of the population. In our study, we use a mutation parameter, so that one gene is always altered for each chromosome of one generation [8,16].
Once a new generation of individuals is created, its fitness is calculated. We have studied two methods for this purpose, namely, the minimum-square [6,17] and boundary methods. The minimum-square fitness is calculated according to where F is the calculated fitness of each individual of the population, B desired,m is the value at point m of the objective curve, and B calculated,m is the value at point m of the calculated curve using the parameters of this individual. Using these parameters, the boundary-method fitness will be calculated according to From the two explored methods, the boundary method (14) is especially well-suited for the problem studied in this paper. It is based on calculating the fitness function after one evolution, in such a way that it will not generate ripple around the objective function. In this way, we can assure that the fitness function will approach, in a smooth way, to the objective function. The particular formulation that we have used in our problem can be stated as follows: For each point of the calculated function of an individual of the population, an ␣ factor is estimated. The maximum value of all ␣ will be used to multiply the value of all the parameters (genes) of the chromosomes of each individual of the population. In this manner, we assure that the calculated function will always remain below the objective function, thus providing a smooth convergence. We call this technique boundary method, and it is an important contribution of this paper. The GA mechanism described above can be effectively applied to the degaussing compensation of a ship. For this application we have used the so-called simple genetic algorithm (SGA) [12]. In this algorithm, the number of individuals of the population produces the same number of individuals in the next generation. Before the process of magnetic compensation can start, two main parameters must be adjusted in order to define the binary chromosomes. These are the maximum values of the currents and turns, and their precisions. Once this is fixed, we have to choose the selection and scaling mechanisms, as well as a suitable definition of the objective function.
The first step in the process is to generate the initial population randomly. This is done using binary strings, which are generated randomly to form the chromosomes of the individuals of the initial population. This string will have a length that is dependent on the number of variables, and on their possible values or constrains. Once a population of individuals is generated, the fitness is calculated using Eq. (10) or (11). The method that has shown to lead to the best results for the problem at hand is the boundary method. This is at the end the solution adopted by the authors for the efficient treatment of this kind of problem. The fitness of each individual is then scaled to obtain two main objectives, namely, the improvement in the convergence and the inversion of the objective. Using this strategy, we respect the evolution mechanism, but we invert the fitness. The scaling methods investigated in this work are the linear-inverse, truncated-sigma-inverse, and exponentialinverse methods, all of them related to the original definition given in [12].
When the population is scaled, two individuals are selected. These selected individuals will be the parents of a future generation. For selecting the individuals, we have used the roulette-wheel and tournament methods previously explained. From these two, better results were obtained using the last one (tournament). The selected parents, then, reproduce to create the next generation through two basics operations, namely, cross and mutation. The mutation probability used in this problem is P mut ϭ 1/Population Size [8], where the size of the population is the binary length of the chromosome [16]. The combination of the alleles of the parents is made using the method of crossing in only one point, with a probability of 0.6 for all generations and individuals. This procedure updates the population completely, and it is repeated for each new generation. The algorithm finishes when a convergence condition is reached.
We have to keep in mind that in practice, the magnetic compensation of a ship is an iterative process. In each new iteration, a measurement of the total magnetic field is taken, using the information obtained from the implemented GAs. The values of the currents and the number of turns will be corrected, at each new iteration, in an incremental way. In this form, the errors in the measurements will be less influenced as the calibration process evolves. The overall magnetic-compensation algorithm of a ship is shown in the diagram of Figure 3.
The iterative magnetic-calibration process of a ship shown in Figure 3 can be expressed mathematically in the following form: where B ជ Ј[S] SDGON h( p,s) ( x, y, z 0 )͉ nϩ1 is the magnetic-flux density of the ship at the next (n ϩ 1) iteration. Moreover, B ជ [B] SDG h ͉ n is the magnetic-flux density measured at the current (n) iteration. Finally, ⌬B ជ [B] SDG h ͉ nϩ1 is the increase of the magnetic-flux density, produced by the SDG coils, necessary to reduce the magnetic perturbation of the ship.

RESULTS
The GA-based method developed in this paper has been successfully applied to the magnetic compensation of ships. We now present the results obtained when the algorithms are applied to the magnetic compensation of a specific ship whose magnetic signature is calculated using a finite-elements technique (FEM) [3][4][5]18]. Initially, the magnetic-compensation system of the ship is turned off, so that the starting point is the natural magnetic field produced and induced by the ship. It is this natural magnetic field that we want to compensate with the degaussing coils of the ship.
For this test, we use a vertical sensor, with headings for North and South magnetics (not geographic). With the vertical sensor and this heading, we cannot measure the transverse component of the induced magnetization. In addition, if we only use the keel signature, then the transverse component of the permanent magnetization will be zero. All other components of the induced and permanent magnetization are measured using this vertical sensor. From all these components, we split the problem in two different parts. First we apply the GA algorithm to compensate the vertical induced and permanent magnetizations, together with the longitudinal permanent magnetization. Second we solve for the longitudinal induced magnetization. The results that we present here refer to the first case. The behavior of the compensation algorithms for the second case is very similar, and it is not presented for the sake of space.
Firstly, we show the usefulness of the new boundary method proposed in this paper for the minimization of the objective func-tion strategy. In Figure 4, we show the convergence results obtained in a typical degaussing-compensation procedure for a ship. It is clearly shown that convergence is faster when the new boundary method is used, as compared to a classical minimumsquare procedure. For comparison, the square scale has been converted to a linear scale so as to allow for a direct comparison of both results on the same graphic. In addition, it can be seen in the figure that the final solution obtained with the novel boundary method is better by more than 50% than the final result obtained with the classical minimum-square procedure. This results show that a considerable improvement can be achieved in the overall magnetic-field compensation obtained for a real ship.
For this numerical test, we use the tournament-selection mechanism and inverse-truncated-sigma scaling method with constant C ϭ 3. Similar results have been obtained with other selectionmechanism and scaling methods. The value of C ϭ 3 with the tournament-selection mechanism and inverse-truncated-sigma scaling method is found to be the optimum value in this context, as is shown below.
The GA algorithm is applied to the proposed problem for different selection mechanisms and different scaling functions. In each case, the combination has been tested for different values of   • LIRWC-c: inverse lineal scaling with roulette-wheel selection mechanism (for this combination, the optimum parameter yields C ϭ 2.5); • LITC-c: inverse lineal scaling with tournament-selection mechanism (for this combination, the optimum parameter also yields C ϭ 2.5); • EIRWC-c: inverse exponential scaling with roulette-wheel selection mechanism (for this combination, the optimum parameter yields C ϭ 0.004); • EITC-c: inverse exponential scaling with tournament-selection mechanism (for this combination, the optimum parameter yields C ϭ 0.003); • TSIRWC-c: inverse truncated sigma scaling with roulettewheel selection mechanism (for this combination, the optimum parameter yields C ϭ 2.5); • TSITC-c: inverse truncated sigma scaling with tournament selection (for this combination, the optimum parameter yields C ϭ 3.0). Figure 5 shows a comparison of the convergence results for the optimum scaling constant in each of the explored techniques. It can be seen that all techniques reach convergence with less than 40 generations. However, the inverse-truncated-sigma scaling with tournament selection for C ϭ 3.0 converges faster than any other technique. In Figure 5, we can see that the error produced by this technique is always lower than that for the others, including the final attained error. This technique will, therefore, produce the lowest possible compensated magnetic field. Figure 6 presents the initial magnetic-flux density of the ship, and compares it with the magnetic-flux density obtained after compensation using the novel GA technique, employing the new boundary method. The figure also shows the results obtained using a standard Newton-based optimization method, and with a GA method using a standard minimum-square objective function. We can see that a 50% reduction in the final magnetic-flux density is obtained, as compared with the standard gradient technique. A further 80% reduction can be observed between the GA algorithm using the standard minimum-square objective function, with respect the improved novel GA which incorporates the new boundary method.
If we compare the final magnetic-flux density with the initial magnetization of the ship shown in Figure 6, we can observe a reduction in the peak value of more than 25 times the initial value. As seen in Figure 6, the maximum peak value obtained for the magnetic-flux density after compensation is of only 35 nanoteslas (the initial maximum values were as large as 1010 nanoteslas). This represents a very good figure for most applications, where a reduction in the magnetic perturbation results to be critical.
In addition, the algorithm led to a reduction in the magneticfield gradient of 60% with respect to the initial signature. The initial gradient is shown in Figure 7, together with the gradient obtained using the GAs. The computations show the gradient when the GA is combined with both the minimum-square and the novel boundary-method objective functions. We can observe that the minimum-square strategy leads to a reduction in the magnetic-field level (Fig. 6), but it cannot properly reduce the gradient of the initial solution, as shown in Figure 7. On the contrary, it is clearly observable in Figure 7 the great improvement obtained in the gradient when the boundary-method strategy is employed.

CONCLUSION
In this paper, we have derived a GA for optimizing the value of the currents and turns in a degaussing system for compensating the magnetic perturbation of ships. We have derived a novel objective function, different from the standard minimum square, that we call a boundary method. The novel technique avoids the ripple usually present when the minimum-square method is applied in optimization algorithms. This new objective-function strategy is based on the minimization of peak boundary values rather than the minimization of the energy created by a given perturbation. Several scaling and selection mechanisms have been tested for different scaling constants for the magnetic compensation of a real ship. Inverse-truncated-sigma scaling with tournament selection for a scaling constant equal to 3.0 has been shown to be the most efficient one. With the novel proposed technique, a reduction in the final magnetic-flux density of more than 90% with respect the initial value is obtained. In addition, the algorithm leads to a reduction in the gradient of 60% with respect to the initial signature.

Figure 7
Comparison for the gradient between the initial keel signature, the GA results using the minimum-square objective function, and the GA results using the boundary-method objective function, after 40 generations.
[Color figure can be viewed in the online issue, which is available at www.interscience.wiley.com.]

INTRODUCTION
Since the Federal Communications Commission (FCC) released the commercial use of UWB radio system [1], many researchers have been paying much attention to modern indoor radar applications. For the reliable use of these radar services, the development of UWB antennas operating from 3.1 to 10.6 GHz is inevitable. To satisfy such a requirement, various wideband antennas have been studied [2][3][4]. Among the many possible alternatives, printed monopole antennas have been extensively investigated because of their attractive features such as light weight, simple structure, and ease of mass production. However, due to the size limitation, additional efforts to miniaturize the total antenna size are needed to incorporate an antenna inside portable terminals such as PDAs, laptop computers, and so on.