Swarm-Inspired Algorithms to Optimize a Nonlinear Gaussian Adaptive PID Controller

: This work deals with metaheuristic optimization algorithms to derive the best parameters for the Gaussian Adaptive PID controller. This controller represents a multimodal problem, where several distinct solutions can achieve similar best performances, and metaheuristics optimization algorithms can behave differently during the optimization process. Finding the correct proportionality between the parameters is an arduous task that often does not have an algebraic solution. The Gaussian functions of each control action have three parameters, resulting in a total of nine parameters to be deﬁned. In this work, we investigate three bio-inspired optimization methods dealing with this problem: Particle Swarm Optimization (PSO), the Artiﬁcial Bee Colony (ABC) algorithm, and the Whale Optimization Algorithm (WOA). The computational results considering the Buck converter with a resistive and a nonlinear load as a case study demonstrated that the methods were capable of solving the task. The results are presented and compared, and PSO achieved the best results.


Introduction
In recent years, a significant amount of research has focused on solving optimization problems without any prior knowledge [1,2]. Due to the multiple characteristics of real world problems, such as non-linearity, discontinuity, multimodality, non-differentiability, and so on, traditional mathematical techniques based on derivatives of the gradient may be insufficient for the posed challenges [3].
When dealing with optimization problems, the agents in metaheuristics roam in the search space to obtain good solutions using experimental and local information [15]. The choice of which one performs better depends on the application problem [2,5,9,12,16]. The objective of this work is to analyze the behavior of three bio-inspired optimization algorithms for searching for optimal solutions for a multimodal problem as represented

Particle Swarm Optimization (PSO)
In the last two decades, the literature has proven the robustness of Particle Swarm Optimization (PSO) in solving continuous non-linear optimization problems [2,6]. The algorithm emulates the behavior of the social activities of animals, for example, insects, birds, and so on [31]. PSO can produce high quality solutions with small computational effort and can present more stable convergence characteristics compared with others stochastic methods [32].
In PSO, the agents are named particles, and they represent the candidate solutions. They are conceptual entities that constitute a swarm that flies through a multidimensional search space [33]. At any time t, each particle has a different position x t and a speed v t , which are both influenced by its own best position achieved thus far (pbest-personal best) and the best neighbor's position (gbest-global best) [34]. Therefore, the new position of particle p is updated according to Equation (1): In the same way, the velocity of particle p is updated as given by Equation (2): where • v t : the current particle velocity; • ω t : the inertia constant, set at 0.9; • x t : the position of all particle from previously looping; • k 1 : the cognitive coefficient; • k 2 : the social coefficient; • r 1 and r 2 : the randomness factors generated from a uniform distribution, in the range between 0 and 1; • pbest: the best position of each particle (personal best); and • gbest: the best global position among all particles (global best).
Algorithm 1 presents the steps involved in the PSO development.

Artificial Bee Colony (ABC)
The Artificial Bee Colony (ABC) algorithm was proposed by Karaboga in 2005 [36]. Currently, it is one of the most prominent swarm-inspired methods for optimization.
The quality (fitness) of a food source is biologically inspired by the amount and quality of the nectar in a flower. The population of the food source is the agents, representing positions in the search space (candidate solutions). The artificial bees are, indeed, the metaphor for the optimization mechanisms (operators). The bees induce the exploration of different areas of the search space, and a selection process guarantees the exploration of previous experiences [7,37].
To run ABC, it is necessary to perform an initialization stage. After, three kinds of operators are used: employed bees, onlooker bees, and scout bees [38].

Initialization Stage
An agent in ABC (food sources) is an attribute vector x containing the D parameters (dimensions) of the current problem. The initial population is distributed in a uniform and random way, as described in Equation (3): such that min and max are the lower and upper limits of j (j = 1, 2, . . . , D)or the bounds of each parameter of the initial solution x i (i = 1, 2, . . . , NS 2 ), and NS is the total number of food sources.

Employed Bee Stage
The employed bee stage seeks new food sources in the neighborhood of the current solutions. If a better source is found, we apply a greedy selection among the new and the old solutions, considering their quality or fitness value. The new candidate solution v ij provided by an employed bee is generated according to Equation (4): where v ij is the new candidate to replace x ij , k ∈ 1, 2, . . . , NS 2 and j ∈ 1, 2, . . . , D are the indexes chosen randomly, with k = i, and φ ij is an aleatory value between [−1; 1].

Onlooker Bee Stage
In nature, employed bees exchange information about the quality and position of a food sources with the onlooker bees through the "waggle dance", sharing information on the aptitude and nectar. This idea is used in ABC in the sense that the onlooker bees choose a food source to explore based on its fitness value. The source is selected considering a roulette wheel scheme, as in Equation (5): The highest probability of aptitude updates the position of the employed bees; mathematically, this can be calculated by (5): where P i is the probability of selecting the source x i , and f it i is the fitness value of x i . Therefore, the onlooker bees tend to select the food sources with high fitness values. Once again, the new solutions provided by this operator are given by Equation (4).

Scout Bee Stage
The scout bee stage begins the search when the current food source in the population runs out. This situation arises when a food source is abandoned and its position is not updated by the predetermined number of cycles defined by the variable ABANDON_LI MIT.
The employed bee associated with the abandoned source becomes a scout bee, which generates a new random source in the environment. The new solution is given by (3).
Finally, the pseudocode in Algorithm 2 illustrates the ABC procedure and how its structure is performed [37].
Algorithm 2 Artificial Bee Colony-Pseudocode 1: Initialize a bee swarm with N employed and onlooker bees 2: Initialize a random clustering for employed bees and compute the cluster center matrix. 3: Compute fitness values. 4: If the number of scouts exceeds MAX_SCOUTS, make the employed bees with the worst fitness as scouts and the rest as employed. 5: Apply random update to employed bee. If fitness has improved, update the cluster centers. 6: Set the solution (cluster center matrix) for each onlooker bee by choosing a solution from the employed bees with probability proportional to its fitness. 7: Apply random update to each onlooker. If the fitness improves, update cluster centers. 8: Make the employed bees scouts for which ABANDON_LI MIT has been reached. 9: Remember the best solution. 10: Go to 3 and repeat MCN times. Adapted from [39]

Whale Optimization Algorithm (WOA)
The Whale Optimization Algorithm (WOA) was proposed by Mirjalili and Lewis in 2016 [40]. This algorithm mimics the unique foraging behavior of humpback whales when capturing prey. This process is called the bubble feeding method [41]. These whales hunt their prey close to the surface by creating bubbles along a path.
According to [42], humpback whales adopt two maneuvering techniques associated with bubbles called upward spirals and double loops. In the first maneuver, they dive into the water about 12 m deep, and then start to make a wave of bubbles in a spiral shape surrounding the prey. Finally, the whales swim quickly toward the surface to hunt. The second maneuver includes three different stages: the coral loop, lobtail, and capture loop [42].

Encircling Prey
Humpback whales recognize the location of prey and encompass them. The WOA assumes that the position of the whales (agents) is x i ∀ i = 1, 2, . . . M, in which M represents the number of whales that are randomly initialized in the search space. Thus, the algorithm assumes that the best current candidate solution is the target prey or it is close to optimal. After that, the best agent is assigned, and the other agents update their positions considering the best solution x best , as in Equations (6) and (7) [40]: where A and C are coefficient vectors, calculated by Equations (8) and (9); where a is linearly reduced from 2 to 0 over the iterations, and r is a random vector in the interval [0, 1].
The vector x best must be updated every iteration. The feeding behavior using a bubble-net has two steps called the exploration phases [40,43].

Bubble-Net
In the bubble-net phase, humpback whales adopt two mechanisms to chase prey, which can be explained mathematically as follows: • Shrinking encircling mechanism: A decrease in the value of a in Equation (8) controls the shrinkage mechanism. Then, the whale positions are updated according to Equations (6)-(9); • Spiral updating position: The following steps perform the simulation for this behavior: 1.
The distance between the current position x and the best solution x best is calculated; 2.
The propeller-shaped movement of humpback whales is imitated by creating a spiral equation as in (10) [44]: x t+1 = D · e bl · cos (2πl) + x best (10) where D = |x best − x t | indicates the distance of the i-th whale to the prey or best solution obtained so far, b is a constant to define the shape of the logarithmic spiral, l is a random value drawn in the interval [−1,1], and (·) is the elementby-element multiplication.
According to the previous equations, humpback whales move toward the prey with two different types of movements simultaneously: where p is a random number in [0,1].

Search for Pray
The humpback whale also searches for prey randomly to realize exploration, updating their positions according to a candidate chosen at random. Mathematically, if A > 1, the candidate agent moves away from the reference point performing a global search, as described in Equations (12) and (13) [44]: where x rand is a random position vector in the current population. In WOA, the parameter A is used to smoothly switch between the exploration and exploitation phases. In addition, the parameter p controls the alternation between the two types of whale movement "spiral or circular movement" [40]. The pseudocode Algorithm 3 presents the steps of the WOA.

Algorithm 3 Whale Optimization Algorithm-Pseudocode
1: Initialize the whale population x i (i = 1, 2, . . . , n) 2: Calculate the fitness of each search agent 3: x best = the best search agent 4: for t = 1 : maximum number of iterations do 5: if (p < 0.5) then 6: if (|A| < 1) then 7: Update the position of the current search agent by Equation (6) 8: else 9: if (|A| ≥ 1) then 10: Select random search agent (x rand ) 11: Update the position of the current search agent by Equation (13) 12: end if 13: end if 14: else 15: if (p ≥ 0.5) then 16: Update the position of the current search agent by (10)   17

Gaussian PID Controller
Throughout history, several methods for control have been introduced [45,46]. However, none of them have had greater prominence than the traditional Proportional, Integral and Derivative (PID) controller, which was created in the 1940s and is now used by most industries due to its efficiency and robustness and well-known design methodologies [47].
Although there are more efficient techniques than PID, often the complexity of implementation and adjustment is higher. One such technique involves adaptive control and adapts the system parameters according to its state. To improve the performance of the traditional PID controller, Kaster [48] proposed an adaptive controller based on Gaussian functions. In this case, the PID gains are adapted according to Gaussian functions of the input error. It is a smooth function with smooth derivatives, which also provides smooth transitions for the gains. This concept avoids abrupt gain transitions, a characteristic of some types of adaptive controllers, which may cause repetitive chattering in the gains if the error tends to be in the vicinity of the transition threshold leading to stressing the controller and shortening its lifetime.
The Gaussian is an uniform function with two output thresholds: one for large values of the input signal and the other for small values. Its concavity is adjustable and allows to establish how closed or opened a Gaussian curve must be [19]. The function is defined in Equation (14): where λ 0 and λ 1 are the upper and lower limits of the function and q defines the degree of concavity, as seen in Figure 1. The curve is facing up or down depending on who is greater, λ 0 or λ 1 .
The controller has three Gaussian functions, one for each adaptive PID gain. It is reasonable to consider the lower bound of parameter λ 0 of the derivative gain as zero, which results a null derivative gain when the system operates at steady-state, helping to avoid noise amplification issues in the control action due to the derivative component. Then, the overall problem comprises eight parameters to be defined.
Puchta et al. [17] reported the use of a new set of parameters, referred to as Linked Parameters that lower the rank of the parameters by tying the adaptive parameters to the linear PID gains. Then, the parameters have the same design references as a previously designed PID but enhance its performance. This results in a six-parameter problem. Here, the linked rule is modified by putting parameters x, y, and z in log scale, which is better if, during the optimization process the Gaussian function needs to revert its concavity. The linked parameters are defined in Equations (15)- (19).
where K P , K I , and K D are the PID reference gains. The agent vector turns into vec = {x, y, z, q P , q I , q D }.

Buck Converter
The DC-DC Buck converter is a typical power electronic converter topology employed in power supplies for most electronic equipment, like computers, TVs, mobile phones, and many others [45,49]. The Buck converter is characterized as a controllable step-down converter ( Figure 2) that can achieve a regulated output voltage for a wide range of higher input voltages.
The regulation is achieved by modulating the switching of MOSFET Q, that works in conjunction with the diode, feeding a pulsed current to the low pass filter LC, resulting in the regulated output. The converter control design usually considers an average load for its most common application, as shown in the first circuit of Figure 2. This represents a second-order system with state-space Equations (20) and (21).
In order to verify the effectiveness of the designed control, it is quite common for power converter designers to use a typical nonlinear load attached in place of the original resistive load, as shown in the second circuit of Figure 2. This load is made up of an input inductance, which represents the primary coil of a transformer, a full bridge rectifier, and an RC load at the very end. The final circuit turns into a fourth-order system represented by Equations (22)- (25).
where V D is the diode threshold voltage. In this sense, the optimized GAPID controller is expected to perform well in both situations. As stated before, the GAPID employs linked parameters that depend upon a previously designed PID. In this work, the PID was designed using the pole-placement procedure with the transfer function of the second-order system defined in Equation (26).
This second-order system has a natural oscillation frequency ω n = 1 √ LC and dumping factor ζ = 1 2R L C . The converter must be designed taking into account a high efficiency, a dumping factor preferably no less than 0.7, and the smallest inductor possible, which depends on the switching frequency, in order to generate an output with a low ripple. The inductor can be reduced as the switching frequency increases; however, the high efficiency imposes a limit on the switching frequency due to the switching losses.
In this work, a power supply for specific communication equipment with a regulated 30 V was considered. Taking all the above remarks into account, the converter's design parameters are shown in Table 1. This converter has a PID controller with reasonable performance, but it can be enhanced by using a GAPID controller instead.

Performance Evaluation Metric and Coding
The literature presents many metrics to evaluate the quality of the response of a control system. In this work, we address the Integral Absolute Error (IAE), following the premises defined by previous investigations, which must be minimized [17,20]. The IAE integrates the absolute value of the error over time according to Equation (27): The IAE is used as the fitness function of the three bio-inspired optimizers. In addition, as mentioned in Section 3, the coding of the agents were made using vectors with real values, with the elements vec = {x, y, z, q P , q I , q D }.

Buck Converter Response to a Linear PID
The design of the standard PID controller was based on the pole placement method [47]. The gains obtained after the adjustment were K p = 6.2 × 10 −3 , K i = 35.0, and K d = 0.7752 × 10 −6 . The output responses (current, voltage, control signal, and instant error) are shown in Figure 3. Although the results of the output responses were within the limits established in the design, we desired to investigate how an adaptive controller could improve the system performance. Thus, bio-inspired optimization techniques were used to find the gains of the Gaussian function used by GAPID, as shown next.

Optimization by Bioinspired Algorithms
The optimization algorithms were designed to search the parameters of the Gaussian PID controller gains, programmed to run 50 iterations per execution, with a population of 80 search agents, and were executed 100 times, each randomly initialized, for comparison. The optimization goal was to find adequate values for the GAPID parameters: λ p0 , λ p1 , q p , λ i0 , λ i1 , q i , λ d1 , and q d . In this sense, due to the linked parameters approach, each agent encoding for the metaheuristics appliance is a vector containing six elements.
The results obtained on the output of the Buck converter with the GAPID controller and the performance of each bio-inspired algorithm are presented next. We highlight that all parameters of the algorithms were defined empirically.

Parameter Optimization Using PSO
The PSO algorithm was configured with the cognitive coefficient k 1 = 2.0, social coefficient k 2 = 2.0, and inertia constant ω = 0.9. Thus, the fitness evolution over time for the best round was performed as shown in the blue line in Figure 4. The best fitness value achieved with 100 independent executions was 2.7394 × 10 −3 .
The output of the Buck converter is presented in Figures 5 and 6 shows the variation of the adaptive gains of the controller obtained by PSO.

Parameters Optimization Using ABC
The fitness evolution over time for the best round was performed as shown in the black line in Figure 4. The best fitness found was 2.7497 × 10 −3 .
At the end of the optimization process, the aforementioned parameters were used to perform the parameterization of the GAPID, generating the Buck output waveforms, as shown in Figure 7. Figure 8 shows the variation of the adaptive gains of the controller obtained by ABC.

Parameter Optimization Using WOA
The WOA algorithm does not use any external parameters; the movement is calculated within the algorithm itself. Thus, the fitness evolution over time for the best round was performed as shown in the red line in Figure 4. The smallest error (fitness value) found was 2.7385 × 10 −3 . The Buck's output is shown in Figure 9, while Figure 10 presents the variation of the adaptive gains of the controller obtained by ABC.

Analysis of the Results
The experimental results obtained during the adjustment of the GAPID controller using metaheuristics allow for some important considerations. Initially, observing Figure 3, the control action U of PID is quite slow. As stated before, the GAPID gains are referred to the PID gains, as linked parameters. As expected, for optimized GAPID, the control action is considerably more aggressive, causing saturation during startup, but does not provoke overshoot in the output signal while obtaining a fast response, mainly because it is a nonlinear controller. This is similar for all optimization strategies (PSO, ABC, and WOA), as shown in Figures 5, 7 and 9. However, in these figures, a high current peak is noticeable, which may be undesirable in certain applications. Fortunately, such high current peaks occur only during the startup.
The objective of optimization relies on obtaining a faster performance of the output voltage with a low overshoot, guaranteed by the fitness evaluation of IAE. Figure 11 summarizes the output voltage waveforms achieved by PID and GAPID tuned by the three different algorithms, where there a small difference in the GAPID responses and only a slight overshoot for PSO, which does not happen for ABC and WOA. As seen in the figure, the superiority of GAPID over PID is evident, showing a settling time about five-times shorter. The graph in Figure 12 proves the adaptability of the GAPID in maintaining better responses for both loads.
The comparison of the final values of the parameters achieved by the three metaheuristics is presented in Table 2.   As mentioned, linked parameters were used to determine the best coefficients of the GAPID. In this sense, Table 2 reveals that the best performances were achieved for different parameter values. This is strong evidence that the cost function based on the IAE is multimodal, which makes the search process difficult.
In relation to the performances in terms of the fitness achieved by each optimization method, a statistical description of the results is presented in Table 3 in which the term "Best" means the smallest fitness reached by the three optimizers. In this sense, considering a significance of 95%, one can infer that a change in the optimization algorithm led to different results. Therefore, we can admit that the PSO achieved the best general performance, followed by the WOA in terms of the best performance, smallest average error, and smallest standard deviation of the 100 simulations. Figure 13 presents the boxplot graphic of the final values of the fitness and corroborates this observation. We also highlight that the PSO presented the smallest dispersion. A boxplot graphic was also elaborated in relation to the number of iterations until the convergence of the algorithms considering 100 independent executions, as can be seen in Figure 14. The best PSO converged in the 21st iteration, while WOA and ABC were close to the 30th. Considering the number of iterations until convergence, PSO used 42 iterations, while ABC used 50, and WOA used 47. The PSO converged faster than the others, and presented the smallest dispersion. This can be particularly important in industrial applications, where online training may be required, since the computational effort necessary to adjust the model is smaller than the others.
The Figure 11 features a zoom-in that represents the converter output, explaining the difference between each algorithm at the moment when the system reaches the steady state. In the zoom area, a small overshoot can be seen on the curves of PSO and WOA, while the ABC has a smoother curve. In Figure 11, it can be observed more clearly that the three optimized GAPID outputs reached the steady state in less time than the linear PID, once again confirming the effectiveness of the optimization.

Future Research
Beyond the interesting results found in this investigation, future work can be developed using other bio-inspired optimization methods, such as genetic algorithms, differential evolution, and cat swarm optimization, among others. As a multimodal problem, the main challenge is to select one of the near-best solutions that better fits a robust operation of the plant when subjected to parameter variations and disturbances. One can simultaneously address other error metrics, by means of multi-objective approaches. In this sense, the NSGA II and SPEA appear as natural candidates. These approaches can help in the case of this multimodal problem, in attempting to select the best solution by considering additional objectives. Other plants beyond the buck should be controlled to evaluate the general behavior of the GAPID, especially those with nonlinear behavior.

Conclusions
This study presented an investigation on the use of three bio-inspired optimization algorithms to determine the gains of an adaptive PID Gaussian controller (GAPID): Particle Swarm Optimization (PSO), the Artificial Bee Colony (ABC) algorithm, and the Whale Optimization Algorithm (WOA). The Gaussian functions are smooth and bounded allowing for tuning the gains without abrupt changes with defined limits and imposing adaptive behavior on the controller. Since there is no algebraic methodology to determine these gains, metaheuristics were proposed to solve the task.
The gains resulting from the optimization were constantly tested and evaluated in the Buck converter, which demonstrated that the adaptive control strategy was robust and reliable. The experimental results revealed the effectiveness and usability of the optimization methods for the proposed problem. All of them were able to exceed the performance of the linear PID. Among them, PSO achieved the best general result with faster convergence.