2.2. GA-SA Hybrid Optimization Algorithm
GA is an optimization algorithm established by Professor Holland of the University of Michigan and influenced by Darwinian evolution [
23,
24]. By simulating the process of biological heredity, biological individuals can be selected and eliminated according to the rule of “survival of the fittest” in biological heredity. Finally, the best individual is obtained. However, in the process of population evolution, variation is only a small probability event. The population has limited ability to explore new solution space, which can easily to fall into the local optimal and be unable to obtain the global optimal solution.
SA is an optimization algorithm proposed by Professor Kirkpatrick with reference to the Metropolis criterion, based on the recognition of the similarities of combinatorial optimization and solid annealing [
25]. The simulated annealing algorithm simulates the annealing process of a solid substance in physics and randomly searches for the global optimal solution of the objective function in the solution space by combining probabilistic jump characteristics. However, in order to obtain the optimal solution to the problem, a relatively high initial temperature is generally set during initialization, and a relatively slow cooling rate and a relatively low-end temperature are set during de-warming, resulting in a long execution time of the algorithm. Moreover, the simulated annealing algorithm keeps only one possible solution in the iterative process, which creates a lack of historical information storage and fault tolerance.
Considering the respective problems of the above two algorithms, this paper combines the two algorithms for hybrid optimization and proposes the hybrid optimization strategy of the genetic algorithm-simulated annealing algorithm (GA-SA): the defect of GA falling into the local optimum can be avoided by utilizing the probabilistic jump of SA, which changes time and tends to zero in the search process. In the evolutionary process of GA, the population is large and diverse, and the cross mutation can further increase the diversity of the population and solve the shortcomings of the SA iterative process of lack of historical information and fault tolerance [
24,
25]. Finally, the full-space search capability of the hybrid algorithm can be improved to ensure that the output solution is globally optimal to the greatest extent.
Therefore, the objective function in Equation (5) is taken as the fitness function of the GA-SA algorithm and is iteratively updated to solve parameters in the dynamic compensator. The algorithm flow is shown in
Figure 9.
The specific steps of the algorithm are as follows:
For this problem, each feasible solution (Parameter
Ai) is represented as an individual, and different individuals constitute the population, which is the set of feasible solutions for the current problem, expressed as:
where
n represents the population size, namely, the number of individuals in the population. According to experience, in the initialization process, set the population size
n = 100; that is, generate 100 possible solutions randomly (Parameter
A, where the value range is [−10, 10]). Generate the initial population and set the crossover probability
pc = 0.7, the variation probability
pm = 0.05, the initial temperature
T0 = 100 °C, the maximum number of iterations
tmax = 5000, the threshold value
th = 0.001, and the annealing temperature attenuation parameter
α = 0.85.
- 2.
Calculation of the fitness function:
Equation (5) is utilized to calculate the fitness function of each Ai in the population, and the optimal fitness of individuals in the population is obtained.
- 3.
Determine whether convergence criteria are met:
Determine if the optimal fitness is less than the threshold th or the number of iterations reaches the maximum number tmax. If ‘Yes’, output the result. If ‘No’, keep the algorithm proceeding.
- 4.
Perform replication, crossover, and variation operations on individuals. Generate the next generation population.
(1) Replication: The purpose of replication is to retain excellent individuals in the evolutionary process of the population so that the population converges in the direction of the optimal solution. The gambling wheel selection method not only ensures that excellent individuals have a greater probability of being selected, but also allows individuals with poor fitness to have a chance of being selected so as to maintain the diversity of the population. The specific implementation is as follows:
First, the probability function
pi of each
Ai is calculated according to the fitness function.
In this way, each individual Ai forms a unit interval of length 1 according to the probability function pi, and the interval length represented by each individual Ai is equal to its probability function pi, generating random numbers r between [0, 1]. According to the interval where the random number is located, the individuals represented by the interval are selected to be copied and retained by the next generation. If the random number r is satisfied with , select individual Ai to copy into the next generation population.
(2) Crossover: The purpose of crossover is to pass the good genes in the population to the next generation and generate a new generation of individuals through information exchange to maintain the diversity of the population. In order to avoid excessive damage to excellent individuals caused by the crossing process, the single-point crossing method with the weakest strength is selected as the crossing method, which is implemented as follows:
The individual is encoded in binary to generate a binary string. In a crossover operation, a number pair (
i,j),
i, j∈[1, n] in the range of the population size is randomly generated. That is, the binary strings of individuals
Ai and
Aj are selected for crossover operation; then, an integer
m within the length range of the binary string is randomly generated, and the
mth point in the binary string is selected as the intersection point. Finally, a random number
r′∈ [0, 1] is generated for comparison with the crossover probability
pc. If the random number
r′ is less than the crossover probability
pc, the crossover will be carried out, and the coding bits after the crossover point of the two individuals will be exchanged to generate the next generation of individuals. If the random number
r′ is greater than the crossover probability
pc, no crossover is performed. For example, when
m = 4, the change in binary strings
Ci and
Cj of individuals
Ai and
Aj is shown in Equation (8).
where
and
represent the binary strings of the
kth generation of individuals
Ai and
Aj.
and
represent the binary strings of the
k + 1th generation of individuals
Ai and
Aj.
(3) Variation: The purpose of variation is to maintain the diversity of the solution set, and the process is basically the same as crossover. In a variation operation, a number
i∈[1, n] within the range of the population size is randomly generated; that is, a binary string of individual
Ai is selected for variation operation. Then, randomly generate an integer
m in the binary string length range. The
mth point in the binary coding string is selected as the variation point. Finally, generate a random number
r″∈[0, 1], and compare it with the variation probability
pm. If
r″ is less than the
pm, the variation point is inversely calculated. On the contrary, there is no variation. For example, when
m = 7, the change process of the binary coded string
Ci of individual
Ai is shown in Equation (8).
and represent the binary strings of the kth generation and k + 1th generation of individual Ai.
- 5.
Simulated annealing searches are performed on each individual of the population.
- 6.
Annealing:
, set k = k + 1
- 7.
Repeat Step 2 and Step 3 until the algorithm convergence rules are met and the current result is outputted.