Introduction

The optimal power flow (OPF) minimizes generation costs, power losses, and voltage stability while adhering to system restrictions1. OPF is a large-scale, nonlinear, constrained, nonconvex optimization problem in power systems. This problem has been addressed with linear programming, nonlinear programming, quadratic programming, Newton, and interior point methods. These traditional methods, however, have certain limitations and require specific theoretical assumptions. Consequently, they are limited in their optimization abilities2,3,4. Despite this, solving the OPF problem remains a popular and challenging task.

Researchers have recently discovered that metaheuristic algorithms, which are all-purpose and straightforward to use, can tackle challenging real-world problems. Because metaheuristics are very accurate and straightforward, they have drawn much attention in various challenging optimization issues in engineering, communications, medical, and social sciences5. Moreover, metaheuristic algorithms are also used to improve solutions for a variety of problems, such as global optimization6, energy applications7, power flow systems8, image segmentation9, 10, deep learning-based classification11, economic emission dispatch (EED) problems12, and feature selection13, 14. In contrast to deterministic algorithms, metaheuristic algorithms employ specialized operators and randomly generated search agents to find optimal solutions. Natural phenomena, such as swarms and social behavior, evolutionary principles, and physical theories, inspire these operators. In general, metaheuristic algorithms fall into three categories: swarm methods, which simulate animals, birds, and humans’ social behavior; evolutionary methods; and natural phenomena algorithms15.

Metaheuristic methods have gained popularity in solving complex OPF problems using population-based techniques. Researchers have studied these methods with only thermal power generators16. The traditional OPF issue was solved by Kumari17 using an upgraded genetic algorithm (GA), and Khunkitti18 utilized a hybrid dragonfly and PSO technique for minimizing fuel loss, emissions, and power loss. Based on FACTS devices, Basu19 proposed a DE method that considers generating costs, emissions, and power losses to overcome OPF issues. Singh20 overcomes IEEE-30 and IEEE-118 OPF problems using PSO and an aging leader and challenger. An adapted Sine–Cosine algorithm with Levy flights was used in Attia’s21 solution to the OPF problem.

It is apparent from the literature that traditional OPF issues only consider thermal power sources. Since fuel prices have increased and environmental concerns have been heightened, a stochastic OPF has been necessary to optimize renewable energy sources22, 23. However, wind energy has been incorporated in a variety of ways, such as the use of genetic algorithms by Liu24, the use of a fuzzy selection mechanism by Hetzer26, and the use of hybrid flower pollination by Dubey27. In addition, other studies have considered the stochastic nature of wind power and the variable nature of its loads. As examples, Miguel examined the impact on operating costs25, Kusakana included solar photovoltaic, wind, diesel generators, and batteries28, and Partha used a historical parameter adaptation approach to combine wind and solar power30.

Furthermore, the Gray Wolf Optimizer method was applied to the IEEE-30 bus and IEEE-57 bus systems to combine thermal power, wind energy, and solar energy31. In addition, Arsalan used the Krill Herd algorithm to solve OPF problems relating to wind energy generation under uncertainty in both the IEEE-30 bus system and the IEEE-57 bus system32. In modified IEEE 30-bus and IEEE 57-bus systems33, Mohd applied the Barnacles Mating Optimizer method to the OPF problem with stochastic wind energy. Shuijia Li34 presented a penalty constraint handling strategy for solving OPF in an IEEE-30 bus system utilizing an enhanced adaptive DE. However, an overview of soft computing contributions to OPF literature can be found in Table 1.

Table 1 Literature contribution.

Although these algorithms were aimed at solving the same OPF issues, their optimization functions were different, which led to various optimized solutions resulting in different optimization performance that is assessed by the quality of the optimum solution and the convergence time. Even though many metaheuristic methodologies have shown satisfactory outcomes, optimization problems have become more challenging due to the increasing number of variables and constraints that can be optimized. However, metaheuristic optimization algorithms cannot always obtain the optimal global solution, regardless of their advantages. Further, no algorithm is suitable for solving all variants of the OPF problem due to the variability of objectives used to formulate it. It is, therefore, necessary to develop metaheuristic algorithms capable of handling various OPF formulations very effectively. In order to address current optimization challenges, combining two or more metaheuristics and modifying or improving existing algorithms is necessary. This procedure is known as hybridization51.

Nevertheless, selecting hybridization algorithms that will enhance optimization performance is essential. Thus, choosing an algorithm is an important step in the process, typically based on its performance. It is therefore recommended to study more recent algorithms and features to develop a more effective algorithm for solving OPF problems. Particularly, the artificial hummingbird algorithm (AHA) has attracted great interest. Despite the promising results achieved by the AHA method, this method is not entirely impervious to metaheuristic flaws. Several studies have pointed out the algorithm’s slow convergence speed and tendency to get trapped in local optima. They also discuss the significant effect algorithm parameters have on algorithm performance and the inadequacy of exploration and exploitation. Hence, this paper suggests a modified artificial hummingbird algorithm (mAHA) that addresses these limitations by integrating the local escape operator (LEO) and opposition-based learning (OBL) into the basic AHA.

In this paper, we introduce a novel and enhanced approach to address the challenges in solving the Optimal Power Flow (OPF) problem. While various metaheuristic algorithms have shown promise in tackling OPF problems, they often face limitations, such as slow convergence speed and susceptibility to local optima. This paper presents a significant contribution in the form of the modified Artificial Hummingbird Algorithm (mAHA), which effectively addresses these limitations by integrating the local escape operator (LEO) and opposition-based learning (OBL) into the basic AHA. The key objective of this paper is to combine OPF with Renewable Energy Sources (RESs) to optimize scheduled power from RESs and generating power from thermal units, thereby minimizing the total operational cost. To validate the effectiveness of our proposed approach, we apply the mAHA algorithm to standard IEEE 30, and 118 bus systems for solving traditional OPF issues, as well as a modified IEEE-30 bus system that incorporates RES. Our contributions include developing and testing the mAHA algorithm on a range of benchmark functions, comparing it with established metaheuristic algorithms, and demonstrating its efficacy in integrating RES into the OPF problem. These contributions collectively provide a comprehensive and innovative solution to enhance the optimization of power systems. The main contributions of this work can be summarized in the following items:

  • This paper proposed a modified mAHA algorithm and tested through unimodal, multimodal, and composite benchmark functions .

  • The performance of mAHA compared to competitors is demonstrated using the CEC’2020 benchmark test problems.

  • Present four different objective functions for formulating the real-world problem called OPF problem.

  • mAHA converts the multi-objective function, which includes fuel costs, power losses, voltage deviations, and emissions, into a single-objective function based on price and weighting factors.

  • Several benchmark problems from the metaheuristic literature are tested, including IEEE 30, and 118 bus grids, to assess the effectiveness and scalability of the proposed algorithm.

  • A comparison is made between the performance of mAHA and various established meta-heuristic algorithms to verify its validity and effectiveness, including the Whale optimization algorithm (WOA), Sine cosine algorithm (SCA), Tunicate swarm algorithm (TSA), Slime mould algorithm (SMA), Harris hawks optimization (HHO), RUNge Kutta optimization algorithm (RUN), and the original Artificial Hummingbird Algorithm (AHA).

  • Efficient Integration of renewable energy sources (RES) and external electric grid (EEG) has been suggested to overcome the OPF problem.

  • The mAHA technique is applied to a modified version of the IEEE 30-bus grid that includes the optimum allocation of RES via the OPF issue. This test demonstrates the superiority of the suggested methodology over other state-of-the-art metaheuristic techniques.

After the introduction section, the presented paper is constructed in the following sections: Section “Preliminaries” provides the mathematical model for the basic AHA algorithm required to construct the proposed modified algorithm, the OBL strategy, and the Local Escaping Operator (LEO). Section “The proposed mAHA algorithm” provides the mathematical model of the proposed mAHA algorithm. Section “Application of mAHA: optimal power flow and generation capacity” introduces the OPF mathematical formulation model. Section “Evaluated results and discussion” discusses the design findings. The discussion contains the performance results of the proposed mAHA on CEC’2020 benchmark functions. It also contains the results of the proposed mAHA based on the OPF problem. Section “Conclusion” presents this paper’s conclusion and future work.

Preliminaries

This section will cover the fundamental methods needed to construct the proposed method. We will comprehensively explain the mathematical model of the Artificial Hummingbird Algorithm (AHA), the OBL approach, and the local escaping operator (LEO) technique.

Artificial hummingbird algorithm (AHA)

Based on the behavior of hummingbirds, the AHA technique was developed to solve real-world problems52. The hummingbird is an incredible creature among the smallest birds in the world. By replicating the axial, diagonal, and omnidirectional flight techniques of hummingbirds, the AHA algorithm seeks to replicate the flight abilities and intelligent foraging strategies of these birds. Foraging strategies, memory capacity, and flight abilities of hummingbirds have been incorporated into the algorithm. Furthermore, the AHA algorithm incorporates guided foraging, territorial foraging, and migrating foraging techniques. Tracking food sources mimics hummingbird memory by using a visiting table. As a result of the AHA algorithm, the following three main elements are explained:

  • Food sources: When selecting food sources, hummingbirds consider factors such as the quality and content of nectar in individual flowers, the rate at which nectar is refilled, and the last time they visit the flowers. In the AHA algorithm, each food source is assumed to have the same type and quantity of flowers, represented by a solution vector. Its fitness value indicates the nectar-refilling rate. A food source with a higher nectar-refilling rate will have higher fitness.

  • Hummingbirds: Every hummingbird is given a unique food source to feed from, and the bird and the food source are positioned in a specific location. A hummingbird can remember the exact location of the food source and the frequency of nectar replenishment for that particular source. This information can be communicated to other hummingbirds in the population. Moreover, each hummingbird can recall its last visit to a particular food source.

  • Visit table: A table is maintained to record the visit history of different hummingbirds to each food source, indicating the duration since a particular bird last fed from it. When a hummingbird decides to feed, it prioritizes a food source with a high visit level for that specific bird. If multiple food sources have the same highest visit level, the bird selects the one with the highest nectar-refilling rate to obtain more nectar. This visit table helps each hummingbird to locate its preferred food source. Typically, the visit table is updated after each feeding loop.

AHA mathematical model

The three mathematical representations simulating three foraging behaviors of hummingbirds: guided foraging, territorial foraging, and migrating foraging are presented as follows:

Step 1: Initialization

A population of N hummingbirds is established on N food sources, randomly initialized as Eq. (1)

$$ Xb_{i} = lb_{i} + rand times (ub_{i} – lb_{i} );::i = 1,2,…,N $$
(1)

where (Xb_{i}) denotes the solution in a population set of N. (lb_{i}) and (ub_{i}) are the lower and upper boundaries, respectively.

The visit table of food sources is initialized in Eq. (2)

$$ V_{t} = left{ {begin{array}{*{20}l} 0 hfill & {i ne j} hfill {null} hfill & {i = j} hfill end{array} } right.::::i = { 1,2,…,N} ;j = { 1,2,…,N} $$
(2)

Step 2: Guided foraging

To exhibit guided foraging behavior, the hummingbird must identify food sources with the highest visit level and choose the one with the most rapid nectar replenishment as its target. Once identified, the bird can navigate toward the desired food source. The AHA algorithm incorporates three flight skills to direct the search space during foraging: omnidirectional, diagonal, and axial flights. The axial flight is described by Eq. (3).

$$ D_{i} = left{ {begin{array}{*{20}l} 1 hfill & {i = randi([1,d])} hfill 0 hfill & {otherwise} hfill end{array} } right.::::i = { 1,2,…,d} $$
(3)

The diagonal flight is calculated by Eq. (4)

$$ D_{i} = left{ {begin{array}{*{20}l} 1 hfill & {i = G(j):,j in [1,k],G = randperm(l),:l in [2,[r1 times (d – 2)] + 1]} hfill 0 hfill & {otherwise} hfill end{array} } right. $$
(4)

The omnidirectional flight is calculated by Eq. (5)

$$ D_{i} = 1,::i = { 1,2,…,d} $$
(5)

where (randi([1,d])) obtains an integer random from 1 to d, (randperm(l)) generates a random permutation of integers from 1 to l, and (r1) is a random number between [0, 1].

Using different flying patterns, Eq. (6) simulates directed foraging behavior by allowing each food source to update its location relative to the target food source. It also depicts the foraging activity of hummingbirds.

$$ zeta (t + 1) = Xb_{i,targ} (t) + a times D times (Xb_{i} (t) – Xb_{i,targ} (t)) $$
(6)
$$ asim N(0,1) $$
(7)

Where (Xb_{i} (t)) denotes the (i^{{{text{th}}}}) position, (Xb_{i,targ} (t)) denotes the position of the target food source, and a denotes the guided vector.

The updating positions are applied using Eq. (8).

$$ Xb_{i} (t + 1) = left{ {begin{array}{*{20}l} {Xb_{i} (t)} hfill & {f(Xb_{i} (t)) le f(zeta (t + 1))} hfill {zeta (t + 1)} hfill & {f(Xb_{i} (t)) > f(zeta (t + 1))} hfill end{array} } right. $$
(8)

where (f(.)) denotes the objective function. Equation (8) illustrates that if the candidate food source’s nectar-refilling rate is greater than the current one, the hummingbird discards the current food source and remains at the candidate food source calculated using Eq. (6) for feeding.

The visit table records the time elapsed since a specific hummingbird last visited each food source, and a more extended period between visits indicates a higher visit level. Each hummingbird seeks the food source(s) that receives the most visitors. If two or more sources have an equal number of visits, the bird chooses the one with the highest rate of nectar replenishment as its target food source. Each bird navigates to its intended food source using Eq. (6). When a hummingbird uses Eq. (6) to guide its foraging during each iteration, the visit levels of other food sources visited by that specific bird are increased by 1. In contrast, the visit level of the target food source visited is set to 0. A hummingbird can engage in guided foraging with a guide to reach its preferred food source, then remain at the new food source until a better nectar-refilling rate (solution) or food quality (deterioration) becomes available.

The following schema illustrates AHA’s guided foraging method:

(9)

Step 3: Territorial foraging

During this step, a hummingbird can migrate to a nearby location within its territory, where it may find a new food source that could be a better solution than the current one. The local search of hummingbirds in the territorial foraging strategy is modeled using Eq. (10), which helps to identify a candidate food source by:

$$ zeta (t + 1) = Xb_{i} (t) + b times D times Xb_{i} (t) $$
(10)
$$ bsim N(0,1) $$
(11)

Where b is a geographic variable, the visit table has to be updated following the territorial foraging approach. The following diagram illustrates AHA’s territorial foraging strategy:

(12)

Step 4: Migration foraging

The hummingbird at the food source with the lowest rate of nectar replenishment will randomly move to a new food source established in the whole search space once the number of iterations exceeds the predefined value of the migration coefficient. A hummingbird’s foraging trip from the source with the lowest nectar replenishment rate can be modeled using Eq. (13).

$$ X_{wors} = lb + rand times (ub – lb) $$
(13)

where (X_{wors}) denotes the food source with the worst nectar-refilling rate. Equation (14) illustrates the migrating foraging strategy of AHA.

(14)

A visiting table and a set of random solutions are created to summarize the AHA algorithm’s process. Each iteration has a 50% probability of carrying out territorial or guided foraging. Hummingbirds use guided foraging to travel to the food sources they prefer, which are determined by the frequency of their visits and the rate at which the nectar is replenished. However, due to territorial foraging, hummingbirds are forced to disturb their local populations. They are foraging while migration begins after 2n iterations. Three flight abilities—omnidirectional, diagonal, and axial—are used in the three foraging tasks. All operations are carried out interactively until the stopping criteria are met. The pseudo-code for the AHA procedure is provided in Algorithm 1.

Opposition-based learning (OBL)

The OBL technique is an efficient method for avoiding stagnation in potential solutions. HR developed it. Tizhoosh53 to enhance the search mechanism’s exploitation ability. When using meta-heuristic algorithms, convergence usually happens quickly when initial solutions are close to the optimal position, but slower convergence is expected otherwise. However, the OBL technique can discover more valuable solutions in opposite search regions that may be closer to the global optimum. To achieve this, the OBL searches in both directions of the search space. One of the initial solutions is used for both directions, while the opposite solution represents the other. The OBL then selects the most appropriate solutions from all solutions found.

Opposition number: The concept of opposite numbers represents opposition-based learning. An opposition-based number can be described as follows. Lets consider (Q_{0}) it a real number on an interval: (Q_{0} in [a,b]) the opposite number (Q_{0}) is defined by Eq. (15).

$$ overline{Q}_{0} = a + b – Q_{0} $$
(15)

Equations (16) and (17) identify the opposite point in D-dimensional space.

$$ {text{Q}} = {text{q}}_{1} ,{text{q}}_{2} ,{text{q}}_{3} , ldots ,{text{q}}_{D} $$
(16)
$$ overline{{text{Q}}} = [overline{{text{Q}}}_{1} ,overline{{text{Q}}}_{2} ,overline{{text{Q}}}_{3} ,…,overline{{text{Q}}}_{D} ] $$
(17)
Algorithm 1
figure a

Pseudo-code of the AHA algorithm.

The items in (overline{{text{Q}}}) are computed by Eq. (18)

$$ overline{{text{Q}}}_{k} = a_{k} + b_{k} – Q_{k} ,,,where,,k = 1,2,3,…,D $$
(18)

Opposition-based optimization: In the optimization strategy, the opposite value (overline{Q}_{0}) is replaced by the corresponding (Q_{0}) based on the objective function. If (Q_{0}) is more suitable (f(overline{Q}_{0} )), then (Q_{0}) not changed; otherwise, the solutions of the population are updated based on the best value of (Q) and (overline{Q}_{0})54.

Local escaping operator (LEO)

The LEO is a technique proposed in55 that is utilized to enhance the effectiveness of the Gradient-based optimizer (GBO) algorithm in resolving complex real-world issues. Its purpose is to explore new areas necessary for finding solutions to challenging problems. By changing the position of solutions based on specific criteria, LEO improves the quality of the solutions and prevents the algorithm from being trapped in local optima. LEO selects new solutions ((X_{LEO}^{H})) by utilizing various techniques, such as the best position ((Xb_{best})), two randomly chosen solutions (X1_{r1}^{m}) and (X2_{r2}^{m}), two other randomly selected solutions ((Xb_{r1}^{m}) and (Xb_{r2}^{m})), and a newly generated random solution ((X_{k}^{m})). Thus, the solution (X^{H}_{LEO}) can be obtained using the following:

$$ begin{gathered} {mathbf{IF}} hfill X_{LEO}^{H} = left{ {begin{array}{*{20}l} {x_{n}^{m} + f_{1} left( {u_{1} Xb_{best} – u_{2} X_{k}^{m} } right)} hfill & {} hfill {quad quad + f_{2} rho_{1} left( {u_{3} left( {X2_{n}^{m} – X1_{n}^{m} } right)} right) + u_{2} left( {X_{r1}^{m} – X_{r2}^{m} } right)/2} hfill & {randN < 0.5quad quad (19{text{a}})} hfill {Xb_{best} + f_{1} left( {u_{1} Xb_{best} - u_{2} X_{k}^{m} } right) } hfill & {} hfill {quad quad + f_{2} rho_{1} left( {$ {text{u}}_{{3}} $ left( {{text{X2}}_{{text{n}}}^{{text{m}}} {text{ - X1}}_{{text{n}}}^{{text{m}}} } right)} right) + u_{2} left( {X_{r1}^{m} - X_{r2}^{m} } right)/2} hfill & {otherwisequad quad quad (19{text{b}})} hfill end{array} } right. hfill {mathbf{End}} hfill end{gathered} $$
(19)

where, (f_{1}) and (f_{2}) are uniformly distributed random values in [-1, 1], (P_{r}) denotes a probability number equal to 0.5. (u1), (u2), and (u3) are random numbers obtained from the following equations:

$$ u1 = left{ {begin{array}{*{20}l} {2*randN} hfill & {mu_{1} < 0.5} hfill 1 hfill & {otherelse} hfill end{array} } right. $$
(20)
$$ u2 = left{ {begin{array}{*{20}l} {randN} hfill & {mu_{1} < 0.5} hfill 1 hfill & {otherelse} hfill end{array} } right. $$
(21)
$$ u3 = left{ {begin{array}{*{20}l} {randN} hfill & {mu_{1} < 0.5} hfill 1 hfill & {otherelse} hfill end{array} } right. $$
(22)

where (randN) is a random value between zero and one. (mu_{1}) is between 0 and 1. We can simplify the equations of (u1), (u2), and (u3) in the following mathematical representation:

$$ u_{1} = L_{1} times 2 times randN + (1 – L_{1} ) $$
(23)
$$ u_{2} = L_{1} times randN + left( {1 – L_{1} } right) $$
(24)
$$ u_{3} = L_{1} times randN + left( {1 – L_{1} } right) $$
(25)

where (L_{1}) is a parameter with a value of 0 or 1. (L1 = 1 if (mu_{1} < 0.5), and 0 otherwise).

The following scheme is presented to obtain the solution in Eq. (19).

$$ X_{k}^{m} = left{ {begin{array}{*{20}l} {x_{{text{randN }}} } hfill & {{text{ if }}mu_{2} < 0.5} hfill {x_{p}^{m} } hfill & {text{ otherwise }} hfill end{array} } right. $$
(26)

where (x_{{text{randN }}}) is a new solution that can be calculated as shown in Eq. (27), (x_{p}^{m}) is a random solution selected from the population ((p in [1,2, ldots N])), (mu_{2}) is a random number in the range of [0,1].

$$ x_{{text{randN }}} = lb + {text{randN}} (0,1) times left( {ub – lb} right) $$
(27)

Moreover, (rho_{1}) is used to balance the exploration and exploitation phases. It is defined by:

$$ rho_{1} = 2 times {text{rand}} times alpha – alpha $$
(28)
$$ alpha = left| {beta times sin left( {frac{3pi }{2} + sin left( {beta times frac{3pi }{2}} right)} right)} right| $$
(29)
$$ beta = beta_{min } + left( {beta_{max } – beta_{min } } right) times left( {1 – left( {frac{t}{{t_{max} }}} right)^{3} } right)^{2} $$
(30)

where (beta_{min }) and (beta_{max }) are equal to 0.2 and 1.2, respectively, t is the current step and (t_{max}) is the highest number of steps—changes according to the sine function to balance the exploration and exploitation phases (alpha).

Equation (26) can be simplified using Eq. (31):

$$ X_{k}^{m} = w_{2} times x_{p}^{m} + left( {1 – w_{2} } right) times x_{{text{rand }}} $$
(31)

where (w_{2}) is a parameter with a value of 0 or 1. If the parameter (mu_{1}) is less than 0.5, the value of L1 is 1; otherwise, it is 0.

The proposed mAHA algorithm

In this section, we present a detailed explanation of the proposed mAHA optimization algorithm, which aims to improve the searchability of the AHA and eliminate its weaknesses in solving complex real-world problems. The mAHA algorithm consists of two effective schemes: the LEO and the OBL. To enhance the performance of the original AHA, the OBL strategy is utilized in the initialization phase. After that, the steps of the original AHA are carried out as usual, and the LEO is used to improve its performance further.

Drawbacks of the basic AHA algorithm

The basic AHA algorithm is based on hummingbirds’ foraging behavior, including guided foraging, territorial foraging, and migrating foraging. The algorithm generates diverse solutions by randomly applying these foraging strategies. However, in some optimization issues, the AHA algorithm can get trapped in sub-regions, resulting in improper exploration–exploitation balance, particularly in complex and high-dimensional problems. Since each solution updates its position based on the previous one, the algorithm’s convergence rate is reduced, and it cannot effectively cover search space solutions, leading to premature convergence. Therefore, we have developed a new version of the AHA algorithm to address these limitations. The LEO prevents getting trapped in sub-regions, solving premature convergence by updating solutions using a robust strategy and randomly selecting a solution over the search space. Furthermore, we utilize the OBL to improve the algorithm’s search efficiency, considering the No Free Lunch (NFL) theory that no superior optimization algorithm works well for all optimization problems.

Initialization of the proposed mAHA

The initialization process of the mAHA algorithm follows the AHA algorithm and starts by proposing an initial population of (N) search agents. Each search agent is limited by upper and lower boundaries (uba and lba) in the search space, as described in Eq. (1). The mAHA algorithm aims to enhance the diversity of the search process, which is achieved through the utilization of the OBL strategy during the initialization phase. This helps to improve the search operation, as demonstrated in Eq. (32).

$$ Opp_{s} = lb_{a} + ub_{a} – y_{b} ,b in 1,2,…,N_{n} $$
(32)

where (Opp_{s}) is a vector produced by applying OBL. (lb_{a}), and (ub_{a}) are lower and upper bounds of the (a^{th}) component of Y, respectively. After that, the visit table of food sources is initialized, as shown in Eq. (2).

Fitness evaluation of the proposed mAHA

It is compulsory to assess the solutions in each iteration to estimate the proposed solutions and to improve the new proposed solutions in the next step. In each iteration, the population of hummingbird positions is evaluated to get the fitness value of each solution (f(x)). The best solution is determined (Xb_{best}) and is used in updating the position rule.

Updating process of the proposed mAHA

The AHA update steps are divided into two processes, as described in Eq. (33). The first process is divided into three steps, as illustrated in subsection “AHA mathematical model“; guided foraging, territorial foraging, and migration foraging. There is a probability of 50% to perform either guided foraging or territorial foraging. In the guided foraging, each search agent is updated using equations presented in Eqs. (6)–(9). While in the territorial foraging phase. The search agents are updated using equations presented in Eqs. (10)–(12). The migration foraging is applied every 2n iteration as illustrated in Eqs. (13) and (14). The second process works on the received solutions from previous process and target to significantly change these solutions using the LEO operator (described in details in subsection “Local escaping operator (LEO)“). Depending on specific criteria ((randN < p_{r})), the final process is applied. Where (randN) is a random value between zero and one, and (P_{r}) is a probability value for performing the second process.

$$ Xb(t + 1) = left{ {begin{array}{*{20}l} {X_{LEO}^{H} quad using:LEO:operator} hfill & {IfrandN < p_{r} } hfill {Xb_{best} quad using:the:AHA:updating:process} hfill & {otherwise} hfill end{array} } right. $$
(33)

Termination criteria of the proposed mAHA

The proposed mAHA optimization process is repeated until the stopping criteria is met. The pseudo-code of the proposed mAHA algorithm is provided in Algorithm 2 and the flowchart is presented in Fig. 1.

Figure 1
figure 1

Flowchart of mAHA algorithm.

Algorithm 2
figure b

Pseudo-code of the proposed mAHA algorithm.

Application of mAHA: optimal power flow and generation capacity

Formulizing OPF mathematically

Optimizing the power system’s control variables allows the objective function of the OPF issue can be maximized to meet specific objectives. To achieve this, different equality constraints and inequality constraints must be satisfied at the same time. This optimization problem can be put into mathematical terms by explaining it in the following way:

$$min F(x, u)$$
(34)

Conditional on:

$${g}_{j}left(x,uright)=0 j=mathrm{1,2},dots ,m$$
$${h}_{j}left(x,uright)le 0 j=mathrm{1,2},dots ,p$$

where function F is the representation of the objective function. The vector (x) contains the dependent variables (state variables), while the vector (u) contains the independent variables (control variables). Additionally, ({g}_{j}) and ({h}_{j}) respectively represent the equality and inequality requirements. The variables (m) and (p) indicate the number of equality and inequality constraints.

The following are the state variables ((x)) in a power system:

$$x=left[{P}_{G1 }{,V}_{L1 }{dots {V}_{L,NPQ },Q}_{G,1}{dots {Q}_{G,NG} ,S}_{TL,1 }{dots S}_{TL,NTL}right]$$
(35)

where the power of the slack bus is denoted by ({P}_{G1}), and ({V}_{L}) denotes the load bus voltage, the reactive output power for the generator is denoted by ({Q}_{G}), the apparent power flow of the transmission line is denoted by ({S}_{TL}), the number of load buses is denoted by (NPQ), the number of generation buses is denoted by (NG), and (NTL) in the power system denotes the number of transmission lines.

In a power system, the control variables ((u)) are as follows:

$$u=left[{P}_{G,2}dots {P}_{G,NG}{,V}_{G,1 }{dots {V}_{G,NG },Q}_{C,1}{dots {Q}_{C,NC} ,T}_{1 }{dots T}_{NT}right]$$
(36)

where the generator output power is indicated by ({P}_{G}), generation bus voltage is indicated by ({V}_{G}), injected shunt compensator reactive power is indicated by ({Q}_{C}), transformer tap settings are indicated by (T), (NT) indicates transformers and shunt compensator units are indicated by (NC). It is important to note that these variables are relevant in this context.

Objective functions

It is necessary to define an objective function to select the optimal solution. Several objectives are evaluated in the OPF, considering constraints within the system. In addition, the OPF determines the system’s optimal control variables and objectives. Techno-economic advantages are associated with the most efficient OPF solution. These are sometimes called OPF objectives. As a result of these objectives, fuel costs will be reduced, resulting in a reduction in annual operating costs as well as technological benefits, such as3: Minimization of active power losses, Minimization of reactive power losses, Improvement in system reliability and power quality; Deviation of voltage; and stabilization of voltage.

Single objective functions

The objective function described above is one of the most frequently used objective functions within the field of statistics, and it can be performed as follows56:

Basic fuel costs minimization objective

The primary goal of the OPF problem is to minimize the total fuel costs, which is achieved through an objective function. For each generator, the objective function can be expressed as a quadratic polynomial function, given by:

$${F}_{1}=sum_{i=1}^{NG}{F}_{i}left({P}_{Gi}right)=sum_{i=1}^{NPV}({a}_{i}+{b}_{i}{P}_{Gi}+{c}_{i}{{P}^{2}}_{Gi}) frac{mathrm{$}}{h}$$
(37)

where, ({F}_{i}) is the (i) th generator fuel cost. ({a}_{i}), ({b}_{i}), and ({c}_{i}) are the cost coefficients for (i)th generator.

Generation emission minimization objective

It is beneficial to decrease the quantity of gas released by thermal power plants to decrease pollution. The goal for regulating gas emissions can be described as follows:

$${F}_{2}=sum_{i=1}^{NG}({gamma }_{i}{{P}^{2}}_{Gi}+{beta }_{i}{P}_{Gi}+{alpha }_{i}{+{upzeta }_{i} exp(lambda }_{i}{P}_{Gi})$$
(38)

where, ({gamma }_{i}), ({beta }_{i}), ({alpha }_{i}),({upzeta }_{i}), and ({lambda }_{i}) are the (i) th generator’s emission coefficients.

Active power losses minimization objective

The intended goal is to reduce the actual power loss, and this can be expressed in the following manner:

$${F}_{3}=sum_{i=1}^{NTL}{G}_{ij}({{V}^{2}}_{i}+{{V}^{2}}_{j}-2 {V}_{i}{V}_{j}mathrm{cos}{delta }_{ij}) mathrm{MW}$$
(39)

where, ({G}_{ij}) is the transmission conductance, NTL is the transmission lines number, and ({delta }_{ij}) is the voltages phase difference.

Voltage deviation

Using this objective function, minimizing the deviation of voltages on the load nodes from a predetermined voltage is possible. The following formula can describe this:

$${F}_{4}=VD=sum_{i=1}^{NPQ}left|{V}_{i}-1right|$$
(40)

Multi-objective functions

When dealing with a multi-objective issue, the main aim is to optimize various objectives that are independent of each other, and this is defined in the following equation:

$$Min Fleft(x,uright)=left[{F}_{1}left(x,uright),{F}_{2}left(x,uright),dots ,{F}_{i}left(x,uright)right]$$
(41)

where (i) is the number of the objective function, the optimization with the weighting factors as follows can be used to solve multi-objective functions:

$$Min {F}_{i}=sum_{i=1}^{4}{F}_{i}left(x,uright)$$
(42)
$${F}_{i}left(x,uright)={F}_{1}+{w}_{1}{F}_{2}+{w}_{2}{F}_{3}+{w}_{3}{F}_{4}$$
(43)
$$ begin{aligned}{F}_{i}left(x,uright)&=sum_{i=1}^{NG}left({a}_{i}+{b}_{i}{P}_{Gi}+{c}_{i}{{P}^{2}}_{Gi}right)+{w}_{1}sum_{i=1}^{NG}({gamma }_{i}{{P}^{2}}_{Gi}+{beta }_{i}{P}_{Gi}+{alpha }_{i}{+{upzeta }_{i} exp(lambda }_{i}{P}_{Gi}) &quad+{w}_{2}sum_{i=1}^{NTL}{G}_{ij}({{V}^{2}}_{i}+{{V}^{2}}_{j}-2 {V}_{i}{V}_{j}mathrm{cos}{delta }_{ij})+{w}_{3}sum_{i=1}^{NPQ}left|{V}_{i}-1right|end{aligned} $$
(44)

where ({w}_{11}), ({w}_{2}) and ({w}_{3}) are weight factors chosen based on the relative importance of one goal to another. Suitable weighting factors are selected by the user. In this paper, the values of the weight factors are chosen for each case as mentioned below:

Case no.

Description

Objective function

Wight factors

Network

Control variable no

1

Minimization of fuel cost

({F}_{1}=sum_{i=1}^{NPV}({a}_{i}+{b}_{i}{P}_{Gi}+{c}_{i}{{P}^{2}}_{Gi}))

Standard IEEE 30 & 118 bus

24/128

2

Minimization of active power losses

({F}_{3}=sum_{i=1}^{NTL}{G}_{ij}({{V}^{2}}_{i}+{{V}^{2}}_{j}-2 {V}_{i}{V}_{j}mathrm{cos}{delta }_{ij}))

Standard IEEE 30 & 118 bus

24/128

3

Minimization of total voltage deviation

({F}_{4}=sum_{i=1}^{NPQ}left|{V}_{i}-1right|)

Standard IEEE 30 & 118 bus

24/128

4

Minimization of fuel cost and power losses

({F}_{i}left(x,uright)={F}_{1}+{w}_{1}{F}_{3})

({w}_{1}=20)

Standard IEEE 30

24

5

Minimization of fuel cost and total voltage deviation

({F}_{i}left(x,uright)={F}_{1}+{w}_{1}{F}_{4})

({w}_{1}=200)

Standard IEEE 30

24

6

Minimization of fuel cost and power loss with emission

({F}_{i}left(x,uright)={F}_{1}+{w}_{1}{F}_{2}+{w}_{2}{F}_{3})

({w}_{1}=0.0021, {w}_{2}=20)

Standard IEEE 30

24

7

Minimization of multi-objective function (voltage-level deviation, operational cost, and transmission power loss) without emission

({F}_{i}left(x,uright)={F}_{1}+{w}_{1}{F}_{3}+{w}_{2}{F}_{4})

({w}_{1}=200, {w}_{2}=100)

Standard IEEE 30 & 118 bus

24/128

8

Minimization of multi-objective function (voltage-level deviation, operational cost, and transmission power loss) with emission

({F}_{i}left(x,uright)={F}_{1}+{w}_{1}{F}_{2}+{w}_{2}{F}_{3}+{w}_{3}{F}_{4})

({w}_{1}=0.0065, {w}_{2}=200, {w}_{3}=100)

Standard IEEE 30

24

9

Optimal allocation for renewable energy sources for minimizing fuel cost

({F}_{1}=sum_{i=1}^{NPV}({a}_{i}+{b}_{i}{P}_{Gi}+{c}_{i}{{P}^{2}}_{Gi}))

Standard IEEE 30

3

10

Minimization of the fuel cost with the penetration of RES

({F}_{1}=sum_{i=1}^{NPV}({a}_{i}+{b}_{i}{P}_{Gi}+{c}_{i}{{P}^{2}}_{Gi}))

Modfied IEEE 30

24

11

Minimization of the fuel cost simultaneously with the penetration of RES

({F}_{1}=sum_{i=1}^{NPV}({a}_{i}+{b}_{i}{P}_{Gi}+{c}_{i}{{P}^{2}}_{Gi}))

Standard IEEE 30

27

System constraints

There are already many constraints in the system that can be classified as follows:

The equality constraints

The equality constraints for the balanced load flow equations are as follows:

$${P}_{Gi}-{P}_{Di}=left|{V}_{i}right|sum_{j=1}^{NB}left|{V}_{j}right|({G}_{ij}mathrm{cos}{delta }_{ij}+{B}_{ij}sin{delta }_{ij})$$
(45)
$${Q}_{Gi}-{Q}_{Di}=left|{V}_{i}right|sum_{j=1}^{NB}left|{V}_{j}right|({G}_{ij}mathrm{cos}{delta }_{ij}+{B}_{ij}sin{delta }_{ij})$$
(46)

where ({P}_{Gi}) and ({Q}_{Gi}) are the active power and reactive power generated respectively at bus (i). The active and reactive demand of the load at bus (i) are represented by ({P}_{Di}) and ({Q}_{Di}), respectively.({G}_{ij}) and ({B}_{ij}) represent conductance and susceptibility among buses (i) and (j), respectively.

Inequality constraints

The classification of inequality constraints is as follows:

$$mathrm{Active ,,output ,,power,, of ,,generators}: {{P}_{Gi}}^{min}le {P}_{Gi}le {{P}_{Gi}}^{max} i=mathrm{1,2},dots ,NG$$
(47)
$$mathrm{Voltages ,,at ,,generators ,,buses}: {{V}_{Gi}}^{min}le {V}_{Gi}le {{V}_{Gi}}^{max} i=mathrm{1,2},dots ,NG$$
(48)
$$mathrm{Reactive ,,output ,,power ,,of ,,generators}: {{Q}_{Gi}}^{min}le {Q}_{Gi}le {{Q}_{Gi}}^{max} i=mathrm{1,2},dots ,NG$$
(49)
$$mathrm{Tap,, settings ,,of,, transformer}: {{T}_{i}}^{min}le {T}_{i}le {{T}_{i}}^{max} i=mathrm{1,2},dots ,NT$$
(50)
$$mathrm{Shunt ,,VAR ,,compensator}: {{Q}_{Ci}}^{min}le {Q}_{Ci}le {{Q}_{Ci}}^{max} i=mathrm{1,2},dots ,NC$$
(51)
$$mathrm{Apparent ,,power ,,flows,, in,,transmission,, lines}: {S}_{Li}le {{S}_{Li}}^{min} i=mathrm{1,2},dots ,NTL$$
(52)
$$mathrm{Magnitude ,,of ,,load ,,buses,, voltage}: {{V}_{Li}}^{min}le {V}_{Li}le {{V}_{Li}}^{max} i=mathrm{1,2},dots ,NPQ$$
(53)

The incorporation of dependent control variables can be achieved seamlessly in an optimization solution by utilizing the quadratic penalty formulation of the objective function. In this paper, the optimization problem can be rewritten based on the penalty functions as follows:

$${F}_{g}left(x,uright)={F}_{i}left(x,uright)+{K}_{G}{(Delta {P}_{G1})}^{2}+{K}_{Q}sum_{i=1}^{NPV}{left(Delta {Q}_{Gi}right)}^{2}+{K}_{V}sum_{i=1}^{NPQ}{(Delta {V}_{Li})}^{2}+{K}_{S}sum_{i=1}^{NTL}{left(Delta {S}_{Li}right)}^{2}$$
(54)

where ({K}_{G}), ({K}_{Q}), ({K}_{V}), and ({K}_{S}) are penalty factors with large positive values, also (Delta {P}_{G1}), (Delta {Q}_{Gi}), (Delta {V}_{Li}), and (Delta {S}_{Li}) are penalty conditions that can be stated as follows:

$$Delta {P}_{G1}= left{begin{array}{c}left({P}_{G1}-{{P}_{G1}}^{max}right) {P}_{G1}>{{P}_{G1}}^{max} left({P}_{G1}-{{P}_{G1}}^{min}right){ P}_{G1}<{{P}_{G1}}^{min} 0 {{P}_{G1}}^{min}<{P}_{G1}<{{P}_{G1}}^{max}end{array}right.$$
(55)
$$Delta {Q}_{Gi}= left{begin{array}{c}left({Q}_{Gi}-{{Q}_{Gi}}^{max}right) {Q}_{Gi}>{{Q}_{Gi}}^{max} left({Q}_{Gi}-{{Q}_{Gi}}^{min}right){ Q}_{Gi}<{{Q}_{Gi}}^{min} 0 {{Q}_{Gi}}^{min}<{Q}_{Gi}<{{Q}_{Gi}}^{max}end{array}right.$$
(56)
$$Delta {V}_{Li}= left{begin{array}{c}left({V}_{Li}-{{V}_{Li}}^{max}right) {V}_{Li}>{{V}_{Li}}^{max} left({V}_{Li}-{{V}_{Li}}^{min}right){ V}_{Li}<{{V}_{Li}}^{min} 0 {{V}_{Li}}^{min}<{V}_{Li}<{{V}_{Li}}^{max}end{array}right.$$
(57)
$$Delta {S}_{Li}= left{begin{array}{c}left({S}_{Li}-{{S}_{Li}}^{max}right) {S}_{Li}>{{S}_{Li}}^{max} ({S}_{Li}-{{S}_{Li}}^{min}){ S}_{Li}<{{S}_{Li}}^{min} 0 {{S}_{Li}}^{min}<{S}_{Li}<{{S}_{Li}}^{max}end{array}right.$$
(58)

Evaluated results and discussion

This section describes two experiments to assess mAHA performance using different metrics. The first experiment used mAHA on 10 problems taken from the CEC2020 benchmark functions57, while the second experiment focused on testing mAHA’s effectiveness in solving the OPF problem. The OPF problem was tested on the IEEE 30-bus system.

Experimental Series 1: global optimization with CEC’2020 test-suite

Several benchmark function challenges presented by the CEC’2020 illustrate how well the mAHA performs. Several well-known metaheuristic methodologies are compared with this mAHA technique to evaluate its effectiveness: the WOA58, the SCA59, the TSA60, the SMA61, the HHO, the RUN63, and the basic AHA algorithm52.

Definition of CEC’20 benchmark functions

In order to evaluate the proposed method’s performance, IEEE CEC’2020 benchmarks64 were used as test problems to estimate its performance. As part of the benchmarking process, 10 different test functions have been included to cover uni-modal, multi-modal, hybrid, and composition test functions. Here are the benchmark test characteristics and mathematical equations, with ‘Fi*’ denoting the optimal global value. Figure 2, three-dimensional views of CEC’2020 functions (Table 2).

Figure 2
figure 2

The 3D visualization of the CEC’2020 functions.

Table 2 Describing the CEC’2020 test-suite.

Parameter settings

To compare the mAHA algorithm and other algorithms, 30 runs were conducted. All considered problems had a fixed number of function evaluations (Fes) set at 30,000. Table 3 displays the parameter settings for each algorithm, as reported in the original literature. Qualitative and quantitative metrics were utilized to evaluate the algorithms’ effectiveness.

Table 3 Setting of parameters for the compared algorithms.

Performance criteria

The proposed algorithm’s efficiency in finding the best solutions is evaluated against comparison algorithms using a collection of performance metrics in this paper. The definitions for these metrics are outlined below:

Statistical mean: This metric determines the fitness value that is situated in the center, and it is computed using the following equation:

$$ Mean = frac{1}{{R_{n} }}sumlimits_{j = 1}^{{R_{n} }} F itt_{b}^{i} $$
(59)

The worst value: This metric is utilized to compute the highest fitness value that the algorithm can achieve, and it is defined as:

$$ WORST = max_{{1 le j le R_{n} }} Fitt_{b}^{i} $$
(60)

The best value: This metric computes the minimum fitness value, and it can be defined as follows:

$$ BEST = min_{{1 le j le R_{n} }} Fitt_{b}^{i} $$
(61)

Standard deviation (STD): The STD is calculated by the following equation:

$$ STD = sqrt {frac{1}{{R_{n} – 1}}sumlimits_{j = 1}^{{R_{n} }} {(Fitt_{b}^{i} – Mean)^{2} } } $$
(62)

where (R_{n}) represents the total number of runs.

Statistical investigation on CEC’2020 test-suite

The proposed mAHA algorithm is compared to WOA, SCA, TSA, SMA, HHO, RUN, and AHA on the CEC’2020 test suite, and statistical results are obtained. A measure of the algorithm’s performance is assessed by calculating the mean value and standard deviation of the best-so-far solutions obtained within each run. Based on the dimension ‘Dim = 10’ of the CEC’2020 test suite, Table 4 displays mean, standard deviation, best, and worst values. Boldfaced values highlight the most appropriate values.

Table 4 Fitness values generated by competitor algorithms over 30 experiments conducted for CEC’2020.

As shown in Table 4, the results show that the mAHA technique reaches the optimum value with respect to the single-modal benchmark function F1 for the unimodal model. There is no doubt that mAHA has an advantage over the algorithms which are compared for multi-modal functions F2, F3, and F4 in terms of performance. Nevertheless, regarding the F4 function, the most accurate values can be obtained using mAHA, AHA, RUN, and SMA. In addition, the proposed mAHA technique performs better than any of the other methodologies regarding the hybrid F5, F6, and F7 test functions. For the composite functions F8, F9, and F10, the mAHA algorithm outperforms the other algorithms. The mAHA and AHA algorithms provide optimal F8 values. For test function F9, optimal results are achieved by the mAHA and SMA algorithms. In contrast, for the F10 test function, the mAHA, AHA, RUN, and SMA techniques achieve optimal values.

In terms of resolving the CEC’2020 benchmark functions, the statistical results indicate that the mAHA methodology performs better than any of the other methods. A comparison of the mean, the standard deviation, the best value, and the worst value can be made to reveal this. It is also noteworthy that, in the Friedman mean rank-sum test, the proposed mAHA algorithm achieved the top ranking in the Friedman algorithm test.

Boxplot behavior analysis

Boxplots are a valuable and effective tool for analyzing data visually and representing its empirical distribution. They are created by dividing the data into quartiles, with the highest and lowest whiskers representing the maximum and minimum values in the dataset. The box represents the lower and upper quartiles, providing insight into the data’s spread and level of agreement. When the box is narrow, it indicates a high degree of symmetry in the data.

Figure 3 shows the boxplot distribution for the CEC’20 test functions from F1 to F10 with a dimension of 10. The results of the introduced mAHA algorithm demonstrate narrower boxplots and minimum values compared to other algorithms for most test methods. These graphical results confirm the mAHA algorithm’s consistency in finding optimal regions for the test problems.

Figure 3
figure 3

Boxplot curves of the proposed mAHA, as well as the other compared algorithms, were obtained over the CEC’2020 test suite with a Dim of 10.

Evaluation of convergence performance

Algorithm convergence is discussed in this subsection. For CEC 2020 test problems for dimension 10, Fig. 3 compares WOA, SCA, TSA, SMA, HHO, RUN, and AHA to the developed mAHA. Figure 4a shows that the F1 function with a unimodal space exhibits convergence curves. It has been demonstrated that the proposed mAHA is superior to the original AHA and all other algorithms compared. It is evident in Fig. 3b–d that the developed mAHA algorithm displays a greater level of exploration than the standard OPA algorithm and the other algorithms that have been compared on the benchmark functions of F2–F4. Using the benchmark F5 function, the proposed mAHA and the original AHA have significant results, as illustrated in Fig. 3e–g. A significant performance improvement was also achieved by the mAHA for functions F6 and F7. Therefore, the mAHA is more effective at handling hybrid functions. It was demonstrated from the composition functions (F8, F9, and F10) in Figs. 3h–j that the proposed mAHA was able to solve problems involving complex spaces with comparable performance.

Figure 4
figure 4

Convergence curves of mAHA and the other methodologies estimated on CEC’20 functions.

Experimental series 2: applying mAHA for solving OPF problems

On the IEEE 30-bus test grid, the effectiveness of the mAHA methodology is evaluated to address the OPF issue. This section compares simulation results between those obtained by mAHA and those obtained by recent metaheuristic algorithms to solve OPF. An evaluation of mAHA’s ability to minimize fuel costs, active power loss, total voltage deviation, and emissions is conducted for one-objective and multi-objective problems considering weight factors. Using the presented cases, it is possible to determine these weight factors.

mAHA’s effectiveness is further demonstrated by comparing it to other algorithms. The test is conducted on a modified IEEE 30-bus grid to determine its effectiveness in optimizing RES allocation and minimizing fuel costs. Experimental tests are used to determine which parameters are appropriate for mAHA and other methods. Each algorithm is run 30 times on the test system with different parameters. A MATLAB 2021b platform is used to apply mAHA and other comparing techniques to solve the OPF issue. This is accomplished by using a PC with a 2.8GHz I7-8700 CPU and 16 GB of RAM.

IEEE 30-bus grid

IEEE 30-bus grid has six generation power units, 41 lines, and 24 load buses66. Figure 5 shows node number 1 is a slack bus66. In terms of active power and reactive power, the total connected load has 2.834 pu of active and 1.262 pu of reactive power, respectively. A voltage magnitude of 0.95 Pu and 1.1 Pu is limited for the power-generating nodes, while a voltage magnitude of 0.95 Pu and 1.05 Pu is limited for the remaining load nodes. VAR compensator limits fluctuate between 0 and 0.05 pu, and tap-changing transformers can be adjusted between 0.9 and 1.1 pu.

Figure 5
figure 5

Standard IEEE-30 bus test system.

Case 1: minimization of fuel cost

A mAHA methodology is proposed for reducing fuel costs using only the IEEE 30-bus grid. According to Table 5, mAHA achieves optimal outcomes as opposed to other literature techniques, such as AHA, HHO, RUN, SCA, SMA, TSA, and WOA. The mAHA technique produces the lowest fuel cost of 799.135 $/h, outperforming other methodologies. The mAHA’s voltage profile is also displayed in Fig. 6, ensuring that all nodes’ voltages are within acceptable limits. As can be seen in Fig. 7, the convergence characteristics of the standard algorithm and other compared techniques are described in terms of minimizing fuel cost (over 200 iterations). According to this figure, the mAHA methodology exhibits a better convergence characteristic than other techniques, with the optimum value reached after 50 iterations; this means that the suggested technique exhibits faster convergence.

Table 5 Optimum control variables for IEEE 30-bus grid for minifying fuel cost.
Figure 6
figure 6

The voltage profile of the different techniques for case 1.

Figure 7
figure 7

The convergence characteristics of compared methods for case 1.

Also, Table 6 illustrates comparative results for minimizing the fuel cost (Case 1) with several other algorithms which are developed GWO21, Adaptive GO27, MOQRJFS28, CSO35, NBA68, MCSO35, IMFO36 and ECHT-DE37. As shown, the proposed mAHA obtain the minimum cost of 799.135 $/h among other techniques.

Table 6 Comparison results for minimizing the fuel costs (Case 1).
Case 2: minimization of active power losses

This scenario involves minimizing real power loss as a single objective function. A comparison of the optimum simulation results obtained by the mAHA technique with those obtained by other methods is presented in Table 7. A real power loss of 2.85767 MW was achieved using the mAHA methodology. Alternatively, the other techniques achieved values ranging from 2.90269 to 3.54983 MW. The voltage magnitudes on all buses are within their acceptable ranges as shown in Fig. 8. According to Fig. 9, the mAHA method and other techniques exhibit similar convergence characteristics in terms of minimizing real power loss. From this figure, it is evident that mAHA reaches its optimum solution faster than other methods.

Table 7 Optimum control variables for IEEE 30-bus grid for minifying real power loss.
Figure 8
figure 8

The voltage profile of the compared techniques for case 2.

Figure 9
figure 9

The convergence characteristics of all methods for case 2.

Case 3: minimization of total voltage deviation

The mAHA technique is employed in this scenario to minimize the total voltage deviation, as discussed in section “Preliminaries“. It is shown in Table 8 that the mAHA technique achieved optimal variables in comparison to the other algorithms. It is evident from the results that mAHA achieved the best and minimum voltage deviation values of 0.09783 pu, outperforming other algorithms such as AHA, HHO, RUN, SCA, SMA, TSA, and WOA, which resulted in values of 0.09841 pu, 0.14498 pu, 0.10214 pu, 0.24245 pu, 0.10708 pu, 0.20299 pu, and 0.12508 pu, respectively. Figure 10 illustrates that mAHA provides the most accurate voltage profile compared to other algorithms. Furthermore, Fig. 11 demonstrates that mAHA’s convergence characteristic outperforms the other compared algorithms.

Table 8 Optimal control variables for IEEE 30-bus test system for minimizing voltage deviation.
Figure 10
figure 10

The voltage profile of the compared methods for case 3.

Figure 11
figure 11

The convergence characteristics of the methods for case 3.

Case 4: minimization of fuel cost and power losses

A multi-objective function is considered in this case, which aims to minimize fuel cost and real power loss. A comparison of the most reliable simulation results obtained using the mAHA technique is presented in Table 9. Based on the mAHA technique, an objective function value of 801.8704 was obtained, significantly better than that obtained through other methods, including AHA, HHO, RUN, SCA, SMA, TSA, and WOA. Figure 12 illustrates that all voltage profiles of the buses were within their limits. As shown in Fig. 13, the convergence characteristics of the mAHA technique and the other compared techniques are related to the minimization of the cost function. Therefore, it can be concluded that the mAHA technique performs better than other algorithms when minimizing the cost function.

Table 9 Optimum control variables for the 30-bus grid to minimize fuel cost and power losses.
Figure 12
figure 12

The voltage profile of the mAHA and other compared algorithms for case 4.

Figure 13
figure 13

The convergence characteristics of mAHA and other compared algorithms for case 4.

Case 5: minimization of fuel cost and total voltage deviation

Fuel cost and voltage deviation are minimized in this case, which is considered a multi-objective function. Table 10 compares the most promising simulation results obtained using the mAHA technique with those obtained using other approaches. The mAHA technique yielded an objective function value of 824.0697, which is better than the values obtained using other techniques, such as AHA, HHO, RUN, SCA, SMA, TSA, and WOA, which yielded values of 824.9193, 839.7303, 829.941, 882.0512, 825.729, 856.5994, and 839.5122, respectively. The voltage profiles of all buses were found to be within their limits, as shown in Fig. 14. Based on Fig. 15, the mAHA technique and other comparable techniques are compared in terms of minimizing the cost function. As a result, it can be concluded that the mAHA technique performs better than the other algorithms when minimizing the cost function.

Table 10 Optimum control variables for the 30-bus system for minifying fuel cost and voltage deviation.
Figure 14
figure 14

The voltage profile of the compared techniques for case 5.

Figure 15
figure 15

The convergence characteristics of all compared methodologies for case 5.

Case 6: minimization of fuel cost and power loss with emission

This case involves minimizing fuel costs, losses, and emissions, which are considered multi-objective functions. Table 11 presents simulation results using mAHA and other techniques. The mAHA technique yielded an objective function value of 801.9032, which is better than the values obtained using other techniques such as AHA, HHO, RUN, SCA, SMA, TSA, and WOA, which yielded values of 801.9555, 806.5996, 801.9119, 806.0495, 801.9381, 804.2416, and 802.8859, respectively. The voltage profiles of all buses were found to be within their limits, as shown in Fig. 16. A comparison of mAHA with other compared techniques is shown in Fig. 17 for minimizing the cost function. Based on the comparative results, it can be concluded that the mAHA technique outperforms other algorithms in minimizing the cost function.

Table 11 Optimum control variables for the 30-bus network for minifying fuel cost and power loss with emission.
Figure 16
figure 16

The voltage profile of the mAHA with other compared techniques for case 6.

Figure 17
figure 17

The convergence characteristics of mAHA via other compared methodologies for case 6.

Case 7: minimization of multi objective function without emission

Using weighting factors to optimize multiple objective functions simultaneously is recommended, as discussed in section “Application of mAHA: optimal power flow and generation capacity“. This is to ensure that the proposed scheme provides maximum benefits. The mAHA technique was compared to other methodologies in Table 12 for solving the multi-objective OPF issue (fuel cost, real power losses, and total voltage deviation) in the IEEE-30 bus network without considering emissions. The results demonstrate that mAHA is more effective than other techniques in solving multiple objectives OF issues. A total objective function value of 833.5196 achieved by mAHA is better than all other methodologies; AHA, HHO, RUN, SCA, SMA, TSA, and WOA achieved results of 833.594, 847.0193, 835.655, 865.4373, 833.594, 848.0131, and 844.0074 without violating the considered constraints. All compared techniques show voltage profiles within the designated limits, similar to previous cases in Fig. 18. Moreover, as shown in Fig. 19, mAHA’s convergence characteristics are the fastest.

Table 12 Optimum control variables for the 30-bus grid for minifying fuel cost, power loss, and voltage deviation.
Figure 18
figure 18

The voltage profile of the mAHA with the other compared techniques for case 7.

Figure 19
figure 19

The convergence characteristics of the compared methods for case 7.

Case 8: minimization of multi-objective function with emission

According to Table 13, the mAHA algorithm outperformed the other compared algorithms for solving a multi-objective OPF problem in the IEEE 30-bus testing system. From this table, mAHA offers the best objective function at 864.735 compared to the other techniques. For all algorithms compared in Fig. 20, the voltage profiles indicate that all voltages are within the specified range. As shown in Fig. 21, mAHA has fast convergence, outperforming all other algorithms.

Table 13 Optimum control variables for the 30-bus grid for minifying multi-objective function with emission.
Figure 20
figure 20

The voltage profile of the mAHA with the other compared techniques for case 8.

Figure 21
figure 21

The convergence characteristics of all compared techniques for case 8.

Case 9: optimal allocation for renewable energy sources for minimizing fuel cost

To validate the efficacy of mAHA’s proposed algorithm for integrating renewable sources into the power grid, simulations were carried out on the 30-bus grid to minimize fuel costs. A comparison between the results produced by mAHA and other methodologies can be seen in Table 14. Simulated results show the mAHA technique to be the most efficient, producing the lowest fuel cost at node 27, achieving 775.9469 $/h, outperforming the other techniques. Specifically, the AHA, HHO, RUN, SCA, SMA, TSA, and WOA algorithms achieve results of 775.9475 $/h, 803.5182 $/h, 775.9475 $/h, 776.1083 $/h, 775.9472 $/h, 775.9469 $/h, and 782.0199 $/h, respectively. Additionally, Fig. 22 shows the voltage profile obtained by mAHA, indicating that all bus voltage magnitudes are within acceptable limits. In Fig. 23, mAHA and other compared algorithms are compared regarding their convergence characteristics. It can be seen from the figure that mAHA produces better convergence characteristics than the other algorithms compared. OPF complexity increases as renewable energy sources are integrated into electrical power systems. Based on existing results, this issue has been solved using the mAHA technique.

Table 14 Optimum RES allocation for the 30-bus grid to minimize the fuel costs.
Figure 22
figure 22

The voltage profile of the compared algorithms for case 9.

Figure 23
figure 23

The convergence characteristics of all compared algorithms for case 9.

Case 10: minimization of the fuel cost with the penetration of RES

To demonstrate the effectiveness of the proposed mAHA technique, it was compared to recent algorithms for minimizing fuel cost in a single objective OPF issue. The modified IEEE 30-bus system used in case 9 was employed, including RES with optimal allocation. Table 15 presents the results, indicating that mAHA achieved the lowest fuel cost of 636.05 $/h, compared to 636.07 $/h, 638.55 $/h, 636.0871 $/h, 644.9163 $/h, 635.9247 $/h, 636.9435 $/h, and 636.3569 $/h obtained by AHA, HHO, RUN, SCA, SMA, TSA, and WOA, respectively. Furthermore, the proposed mAHA algorithm has superior performance compared to case 1. Using the proposed mAHA algorithm in case 1, fuel cost minimization was achieved at 799.135 $/h, which is higher than the cost minimization achieved by integrating renewable energy sources at 636.05 $/h, adding complexity to the OPF issue. As shown in Fig. 24, all buses have voltage profiles within the limits of their capacity. According to Fig. 25, mAHA and other algorithms are comparable regarding fuel cost convergence. Comparing mAHA with other algorithms, the results show that mAHA exhibits superior convergence characteristics.

Table 15 Optimum control variables for modified 30-bus grid to decrease the fuel cost.
Figure 24
figure 24

The voltage profile of the compared techniques for case 10.

Figure 25
figure 25

The convergence characteristics of all compared methods for case 10.

Case 11: minimization of the fuel cost simultaneously with the penetration of RES

To demonstrate the effectiveness of the proposed mAHA algorithm, it was compared to other recent algorithms for solving the OPF problem with a single objective function of minimizing fuel cost. The algorithms were tested on a standard IEEE 30-bus system, and Table 16 shows the results. The mAHA algorithm yielded the lowest fuel cost of 285.8574 $/h, outperforming the other algorithms, which achieved fuel costs of 293.04 $/h, 320.71 $/h, 291.51 $/h, 387.2075 $/h, 285.8574 $/h, 296.68 $/h, and 330.0022 $/h for AHA, HHO, RUN, SCA, SMA, TSA, and WOA, respectively.

Table 16 Optimum control variables for the 30-bus network to minimize fuel cost incorporating RES.

Moreover, the proposed mAHA algorithm’s superiority is confirmed compared to previous cases (case 1 and case 10). In case 1 and case 10, the mAHA algorithm achieved fuel cost minimization with values of 799.135 $/h and 636.05 $/h, respectively. These values are higher than the fuel cost achieved by the proposed mAHA algorithm, which solved the OPF problem simultaneously with integrating renewable energy sources and achieved fuel cost minimization with a value of 285.8574 $/h.

As can be seen in Fig. 26, all buses are within acceptable voltage limits. As shown in Fig. 27, the mAHA algorithm’s convergence characteristics outperform the other compared techniques regarding fuel cost convergence.

Figure 26
figure 26

The voltage profile of the compared techniques for case 11.

Figure 27
figure 27

The convergence characteristics of all compared methodologies for case 11.

Upon comparing the proposed mAHA’s boxplots with the ones of other methods, it can be observed that these are extremely tight for all cases, with the lowest values shown in Fig. 28.

Figure 28
figure 28figure 28

The boxplot of mAHA and other compared methodologies for the IEEE 30-bus grid.

Also, a Wilcoxon signed rank sum test has been done to compare performance between any two algorithms. This test provides a fair comparison between the proposed mAHA method and the other suggested optimization methods on a specific study case using a signed rank test. Store all fitness values over 30 runs of the objective in a case study for both algorithms. Calculate (p)-value which governs the significance of results in a statistical hypothesis test. The argument against null hypothesis ({H}_{0}) is stronger the smaller the (p)-value. The results obtained using the Wilcoxon signed rank test are offered in Table 17. The column ({H}_{0}) defines whether the null hypothesis is valid or not. If the null hypothesis is valid (i.e. ({H}_{0}) = “1” with a significance level, (alpha ) = 0.05), the performance of the two methods is statistically the same for the study case. The mAHA and AHA perform evenly in cases 1, 3, 4, 5, 6, 7, and 9 while mAHA and SMA are equally in cases 1, 4, and 5. The RUN and TSA performances against AHA are equal in cases 6 and 9 respectively. In the leftover cases, mAHA is found to be superior. Finally, the test findings show that when used to solve the OPF issue in various scenarios, the mAHA outperforms the other optimization approaches, especially for a large number of control variables (large problem) as mentioned in case 11..

Table 17 Wilcoxon signed-rank sum test for IEEE 30 bus test system.

IEEE 118-bus grid

To assess the scalability and effectiveness of the mAHA method for resolving large-scale OPF issues, the IEEE 118-bus standard network is considered. The whole data set for this system is cited in33. Sixty-four load buses, 54 generating units, and 186 branches make up the network. Switchable shunt capacitors are included on twelve buses: 34, 44, 45, 46, 48, 74, 79, 82, 83, 105, 107, and 110. At lines 8–5, 26–25, 30–17, 38–37, 63–59, 64–61, 65–66, 68–69, and 81–80, nine tap-altering transformers have been installed as shown in Figur 29. All buses have voltage magnitude restrictions between [0.95 pu and 1.1 pu]. Each regulating transformer tap’s lowest and maximum values fall within (0.9 1.1) range.

Figure 29
figure 29

Standard IEEE 118 bus.

Case 1: fuel cost minimization

In this part, the OPF issue of the IEEE 118-bus network is solved using the mAHA method without DG. The aim function is cost reduction. Figures 30 and 31 illustrate the voltage profile and cost-saving mAHA algorithm’s convergence graph. The graphic demonstrates the mAHA algorithm’s good convergence characteristic while handling a significant optimization challenge. Table 18 lists the ideal cost reduction values and control variable modifications. The mAHA algorithm found a better solution. The results show how effective the mAHA technique is in quickly converging on the best answer. These findings demonstrate the mAHA algorithm’s effectiveness for resolving significant OPF issues and confirm its scalability.

Figure 30
figure 30

The voltage profile of the compared methodologies for case 1.

Figure 31
figure 31

The convergence characteristics of the compared techniques for case 1.

Table 18 Optimum control variables for the 118-bus grid to reduce the fuel cost.
Case 2: real power losses reduction

In this situation, active power loss reduction was the objective function. The results of using the mAHA method to arrive at the optimal solution are shown in Table 19. The mAHA algorithm effectively identifies the best control variable values that minimize system losses. As a result, real power losses dramatically dropped to 38.665089 MW when the mAHA algorithm was run without considering DG. Figure 32 illustrates the resilience and accuracy of the mAHA method by showing that the solution found using the mAHA algorithm isn’t violated at any bus, whereas other approaches are violated at multiple system load buses. Figure 33 shows the sharp convergence of real power losses based on the mAHA algorithm compared to other comparative methods. The mAHA method reaches the optimal result after only 20 iterations, demonstrating its rapid convergence. In order to evaluate the algorithm’s efficiency, the estimated real power loss value is compared with that discovered using previously published population-based optimization techniques.

Table 19 Optimum control variables for the 118-bus network to minimize real power losses.
Figure 32
figure 32

The voltage profile of all compared techniques for case 2.

Figure 33
figure 33

The convergence characteristics of the compared methodologies for case 2.

Case 3: voltage deviation minimization

Voltage deviation is chosen as the target function to be improved using the mAHA algorithm to improve the voltage profile. Figure 34 illustrates that, unlike other algorithms, the mAHA algorithm could maintain the allowed voltage constraints. Figure 35 shows the trend of decreasing system voltage deviation. Table 20 presents the findings. The results show that when employing the mAHA method, the voltage deviation index is 0.4264959 pu. Table 18 compares solutions achieved using the mAHA method and other population-based optimization techniques, with the former yielding superior results.

Figure 34
figure 34

The voltage profile of the mAHA and other compared algorithms for case 3.

Figure 35
figure 35

The convergence characteristics of mAHA and other compared algorithms for case 3.

Table 20 Optimum control variables for the 118-bus network to optimize voltage deviation.
Case 4: lessening of several objective functions devoid of emissions

In order to obtain the full benefits of the planned test system, a multi-objective function minimizes fuel operational cost, transmission power loss, and voltage-level deviation is implemented. According to Table 21, the multi-objective OPF issue was tackled by using mAHA in conjunction with other comparative algorithms without considering emissions. Several OF problems can be solved more economically by adopting mAHA than other comparable algorithms. As a result, the total objective function with 133,257.99 $/h based on mAHA technique outperforms all other algorithms with 134,581.11 $/h, 147,663.18 $/h, 137,402.63 $/h, 431,355.38 $/h, 133,921.61 $/h, 431,849.5 $/h and 143,003.58 $/h achieved by AHA, HHO, RUN, SCA, SMA, TSA, and WOA, respectively. All voltage profiles are within the specified limits except for the TSA algorithm, as illustrated in Fig. 36. Furthermore, mAHA still demonstrates quick and smooth convergence characteristics, as seen in Fig. 37. Based on the proposed mAHA algorithm, the boxplots in Fig. 38 display the lowest values for fuel cost, real power losses, and total voltage deviation. As illustrated previously, the boxplots of the proposed mAHA show a high degree of susceptibility to reducing the cost function with the lowest values.

Table 21 Optimum control variables for the 118-bus grid to optimize the multi-objective function.
Figure 36
figure 36

The voltage profile of the compared techniques for case 5.

Figure 37
figure 37

The convergence characteristics of all methodologies for case 5.

Figure 38
figure 38

The boxplot of mAHA and other compared algorithms for IEEE 118 bus network.

Further, a Wilcoxon signed rank sum test has been executed to compare performance between proposed algorithms. Thirty independent runs are implemented in the test. The selected level of significance is 5%. The (p)-values determined by Wilcoxon’s rank-sum test are shown in Table 22. The ({H}_{0}) values obtained from the test is “0” meaning the null hypothesis is rejected among the optimization algorithms for most cases except case 2 and case 3, where the mAHA and RUN perform equally. In the leftover cases, mAHA is found to be excellent. It can be concluded from the test results that the mAHA is a choice to the other optimization methods when applied to solve the OPF problems under several cases.

Table 22 Wilcoxon signed-rank sum test for IEEE 118 bus test system.

Table 23 illustrates comparative results for minimizing the fuel cost (Case 1), power losses (Case 2), voltage deviation (Case 3), and multi-objective function (Case 4) with several other algorithms which are developed SDO, LSDO, PSOIWA, PSOCFA, RGA, BBO, MSA, ABC, CSA, GWO, BSOA, and MJAYA67,68,69. As shown, the proposed mAHA obtain the minimum objective function for all cases among other techniques.

Table 23 Comparison results for IEEE 118 bus test system.

Conclusion

This research develops mAHA, a novel optimizer for dealing with OPF issues, including fuel cost, power loss, voltage profile improvement, and emissions. Additionally, eight approaches for multi-objective and single-objective OPF were presented. The proposed methods were evaluated and confirmed on standard and modified IEEE 30 bus and IEEE 118 bus networks, among others. As a result, the results indicated that the optimum allocation of renewable energy sources (RES) concurrent with the OPF produces better results than if it happens separately. Distributed generation (DG) location and size were added as control variables. As a result, the OPF issue dimension was also expanded. In addressing the OPF optimization issue, mAHA demonstrated excellent performance and efficacy.

Additionally, the most promising results from IEEE Power Networks demonstrate the effectiveness of the suggested approach. Compared to other recent algorithms, the mAHA mitigated the objective functions better in all cases. Based on the comparison results in the case of IEEE 30 bus system, mAHA demonstrated an improvement reduction of single objective functions of 92.874% (Fuel cost), 80.254% (Power losses), and 91.49% (voltage deviation) when compared to AHA, HHO, RUN, SCA, SMA, TSA, WOA, and other published techniques. Furthermore, the comprehensive study of mAHA with the mentioned methodologies has shown that mAHA has met the minimum objective function of 864.735. Additionally, in comparison with the other algorithms, mAHA has the highest fuel cost reduction of 97.451% in the case of minimizing the fuel cost while simultaneously deploying renewable energy sources. As shown in the case of the IEEE 118 bus system, mAHA was superior to other optimizers in finding the global optimum solution of the objective function cases.

Therfore, it is clear that the mAHA outperformed these recent algorithms irrespective of their objective functions, which shows that the mAHA is capable of solving other real-life applications. The OPF problem can be solved by incorporating RES uncertainties in future work for handling as a real problem. Also, the suggested mAHA can be modified or mixed with other metaheuristic algorithms in upcoming work to address other complex optimization problems in dissimilar fields, for example, optimally allocated generation when RES are vague, optimal hybrid RES planning, estimating fuel cell parameters, and modeling photovoltaic systems.