**3. Energy Management Optimization**

## *3.1. Particle Swarm Algorithm*

Particle swarm optimization (PSO) is a group-based optimization search method [21,22]. The advantage is that it has a fast convergence speed and fewer parameter settings. The swarm movement of birds was simulated. Birds usually maintain a specific formation when they travel as a group, and individuals will maintain a certain distance from each other. The search technology of PSO is mainly to simulate the social behavior of birds foraging. When birds are searching for food, individuals will understand the relationship between themselves and food. At the same time, the closest individual to food in the flock is also observed. So, when searching for food, the best path can be found based on these two points. Assume that food is considered as the global best solution in the function and the distance between each individual in the flock and the food is used as the objective degree of the function. Then, the process of each individual in the flock seeking food can be the process to search for the optimized solution. This concept is the foundational idea of the PSO algorithm.

The detailed calculation steps of the PSO algorithm are as follows: *xi <sup>t</sup>* and *vi <sup>t</sup>* are defined as the position and flight speed of the *i*-th particle in the particle group at time *t*, respectively. The model of the PSO algorithm can be divided into speed update function and position update function as follows.

The main process steps of PSO are:


$$v\_i^t = \omega \ast v\_i^{t-1} + c\_1 \ast rand() \ast \left(p\_i - x\_i^{t-1}\right) + c\_2 \ast rand() \ast \left(g\_i - x\_i^{t-1}\right) \tag{7}$$

$$\mathbf{x}\_{i}^{t} = \mathbf{x}\_{i}^{t-1} + \mathbf{v}\_{i}^{t} \tag{8}$$

where *xi <sup>t</sup>* is the position of the *i*-th particle at time t, *vi <sup>t</sup>* is the speed of the *i*-th particle at time *t*, *pi* is the best position that the *i*-th particle has traveled to, *gi* is the best position that all particles have traveled to, *c*<sup>1</sup> is the weight of one's own experience to make particles closer to the best solution of the individual, *c*<sup>2</sup> is the weight of the group's experience to make the particles closer to the best solution of the group, ω is the inertia weight, which affects the range and speed of convergence, and *rand()* is a random value used to maintain the diversity of group movement directions.
