**Begin**

**Step 1: Initialization**.

> 1. **Initial position:** the initial position of each particle obeys uniform distribution, that is *Xi* ∼ *<sup>U</sup>*(*bup*, *blo*).

2. **Initialize its own optimal solution and the overall optimal solution:** the initial position is its own optimal solution *pi* = *xi*, and then calculating the corresponding value of each particle according to the defined utility function f, and find the global optimal solution *gbest*.

3. **Initial speed:** the speed also obeys the uniform distribution.

#### **Step 2: Update.**

According to Equations (7) and (8), **the velocity and position of particles are updated,** and the current fitness of particles is calculated according to the utility function *f* of the problem. If it is better than its own historical optimal solution, it will update its own historical optimal solution *pbest*, otherwise it will not update. If the particle's own optimal solution *pbest* is better than the global optimal solution *g*, then the global optimal solution *g* is updated, otherwise it is not updated.

#### **Step 3: Determine whether to terminate:**

Determine whether the best solution meets the termination conditions, if yes, stop. Otherwise, return to **Step 2**.

**End.**

As shown in Equations (7) and (8), during each iteration, the particles update the direction and speed of the next flight based on their own and group experience. The main characteristics of the PSO algorithm are as follows:

