# Parameter Identification of Lithium Battery Model Based on Chaotic Quantum Sparrow Search Algorithm
## 4 Improvements on the Sparrow Search Algorithm
### Chaotic Quantum Sparrow Search Algorithm  
Combing the above improvement strategies with SSA, the CQSSA algorithm is proposed. The basic idea is as follows. Firstly, the Tent chaotic mapping is used for initialization to generate a more diverse sparrow population to improve the iteration efficiency and enhance the global search capability. Secondly, the Gaussian variation is performed to produce more types of individuals and thus increase the population diversity if the individual optimal solution is smaller than the individual average optimal solution. Moreover,the quantum behavior is employed, which can search throughout the solution space and reduce the probability of getting trapped in the local optimum.  
The processing steps are as follows:  
**Step 1**: Initialize the number of iterations \(iter_{\text{max}}\), the number of sparrows in the population \(N\) and the dimension of the solution space \(D\) and determine the upper bounds \(U\) and lower bounds \(L\) of the parameters.  
**Step 2**: Use the Tent chaos mapping to generate a chaotic sequence and map them to the solution space using an inverse mapping, and then initialize the positions of the sparrow population by (20) and (21).  
**Step 3**: According to the cell model and the objective function (9), calculate the fitness values of sparrows \(Fit_{p}\) and compare them with the individual optimal position \(X_{p}\), global optimal position \(X_{best}\), global worst position \(X_{worst}\) as well as the optimal fitness value \(Fit_{best}\). Then, rank the sparrows according to the fitness value to get better and worse positions among the sparrows.  
**Step 4**: Regard the top 20% of the ranked sparrows as producers. Use (11) to update their positions.  
**Step 5**: Take sparrows other than the producers as followers. Moreover, use (12) to update the positions.  
**Step 6**: Select 20% of sparrows randomly as guard sparrows, whose positions are updated by (13).  
**Step 7**: Calculate the average fitness value of the population \(Fit_{Alex}\) and compare it with the optimal individual fitness value \(Fit_{p}\).  
If \(Fit_{p}\) is less than \(Fit_{Alex}\), regard the individual within the population and update its position to enhance the population diversity by using Gaussian variation. Gaussian variation applies a random number that obeys a Gaussian distribution to perturb the original position. The Gaussian variation equation is shown as follows:  
\[X_{Gaussian}=X\cdot(1+N(m,\sigma^{2})) \tag{22}\]  
where \(X_{Gaussim}\) is the position after Gaussian variation, \(X\) is the original position and \(N(m,\sigma^{2})\) is a Gaussian distributed random variable.  
If \(Fit_{p}\) is greater than \(Fit_{Alex}\), regard the individual as far away from the community and use the quantum behavior by (19), which draws the individual towards a certain position between the individual optimal and global optimal positions.  
Then, compare the updated position with the original position and select the best individual for the next iteration.  
**Step 8**: After completing an iteration, calculate the fitness values and update the optimal position \(X_{p}\), global optimal position \(X_{best}\), global worst position \(X_{worst}\) and global optimal fitness value \(Fit_{best}\) of the sparrow individual.  
**Step 9**: Determine whether the current number of iterations reaches the maximum number of iterations. If so, the algorithm ends and the output result is returned; otherwise, return to Step 3.  
The algorithmic flow of the CQSSA algorithm is shown in Figure 2.