An effective quantum artificial rabbits optimizer for energy management in microgrid considering demand response

Solving the energy management (EM) problem in microgrids with the incorporation of demand response programs helps in achieving technical and economic advantages and enhancing the load curve characteristics. The EM problem, with its large number of constraints, is considered as a nonlinear optimization problem. Artificial rabbits optimization has an exceptional performance, however there is no single algorithm can solve all engineering problem. So, this paper proposes a modified version of artificial rabbits optimization algorithm, called QARO, by quantum mechanics based on Monte Carlo method to determine the optimal scheduling for MG resources effectively. The main objective is minimization of the daily operating cost with the maximization of MG operator (MGO) benefit. The operating cost includes the conventional diesel generator operating cost and the cost of power transactions with the grid. The performance of the proposed algorithm is assessed using different standard benchmark test functions. A ranking order for the test function based on the average value and Tied rank technique, Wilcoxon's rank test based on median value, and Anova Kruskal–Wallis test showed that QARO achieved best results on the most functions and outperforms all other compared technique. The obtained results of the proposed QARO are compared with those obtained by employing well-known and newly-developed algorithms. Moreover, the proposed QARO is used to solve two case studies of day-ahead EM problem in MG, then the obtained results are also compared with other well-known optimization techniques, the results demonstrate the effectiveness of QARO in reducing the operating cost and maximization the MGO benefit.


Introduction
Microgrids (MGs) are small-scale networks, which consist of renewable energy sources (RES), conventional generation sources, energy storage systems (ESS), and controllable/non-controllable loads (Lasseter and Microgrids 2002;Shivam and Dahiya 2018).The flexible operation of MGs resources enables the possibility of using various optimization techniques to achieve technical, environmental and economic benefits (Phani Raghav et al. 2022).Energy management systems (EMS) are required for MGs to achieve objectives, such as minimization of operating costs, reduced losses, and improved reliability.These objectives depend on the efficient management of resources, flexible loads, and energy transactions with the grid (Parisio et al. 2014).MG's energy management (EM) recently received great attention for MG's resources optimal operation.
Different structures have been proposed for EMS utilizing a variety of optimization algorithms and energy sources.To reduce the operating cost in MG, a multi-objective genetic algorithm (MOGA) is employed in Torkan et al. (2022).Ref. Aguila-Leon et al. (2022), a Particle swarm optimization (PSO) algorithm is employed to incorporate the RESs to the EMS of the MG efficiently.A developed manta ray foraging optimization (DMRFO) in Dong et al. (2022) is used to reduce the operating cost and emissions in the MG.For MG capacity planning, Ref. Bukar et al. (2022) employed seven different optimization algorithms: grey wolf optimization (GWO), dragonfly algorithm (DFA), cuckoo search algorithm (CSA), the grasshopper optimization algorithm (GOA), Salp swarm algorithm (SSA), ant lion optimization (ALO), and PSO.
By integrating intelligent technologies in MGs, communication may be created between MG consumers and the EMS, as well as between the EMS and the main grid.Thus, Demand response programs (DRP) can contribute significantly to cost savings (Rahimiyan et al. 2014).Also, the use of DRP can enhance the load curve by allowing the positive contribution of the customers (Palensky and Dietrich 2011).DR is defined as changing customers' power consumption in response to fluctuating electricity prices or incentive payments (Aalami et al. 2010).There are two different categories of DR: Incentive-based DR (IDR) and price-based DR (Jordehi 2019).Numerous studies have been conducted on the efficient implementation of DR into and its contribution to the demand-supply balance, grid reliability, and performance, particularly in MG with its distributed generation (DG) sources.Robert et al. (2018) and Parisio et al. (2014) examined the effectiveness of integrating DR with MG in order to achieve environmental and economic benefits.In Shehzad Hassan et al. (2019) PDR is incorporated in the EMS of the MG, using PSO the MG's profit is maximized for different pricing strategies.In Faria et al. (2013), to reduce the MG's operating cost PSO algorithm was employed in EMS for achieving optimal scheduling to the DR and MG.A genetic algorithm (GA) is used in Wang et al. (2018) for optimal scheduling of MG's resources with a PDR program.Also, GA is embedded in the EMS of MG for reduction of the operating cost in Arif et al. (2014).A combination of modified PSO and differential Evolutionary (DE) algorithm with IDR is used to solve the problem of EM and planning in Sedighizadeh et al. (2019).In Soroudi et al. (2016), a PDR is developed for the minimization of power losses in MG.Based on real-time pricing, Ref. presented Yu and Hong (2016) a DR for the optimal EM.Different DRP types are employed in the EMS of Multi-Microgrid the problem is solved using linear programming with mixed integer liner programing (MILP) mathematical models in Nguyen et al. (2018).To reduce the operating cost and to maximize the operator benefit is the EM problem solved using Honey Badger Optimizer (HBA) in Alamir et al. (2022b) and using Alamir et al. (2022a) Artificial Hummingbird Algorithm (AHA).
According to the aforementioned studies, various optimization techniques have been employed to solve different engineering problems effectively, particularly for different EMS objectives.So these researches revealed a chance for establishing new and improved optimization strategies for solving specific problems.Also, thanks to the No-Free-Lunch (NFL) theorem (Wolpert and Macready 1997), which state that ''there are no metaheuristic optimization algorithms capable of addressing all optimization problems and guarantee the same performance''.These two previously mentioned reasons clarify our motivation to propose the Quantum Artificial Rabbits Optimization (QARO) as an improved version of Artificial rabbits optimization (Wang et al. 2022) which was chosen owing to their exceptional performance in solving a variety of mathematical and engineering design problems.A summary comparison for the related work is shown in Table 1.
The objective of this paper is to introduce a QARO algorithm based on the quantum mechanics to enhance the conventional ARO.The second objective is to optimize the MG operation taking incentive DR into account and comparing to other optimization metaheuristics.
The following are the principal contributions of this work to the investigation, as mentioned earlier: 1.A Quantum Artificial Rabbits Optimization is proposed to enhance the performance of the original ARO algorithm and to solve the EM problem in MG.A quantum mechanics by employing the Monte Carlo method is used to prevent premature convergence to local minimum.2. Considering the demand response program, the EM problem in MG is solved by employing the proposed QARO algorithm.And its performance is compared with well-known and newly developed algorithms to solve the EM problem.
The rest of this paper is structured as follows: Sect. 2 presents the modeling of the Grid-connected Microgrid with modeling of DRP.Section 3 discusses the EM optimization problem modeling; Sect. 4 focuses on the traditional ARO and the proposed QARO algorithms.The obtained simulation results are presented in Sect. 5. Finally, the paper is concluded in Sect.6.

Problem formulation
The proposed grid-connected MG scheme is shown in Fig. 1, which consists of Dispatchable conventional sources such as conventional diesel generator (CDG), renewable sources such as Photovoltaic (PV), Wind Turbine (WT), and responsive residential customers (RC) as described below.The MG is assumed to have a connection to the Utility Grid (UG) with the possibility of two way energy transactions.

Microgrid Energy Management
Residential customers

Solar PV system
Wind System Diesel Generator

Main Grid
Fig. 1 The overall scheme of the grid-connected MG

Utility grid power transaction
If we denote the amount of power transaction with the UG at any time interval t as P UG t , then the Locational Marginal Prices (LMP's) (c t Þ (Nwulu and Fahrioglu 2013) is employed to express the cost of power transaction C UG P UG t ð Þ as: 2.2 Generation model a. WT model WT output power is Probabilistic in its nature; the generated power (P wind t ) is entirely dependent on wind speed ðv hub t Þ at the hub height h hub , Wind speed can be calculated based on the reference wind speed (v ref t Þ at the reference height h ref as Tazvinga et al. (2014): where b is the power law exponent in the range of 1 7 .The WT hourly generated power is given as: where A is the swept area by the rotor; n w is the efficiency of WT; p air air density; C p is the power coefficient of the turbine.
b. Solar PV model The hourly generated power from PV solar array depends on the incident solar irradiation on the PV array I Pv t (kW h/m 2 ) and it is expressed as Tazvinga et al. (2013): Also, solar power depends on the efficiency of the solar array (g pv Þ, and the PV array area A c (Tazvinga et al. 2013).

c. CDG and load model
The CDG is considered as an essential generation source in MGs.The output power of these CDGs can be adjusted flexibly by the operator.The fuel cost of CDG C i P CDG i;t À Á can be expressed by the quadratic model as: where i is the CDG number; a i and b i are fuel cost coefficients.
Usually, load is modelled by adding up the separate customer loads.In this paper, customers are grouped according to their participation in DRP.

Demand response model
If the customer type is h, which refers to its willingness to participate in the DR program and P c j;t is the amount of consumption reduction; then customer's j cost function (C j h; P c j;t À Á ) can be expressed as Fahrioglu and Alvarado (2000): where k 1 , and k 2 are cost coefficients, Then the benefit of the responsive customer is calculated as: B 1;j ðh; y; P c j;t ¼ y j;t À ðk 1 P 2 where y j;t is the incentive payment that customer j receive.Customers will participate in DR only in case that B j !0. The benefit of MG from the participation of customer j in DR program can be expressed as: where k j;t is the cost of power interruption of customer j; its value can be calculated based on the optimal power flow analysis (Fahrioglu and Alvarado 2000).So that the total benefit of MG is calculated based on (8) for the entire interval T as: 3 Energy management problem formulation As mentioned previously, MG's proposed architecture in this paper consists of different types of generation sources, as WT, PV, and CDG, and responsive customers with DRP.Main objective of the EMS is to optimize the operation of these generation sources.For this purpose of solving Multiobjective optimization problems; Following is a mathematical description of two objective functions.

Objective function
The EM problem in this paper is formulated as a multiobjective problem as following: (a) Minimization of the operating cost (f 1 x ð ÞÞ; which is the cost of power generation and the cost of power transaction with the utility grid.
This mathematical representation of this objective function can be described as follows: where I is the total number of CDG.
The first term of Eq. ( 10) is for CDG generation cost minimization, while the second is for the power transaction cost.(b) Maximization of the MG operator benefit f 2 x ð Þ considering the DRP in EMS.This objective function can be expressed as: Therefore, the mathematical model of the objective function for MG management is represented as: With the following Equation should be satisfied: where w 1 and w 2 are the weighting factors for the first and second objective functions, respectively.

Constraints
The proposed operation of the EMS operation problem is subjected to the following constraints:

Electrical load balance
For any time interval t the electrical load demand with DRP should equal the summation of the total generated power from PV, WT, CDGs and the power transacted with

Unimodal test functions
Sphere [-5.12,5.12]0 Ackley the utility grid P UG t .Thus, the electrical load balance can be modelled as:

Dispatchable CDGs constraints
The output power from each CDG should be within its minimum (P CDG i;min Þ and maximum (P CDG i;max Þ limits as it is indicated in Eq. ( 15).Also constraint in ( 16) states that the ramping up and down rate (DR i Þ limits should not be violated.

Grid constraint
Power transaction with the utility constraints is as in Eq. ( 17), which limits the power transaction below the maximum limit ðÀP UG max Þ .
ÀP UG max P UG t P UG max ð17Þ

Demand response constraints
Based on (7), the function of benefit for responsive customer is prolonged for the entire time horizon (1 day).This ensures that the customer incentive during the day is greater than what should be paid if electricity is consumed rather than curtailed; this limitation is expressed as: Constraint (19) specifies the permitted amount of customer j power curtailment, where P CM j is the customer's daily power curtailment limit.
The DRP is employed with consideration of the daily budget limit (DBL) of the MG as in the following Equation: Shekel 10 4 Solution method

Original artificial rabbits optimization (ARO)
The original ARO mimics the foraging and hiding tactics of actual rabbits, as well as their energy shrink leading to transiting between these tactics (Wang et al. 2022).
(a) Detour foraging (exploration) In detour foraging behavior of ARO, each individual in the search space tends to update its location towards the other search individual chosen randomly from the group and add a perturbation.The following equation describe the mathematical model of the detour foraging: To escape from predators, a rabbit commonly digs some holes nearby its nest for hiding.This equation is given in this regard as: . ..:; n and j ¼ 1; . ..:; d ð22:1Þ The rabbits to be survive need to find a safe residence to hide.So, they select randomly a hole from their holes for hiding to escape from getting caught.This random hiding tactic is modeled as below: After detour foraging or p random hiding is reached, the position update of the ith rabbit is: (c) Energy shrink (switch from exploration to exploitation) An energy factor is considered to model the switch from exploration to exploitation phases.The energy factor in this algorithm can be given as follows: 4.2 Proposed QARO Quantum mechanics are employed to enhance the conventional ARO technique.This quantum model of an ARO algorithm will be referred to as a QARO algorithm.The quantum mechanics was used to develop the PSO algorithm in Coelho (2008).In the quantum model, using Monte Carlo method, the solution x new1 can be calculated as follows Elkasem et al. (2022): Else End where a is a design parameter, u and h are uniform probability distribution in the range of [0, 1], Mbest represents the mean best of the population, and it is defined as the mean of the global best positions.It is can be calculated as follows El-Sattar et al. ( 2022): where g is the index of the best solution.The flowchart of the proposed QARO algorithm is presented in Fig. 2.Moreover, Algorithm 1 describes the QARO algorithm's pseudocode.

Computational complexity analysis of QARO
Computational complexity provides a valuable tool for assessing the effectiveness of algorithms in solving optimization problems.The complexity of an algorithm is influenced by several factors, including the number of individuals involved (n), the dimensionality of the problem's variables (d), and the maximum number of iterations (T).In the case of QARO, the total computational complexity can be expressed as follows:

Simulation results and discussion
Performance analysis of the QARO algorithm.

Benchmark functions
All techniques have been run under the similar situations so that a reasonable assessment is made.The number of search agents has been 50, while the maximum iteration equal to 200, and independent runs is 20 times to avoid the stochastic nature of the algorithms.The parameters specified in the original reference were employed for each method.Table 2 displays the parameter configurations for these techniques.These methods were compared using a laptop with a 2.9 GHz frequency, and the operating system used was Windows 10.The MATLAB 2016a platform was used to execute the techniques.The competence and the precision of the proposed QARO algorithm are evaluated on 23 benchmark functions based on different statistical measurements such as the best, average, median, worst values, standard deviation (std) and rank for the solutions achieved using the conventional ARO algorithm and other recent techniques such as the supply-demand-based optimization (SDO) (Zhao et al. 2019), the Equilibrium optimizer (EO) (Faramarzi et al. 2020), and the Grey wolf optimizer (GWO) (Mirjalili et al. 2014).These benchmark functions comprise three types of test functions: unimodal, multimodal, and low-dimensional multimodal test functions (Fan et al. 2021).The mathematical formulation for these test functions can be found in Table 3.The first group of test functions belongs to the unimodal family, and contains only one global optimum, without any local optima.These test functions are highly suitable for evaluating algorithm convergence speed and exploitation capabilities.The second group, which belongs to the multimodal family, consists of test functions with multiple local solutions in addition to the global optimum.These test functions are useful for testing an algorithm's

Comparison simulation results
The comparisons for these algorithms are presented in Table 4. From Table 4, it is noticed that the proposed QARO algorithm achieves best results on the most of these types of functions in all values.The comparison of techniques in these functions is according to the average value.These functions are compared based on their mean values using a technique called Tied rank (TR).This rank-based approach assigns ranks to the techniques according to their average values, with the technique with the smallest average value being allocated rank 1, and so on.The technique with the lowest TR value is considered the most effective compared to the other algorithms (El-Dabah et al. 2023;Wu et al. 2019).The statistical results of the tied rank on 23 benchmark functions are shown in Table 4.After Table 4 is inspected; the applied techniques are sorted.It is seen from the ranking order that the QARO algorithm outperforms the other compared techniques on 23 function problems.ARO and EO displays robust effectiveness that are the second and third optimal.Figure 3 displays the ranking of all compared algorithms for each function, using a radar chart.The average of these ranks is presented in Fig. 4. Upon examining Fig. 4, it becomes evident that QARO has the lowest average rank value, implying that it ranks first among all algorithms.This underscores QARO as the top-performing optimizer in the comparison, based on the tied rank approach.This outcome further validates that our method can efficiently discover the global optimum for various problems.It is concluded from this discussion that the QARO technique becomes an effective algorithm for solving these types of problems.The convergence characteristics of these algorithms for those functions are displayed in Fig. 5.For more investigation on the performance of the proposed algorithm, a boxplot of outcomes for each algorithm and objective function is presented in Fig. 6 also displays that the boxplots of proposed QARO algorithm for most of the functions are narrow and among the smallest values.

Wilcoxon's rank test results
The Wilcoxon signed-rank test is a nonparametric test used to determine whether the median of a paired sample differs significantly from a hypothesized value.It is commonly used in situations where the data is not normally distributed or the assumptions for a paired t test are not met.To compare the performance of any two algorithms, the Wilcoxon signed rank test is carried out.This involves gathering all fitness values over 30 runs of the objective for both algorithms, computing the sum of ranks for runs in which one algorithm outperforms the other, and calculating the p value to determine the significance of the results.Table 5 presents the results obtained using the Wilcoxon signed rank test.The column H0 defines whether the null hypothesis is valid or not.If H0 is valid with a significance level of a = 0.05, the performance of two methods is statistically the same for the study case (Biswas et al. 2018;Derrac et al. 2011).
To compare the performance of two algorithms, the following steps were taken: • Gathered all fitness values for both algorithms over 30 runs of the objective in a case study.• Calculated R?, the sum of ranks for runs in which algorithm 'A' outperforms algorithm 'B'.• Calculated R-, the sum of ranks for runs in which algorithm 'B' outperforms algorithm 'A'.• Calculated the p value, which indicates the significance of results in a statistical hypothesis test.A smaller p value suggests stronger evidence against the null hypothesis H0.
Table 5 shows that QARO outperforms all other competitors for most functions, indicating a significant improvement in performance.

Kruskal-Wallis statistical analysis of the results
The Kruskal-Wallis test is a widely recognized statistical test that takes into account the overall rankings of multiple variables across different datasets (Gupta et al. 2020).The QARO algorithm exhibits a significantly better median rank compared to the other groups, as indicated by the ANOVA Kruskal-Wallis test results presented in Table 6.The probability value verified by the chi-square test further supports this finding.Based on the nonparametric tests conducted, it can be inferred that the QARO algorithm demonstrates greater precision and accuracy than the algorithms it was compared against (Table 6).

Real-world application
This section presents the numerical analysis and result of the proposed QARO to solve the EM problem to evaluate its performance.QARO determines the optimal operating conditions for the MG resources and the optimal scheduling for DRP operation.The generation data for WT and solar PV are given in Nwulu and Xia (2017), and it is assumed that their operational cost is negligible.The cost  Case Study 1 The grid-connected MG's architecture in the first case study consists of three CDG units, one WT unit, one Solar PV unit, and three customers.The parameters of the three CDGs, including fuel cost coefficients, generation limits, and ramping up and down limits, are provided in Table 7. Data of the three residential customers included cost coefficients,h j , and the daily power curtailment are detailed in Table 8.Power interruptibility (k j,t ) for the three customers is provided in Table 9.The hourly WT and PV   power generation, as well as the initial load demand (P D;t ) are shown in Fig. 7.It is also assumed that MGO has previous information about its own daily budget of $500.All simulations were conducted on MATLAB 2021b on an i7-2.9GHz computer with 8 GB of RAM.The results of 30 independent runs of the proposed MG architecture are compared using the proposed QARO, ARO (Wang et al. 2022), PSO (Moghaddam et al. 2011), JAYA (Warid et al. 2016), INFO (Ahmadianfar et al. 2022), and SO (Hashim and Hussien 2022).The results are presented in Table 10.The proposed QARO has the best performance in terms of best, worst, mean and Standard deviation (STD) values.The best results for each algorithm are compared, and the results will be discussed.The convergence characteristics of the original algorithm ARO and the proposed QARO are shown in Fig. 8; it can be seen that the QARO has faster convergence characteristics and better performance in giving lower operating cost.
Using QARO, the power generated from the CDG units for the whole interval is shown in Fig. 9.The load demand before and after employing the DRP with the power curtailed from all customers as a response to the DR are shown in Fig. 10.A detailed customer curtailment and total incentive are given in Table 11.A comparison for all studied techniques in terms of total energy curtailment, power transaction, and MG benefit is shown in Fig. 11.Negative power transaction means the power sold to the utility grid is higher than that bought from it.The total curtailment during the day in case of using the proposed QARO is equal to 104.97 kWh.From the figure, the MG benefit is the highest in the case of QARO.
Case Study 2 To validate the scalability of the proposed QARO algorithm, a second test system with a larger MG is simulated; in this test system, the MG consists of 10 CDG, aggregated model for 10 WT units, aggregated model for 10 solar PV units, and seven residential consumers.The CDGs' fuel cost coefficients and generation limits are given in Alamir et al. (2022a).The customers' cost coefficients,h j , and the daily power curtailment are detailed in Table 12.The forecasted power from WT and PV units (Nwulu and Xia 2017) as well as the daily power interruptibility values for each customer (Kim and Kim 2019) are shown in Table 13.
In this case study simulated on MATLAB using different optimization techniques, the best results for the independent suns in each algorithm are compared; the total operating cost for all studied techniques is shown in Fig. 12; it can be noted that the proposed QARO achieved best operating cost over all the other techniques.The proposed QARO is employed to solve a day-ahead EM problem in the MG.A comparison among the convergence characteristics of the proposed QARO algorithm and the original ARO algorithm proves the adequacy of the proposed algorithm in solving the optimization problem.The robustness of the proposed QARO has been validated by comparing its performance on two different MG test systems with other common techniques from the literature (PSO, JAYA, INFO, SO, and the original ARO).The proposed QARO achieved the best solution in the mean, worst, and STD.The total curtailment is 104.97 kWh and 2679.5 MWh in case study 1 and 2, respectively, while the highest benefit is achieved by QARO algorithm is $50 and $3010 for the two cases, respectively.
The proposed QARO algorithm can be employed for solving an extended probabilistic energy management problem with considering the uncertainty in the renewable generation, load and energy prices.The Ruidas et al. (2023b) used PSO to optimize the inventory cost related to the investments in reduction of emissions and green innovation.The Quantum behaved PSO (QPSO) is used in Ruidas et al. (2022) to optimize the economic production quantity for production system while in Ruidas et al. (2021) a new inventory cost called development cost is added to the optimization process.Additional QPSO is applied in Ruidas et al. (2023a) to derive the optimal profit in production inventory model for high-tech products.The proposed QARO can be employed to solve these problems and compare its performance with the PSO and QPSO algorithms.

Fig. 3 Fig. 4
Fig. 3 Radar chart for ranks among all compared algorithms

Fig. 5 Fig. 6
Fig.5The convergence curves of all algorithms for 23 benchmark functions

Fig. 7
Fig. 7 Initial demand load and the power generated from PV and WT

Fig. 9 Fig. 10
Fig.9The power generated from CDG and transacted with the grid Fig. 11 Comparison of all studied optimization techniques for case study 1

Table 1
Summary for the related work

Table 2
Parameter settings of the selected techniques

Table 4
The statistical results of 23 benchmark functions

Table 5 Table
Statistical comparisons of Wilcoxon signed-rank test for QARO versus ARO, SDO, EO, and GWO

Table 9
Power interruptibility k j,t data for case study 1

Table 11
Comparison of the EM problem for case study 1

Table 12
Customers data (Case study 2)This paper proposes a modified QARO algorithm to enhance the performance of the ARO algorithm by augmenting it with a quantum mechanism based on MCS simulation.The modified algorithm is applied to solve the EM problem of MG to minimize the operating costs and maximize the MGO benefit.The performance of the improved algorithm has been tested using 23 test bench functions and comparison with well-known techniques (e.g.SDO, EO, GWO and the original ARO), different statistical assessment are performed.TR technique used to rank the performance of algorithms based on the average value, Wilcoxon's rank test based on median value, and Anova Kruskal-Wallis test are performed.These tests demonstrated the effectiveness of the proposed algorithm.