PSO and BO bio-inspired algorithms are chosen for the optimization of the proposed objective function. From the literature, it has been observed that PSO was very old (1995) and well-proven optimization algorithm for solving engineering optimization problems because its advantages like easy to understand and implementation had driven the authors to choose this algorithm. In order to check whether the PSO had given a better solution or not, a comparative analysis has been made based on the latest (2018) optimization algorithm BO. BO algorithm is a newly developed optimization algorithm that has advantages like the new way of information propagation about the agent’s fitness in the form of fragrance, no memory requirement i.e. no need to remember of agent’s individual best positions reached so far.
3.1 Particle swarm optimization
The majority of heuristic and meta-heuristic algorithms have been derived from the behavior of biological systems and/or physical systems in nature. Kennedy and Eberhart introduced the concept of Particle swarm optimization (PSO) firstly in 1995for solving continuous optimization problems [23]. The Particle Swarm optimization algorithm is a biologically-inspired algorithm motivated by the social analogy of fish or birds. The PSO algorithm starts by generating random positions for the particles, within an initialization region. Velocities are usually initialized within but they can also be initialized to zero or to small random values to prevent particles from leaving the search space during the first iterations. During the main loop of the algorithm, the velocities and positions of the particles are iteratively updated using Eq.16 and Eq.17 until a stopping criterion is met [24].
$$ \overline{{\mathrm{V}}_{\mathrm{i}}^{\mathrm{k}+1}}=\mathrm{w}\ast {\overline{\mathrm{V}}}_{\mathrm{i}}^{\mathrm{k}}+{\mathrm{C}}_1{\mathrm{R}}_1\left(\overline{{\mathrm{x}}_{\mathrm{i}}^{\mathrm{best},\mathrm{k}}}-\overline{{\mathrm{x}}_{\mathrm{i}}^{\mathrm{k}}}\right)+{\mathrm{C}}_2{\mathrm{R}}_2\left(\overline{{\mathrm{G}}_{\mathrm{i}}^{\mathrm{best},\mathrm{k}}}-\overline{{\mathrm{x}}_{\mathrm{i}}^{\mathrm{k}}}\right) $$
(16)
$$ \overline{{\mathrm{x}}_{\mathrm{i}}^{\mathrm{k}+1}}=\overline{{\mathrm{x}}_{\mathrm{i}}^{\mathrm{k}}}+\overline{{\mathrm{V}}_{\mathrm{i}}^{\mathrm{k}+1}} $$
(17)
Where \( {\overline{\mathrm{V}}}_{\mathrm{i}}^{\mathrm{k}} \) is the velocity vector of ith particle at kth iteration and each value of the vector should between Vi,min ≤ \( {V}_i^k \) ≤ Vi,max, \( \overline{\ {\mathrm{x}}_{\mathrm{i}}^{\mathrm{k}}} \) is the current position vector of ith particle at kth iteration, \( \overline{x_i^{best,k}} \) is the best position vector of ith particle up to kth iteration, \( \overline{{\mathrm{G}}_{\mathrm{i}}^{\mathrm{best},\mathrm{k}}} \) is the best position vector among all the particles up to kth iteration, W is the weighing function or inertia weight factor, W is the weighing function or inertia weight factor, C1 and C2 are the acceleration constant, R1 and R2 is the random number between 0 and 1.
3.2 Butterfly optimization
Butterfly Optimization is based on the ability of the butterflies to locate the source of fragrance accurately. They can also differentiate various fragrances and sense their intensities. In BO algorithm butterflies are the searching agents. Fitness is correlated with the intensity of fragrance that can be generated by a butterfly. The movement of butterflies in search space will change its fitness. The sharing of information between butterflies is established through the propagation of fragrance. The searching ability of a butterfly depends on the sensing capability of the fragrance. This property will decide the movement of the butterfly towards a global search or local search (random). In BOA, the fragrance is formulated as a function of the physical intensity of stimulus as follows:
$$ \mathrm{f}=\mathrm{c}{\mathrm{I}}^{\mathrm{a}} $$
(18)
Where f is the perceived magnitude of the fragrance, i.e., fragrance receiving property by other butterflies, c is the sensory modality, I is the stimulus intensity and a is the power exponent dependent on modality, which accounts the varying degree of absorption. Most of the cases a & c ∈ [0, 1]. If a = 1, means there is no absorption of fragrance, i.e., the amount of fragrance emitted by a particular butterfly is sensed in the same capacity by the other butterflies (fragrance propagation in an idealized environment). Thus, a butterfly emitting fragrance can be sensed from anywhere in the domain which in turn helps to reach the global optimum easily. On the other hand, if a = 0, it means that the fragrance emitted by any butterfly cannot be sensed by the other butterflies at all. Another important parameter c ∈ [0, ∞] determines the convergence speed. The values of a and c are crucially affecting the convergence speed of the algorithm. For the maximization problem, the intensity can be proportional to the objective function [25].
In BO algorithm, the characteristics of butterflies are idealized as follows:
- 1.
Every butterfly is supposed to emit some fragrance which enables the butterflies to attract each other (propagation of information).
- 2.
Every butterfly will move randomly or toward the best butterfly emitting more fragrance.
- 3.
The stimulus intensity of a butterfly is affected or determined by the topography of the objective function.
3.3 Implementation of PSO and BO algorithms to a proposed problem
Step 1: Initialization of problem and algorithm parameters.
In the first step, the algorithm parameters such as population size (POP), dimension of the problem (d), the maximum number of iterations (itermax) and for PSO algorithm acceleration constants c1, c2 for BO algorithm probability switch P, power exponent a and sensor modality care initialized. Initialize the problem parameters such as maximum total capacity of DGs injection \( \left({P}_{T, DG}^{max}\right) \), minimum and maximum bus voltage limits (|Umin|, |Umax|), DGs minimum and maximum active power limits (PDGmin, PDGmax), DGs location limits.
Step 2: Read the Test system Bus and Branch data, p.u demand of different types of buses for a.
day with respect to peak demand, read the probability distribution of PEVs charging scenarios PCS and OPCS. From the p.u demand of the buses and probability distribution of PEVs, kW and kVAr demand of each bus for every hour are obtained.
Step 3: Run the repetitive backward-forward sweep load flow. Calculate the daily active power.
Loss of the system without DGs (Ploss, daily), voltage deviation index of the system without DGs (VDIWODG) of the system.
Step 4: Random generation of locations for DGs placement, DGs sizes within the specified.
limits.
$$ \mathrm{DGLOC}=\left[\begin{array}{c}{\mathrm{x}}_1^1\kern0.5em {\mathrm{x}}_1^2\kern0.5em \begin{array}{cc}\cdots & {\mathrm{x}}_1^{\mathrm{d}}\end{array}\\ {}\begin{array}{cc}\begin{array}{cc}{\mathrm{x}}_2^1& {\mathrm{x}}_2^2\end{array}& \begin{array}{cc}\cdots & {\mathrm{x}}_2^{\mathrm{d}}\end{array}\end{array}\\ {}\begin{array}{c}\begin{array}{cc}\begin{array}{cc}\vdots & \vdots \end{array}& \vdots \end{array}\\ {}\begin{array}{cc}\begin{array}{cc}{\mathrm{x}}_{\mathrm{pop}}^1& {\mathrm{x}}_{\mathrm{pop}}^2\end{array}& \begin{array}{cc}\cdots & {\mathrm{x}}_{\mathrm{pop}}^{\mathrm{d}}\end{array}\end{array}\end{array}\end{array}\right] $$
(19)
$$ \mathrm{DGSIZE}=\left[\begin{array}{c}\begin{array}{cc}{\mathrm{y}}_1^1& {\mathrm{y}}_1^2\end{array}\kern0.5em \begin{array}{cc}\cdots & {\mathrm{y}}_1^{\mathrm{d}}\end{array}\\ {}\begin{array}{cc}\begin{array}{cc}{\mathrm{y}}_2^1& {\mathrm{y}}_2^2\end{array}& \begin{array}{cc}\cdots & {\mathrm{y}}_2^{\mathrm{d}}\end{array}\end{array}\\ {}\begin{array}{c}\begin{array}{cc}\begin{array}{cc}\vdots & \vdots \end{array}& \vdots \end{array}\\ {}\begin{array}{cc}\begin{array}{cc}{\mathrm{y}}_{\mathrm{pop}}^1& {\mathrm{y}}_{\mathrm{pop}}^2\end{array}& \begin{array}{cc}\cdots & {\mathrm{y}}_{\mathrm{pop}}^{\mathrm{d}}\end{array}\end{array}\end{array}\end{array}\right] $$
(20)
$$ {x}_i^j={x}_{\mathit{\min},i}+\left({x}_{\mathit{\max},i}-{x}_{\mathit{\min},i}\right)\ast \mathit{\operatorname{rand}}\left(\right) $$
(21)
$$ {y}_i^j={y}_{\mathit{\min},i}+\left({y}_{\mathit{\max},i}-{y}_{\mathit{\min},i}\right)\ast \mathit{\operatorname{rand}}\left(\right) $$
(22)
Where, \( {x}_i^j \), \( {y}_i^j \) represents locations and DGs sizes, i.e., jth population ith DG location and size respectively, which is generated randomly in between the limits as xmax, i and xmin, i are the ith DG location limits, ymax, i and ymin, i are the ith DG size limits and rand() is a random number in between 0 and 1.
$$ Soln=\left[ DGLOCDGSIZE\right] $$
(23)
In the PSO algorithm, Soln represents a group of particles or swarms. Each particle is a solution that contains DGs locations and sizes. In BO, Soln represents a group of agents.
For the PSO algorithm along with DGs locations and sizes, generate initial velocities of particles between the minimum and maximum velocity limits.
Step 5: Fitness evaluation (Objective function).
Run the repetitive backward-forward sweep based load flow and calculate the fitness value for each initial solution using Eq. 4, Eq.5 and Eq.6 and record the gbest solution in case of BO algorithm, \( \overline{{\mathrm{x}}_{\mathrm{i}}^{\mathrm{best},\mathrm{k}}} \), \( \overline{{\mathrm{G}}_{\mathrm{i}}^{\mathrm{best},\mathrm{k}}} \) for the PSO algorithm.
Step 6: Set iteration count = 0.
Step 7: The evolution procedure of PSO and BO algorithms starts from this step.
Update iteration count by 1.
Step 8: For PSO algorithm, update the velocities of particles using Eq.16 and then update DGs.
locations and DGs size position using Eq.17.
For BO algorithm, calculate the fragrance fN for each agent or butterfly using Eq. 18 and then perform a global search and local search as follows.
If rand < probability P perform global search using Eq. 24
$$ {soln}_N^d\left(t+1\right)={soln}_N^d(t)+\left({r}^2\ast gbest-{soln}_N^d(t)\right)\ast {f}_N $$
(24)
If rand > probability P perform a local search using Eq. 25
$$ {soln}_N^d\left(t+1\right)={soln}_N^d(t)+\left({r}^2\ast {soln}_j^d(t)-{soln}_k^d(t)\right)\ast {f}_N $$
(25)
Where \( {soln}_j^d(t) \) and \( {soln}_k^d(t) \) are jth and kth butterflies from the solution space which belongs to the same swarm and r is a random number in [0, 1].
Step 9: Fitness evaluation (Objective function).
Run the repetitive backward-forward sweep load flow and calculate the fitness value for each new solution using Eq. 4, Eq. 5 and Eq. 6.
Step 10: Update the gbest vector in case of BO algorithm, \( \overline{{\mathrm{x}}_{\mathrm{i}}^{\mathrm{best},\mathrm{k}}} \), \( \overline{{\mathrm{G}}_{\mathrm{i}}^{\mathrm{best},\mathrm{k}}} \) in case of PSO.
algorithm.
Step 11: Stopping criterion.
If the iteration count reaches the maximum number of iterations, computation is terminated and prints the results. Otherwise, repeat Step 7 to Step 11.