**3. Equilibrium Optimization for Optimal Operation Strategy in MGs** *EO Algorithm*

The dynamic balance of mass on the control volume is a key source of inspiration for the EO technique. The following three steps can be used to explain its mathematical model:

Step 1: Initialization: In the starting of the optimization process, the EO randomly generates the population. The initial concentrations are calculated using uniform random initialization based on the particle number, population, and dimensions, as in Equation (34) [64]:

$$\mathbf{C}\_{i,initial} = \mathbf{C}\_{i,\text{min}} + rand\_i (\mathbf{C}\_{i,\text{max}} - \mathbf{C}\_{i,\text{min}}), \qquad i = 1, 2, \dots, N\_{\text{l}} \tag{34}$$

where *Ci,initial* refers to the initial vector for each particle (*i*), *Ci,min* and *Ci,max* are the lower and upper bounds of the control variables, *rand<sup>i</sup>* refers to a random distributed vector in [0,1], and *N<sup>i</sup>* is the number of particles.

In this step, the fitness of the initialized particles is estimated, and the best scores are used to find the nominee solutions.

Step 2: Equilibrium pool and candidates: In this step, the EO finds the particle's equilibrium state. The algorithm reaches a near-optimal solution at its equilibrium state. It assigns the best four particles in the population at equilibrium candidates and the fifth one containing the average of the previous best four particles. The pool of equilibrium (Ceq, pool) that helps the EO features in their exploitation and exploration operations is expressed by these five equilibrium candidates.

Step 3: Updating the concentration: The evaluation process for updating each concentration vector (*C*) is carried out as

$$
\stackrel{\rightarrow}{\dot{\mathcal{C}}} = \stackrel{\rightarrow}{\mathcal{C}\_{eq}} + (\stackrel{\rightarrow}{\mathcal{C}} - \stackrel{\rightarrow}{\mathcal{C}\_{eq}}) \stackrel{\rightarrow}{\mathcal{F}} + \frac{\stackrel{\rightarrow}{\dot{\mathcal{G}}}}{\stackrel{\rightarrow}{\lambda \dot{V}}} (1 - \stackrel{\rightarrow}{\mathcal{F}}) \tag{35}
$$

where *Ceq* is a randomly generated vector (*Ceq, pool*) from the pool of equilibrium; *λ* is a random vector [0,1]; *G* is the generation rate; *V* stands for the volume unit, which is equal to one [31]; and *F* is an exponential term that helps the EO algorithm in achieving a balance between the exploration and extraction phases. It can be determined as follows:

$$\stackrel{\rightarrow}{F} = e^{-\stackrel{\rightarrow}{\lambda}(t - t\_{\mathcal{O}})} \tag{36}$$

where *t*<sup>0</sup> is the initial start time, and the time (*t*) depends on the number of iterations (*Iter*) as follows:

$$t = \left[1 - \frac{Iter}{Max\\_iter}\right]^{\left[a\_2 \cdot liter/Max\\_iter\right]}\tag{37}$$

where *Iter* and *Max\_iter* are the initial and maximum iteration numbers, respectively; and *a*<sup>2</sup> is a constant value equal to 1 that is used to monitor exploitation potential [31]. The following formula can be considered to boost the developed technique's exploration and exploitation abilities.

$$\stackrel{\rightarrow}{t\_o} = \frac{1}{\stackrel{\rightarrow}{\lambda}} \ln \left[ -a\_1 \text{sign}(\stackrel{\rightarrow}{\vec{r}} - 0.5)(1 - e^{-\stackrel{\rightarrow}{\lambda}t}) \right] + t \tag{38}$$

where *a*<sup>1</sup> is a constant value of 2 that is used to control exploration ability [31], *r* is a random vector in the range of 0 to 1, and the term (*sign* (*r* − 0.5)) affects exploration and exploitation directions. The generation rate (*G*) is calculated as follows:

$$
\stackrel{\rightarrow}{G} = \overline{\mathcal{G}\_{cp}} \left( \stackrel{\rightarrow}{\mathcal{C}\_{eq}} - \stackrel{\rightarrow}{\lambda} \stackrel{\rightarrow}{\mathcal{C}} \right) \stackrel{\rightarrow}{F} \tag{39}
$$

$$\stackrel{\longrightarrow}{G\_{cp}} = \left\{ \begin{array}{ll} 0.5r\_1 & r\_2 \ge G\_p \\ 0 & r\_2 \le G\_p \end{array} \right\} \tag{40}$$

where *Gcp* is the control parameter of the generation rate that is used to update the EO technique, *G<sup>P</sup>* is the generation probability that equals 0.5 [31], and *r*<sup>1</sup> and *r*<sup>2</sup> are random numbers in the range [0,1]. Figure 3 shows the EO based optimal operation procedure of MG in the tested distribution systems.

**Figure 3.** Flowchart of the optimal proposed operation procedure of MG.
