1 Introduction

The emergence of the microgrid integrates smart infrastructure, various technologies, advanced management [1]. Compared with traditional power grids, the microgrid has a variety of advantages including more resilient, sustainable, and reliable [2,3,4]. Distributed energy resources (DERs) are primary alternatives for supplying the incremental demand of the electrical market in the microgrid. The load is preferentially supplied by the DERs in the microgrid, improving energy efficiency and reducing power transmission losses as DERs are located near the load.

Nowadays, economic dispatch (ED) [5, 6] problem of the microgrid as an optimization problem [7, 8] is eager to be solved by appropriately scheduling the output of each power generator so as not to waste clean power resources and minimize the operation cost at the same time [9]. The ED problem in the microgrid has attracted more extensive attention from plenty of scholars in recent years [10,11,12,13,14,15,16]. Literature reviews show that different technologies have been proposed for solving the optimization problems. There are many metaheuristic optimization methods including particle swarm optimization (PSO) [17], differential evolution (DE) [18], and other algorithms that have successfully solved the economic dispatch problem. They have a powerful ability to search for global or near-global solutions of nonconvex and complex optimization problems. Reference [19] uses multi-objective particle swarm optimization (MOPSO) to find the optimal configuration of off-grid hybrid microgrid system and find their optimal component size in Swedish. In [20], a memory-based genetic algorithm (MGA) has been used for minimizing the energy production cost of the day-ahead scheduling problem. In [21], the additive increase multiplicative decrease (AIMD) algorithm is developed to schedule the task of power generation in an optimized way among generators. In [22], four methods including PSO, lambda logic (LL), lambda iteration (LI) and direct search method (DSM) in solving economic dispatch problem are proposed to minimize the fuel cost of distributed generations considering operational constraints. Reference [23] has used HOMER and GAMS (CPLEX solver) to solve the optimization of mixed-integer linear programming problem. Authors in [24] have proposed a combination of differential evolution (DE) and harmony search (HS) to solve the optimization problem of an optimal day-ahead scheduling model. An advanced real-time energy management system is proposed to optimize microgrid performance in [25]. The authors capitalize the binary particle swarm optimization (BPSO) algorithm to maximize the power of the available renewable energy resources while reducing the energy cost, carbon dioxide and pollutant emissions at the same time.

However, there exists a dissatisfied limitation in many of the optimization algorithms reported above. Before we put these algorithms into application, we have to adjust the algorithm parameters on the particular problem. It is an intricate problem that the algorithms need to adapt their parameters due to changes in system load or unit constraints. To solve this defect, the algorithm has to add the technique for adaptively adjusting parameter values. But this method reduces computational efficiency since additional computational effort must be required. Thus, adding self-adjusting parameter will be highly efficient [26]. The firefly algorithm (FA) regarded as an efficiency optimization algorithm has been proposed in [27]. Compared with many optimization algorithms, Yang confirmed that the FA has especial superiority in different aspects including numerical stability, calculation accuracy, and convergence rate [28]. The application of FA for solving ED problems in small or medium power systems is quite successful [29]. In general, current algorithms related to FA have unique superiorities over other recently developed algorithms in solving various optimization problems with a single moment [30, 31]. Most studies for solving ED problems related to FA regard one feasible solution whose vector dimension is 1 \(\times\) D or D \(\times\) 1 as a firefly (D is a positive integer). They are efficient for solving the ED problem of a single moment. However, when solving the ED problem of day-ahead scheduling for multiple moments, we must separate numerous moments into suitable single moments if we want to use the above algorithms, whose superiorities will lose because of low efficiency. Therefore, a novel algorithm called multidimensional firefly algorithm (MDFA) is presented to deal with the ED problem. In MDFA, the vector dimension of a firefly is D \(\times\) E (E is a positive integer) which is essentially different from FA, and its superiority will be proved in this paper.

In this paper, MDFA is applied to solve the day-ahead scheduling optimization of the microgrid among DERs. We propose two modifications to improve significantly the MDFA efficiency which is convenient to obtain the minimum solutions. One of the proposed modifications is adding a novel strategy in parameter self-adaption selection rather than using a fixed value. Another is exploring a new attractiveness calculation strategy instead of the former attractiveness equation. Besides, in most optimization methods, the penalty-function technique is used to handle equality constraints. However, suppose we use penalty-function to deal with equality constraint in MDFA. In that case, it is hard for MDFA to generate feasible solutions, and we are confused about choosing appropriate penalty factors during the process of optimization, resulting in generating undesirable solutions. Thus, a strategy is proposed for solving equality constraints in MDFA without adding any additional factors to the objective function. This strategy not only helps MDFA handle constraints but also help MDFA keep away from result deviation. In this way, the strategy guarantees the fireflies always be a feasible solution. Indeed, the proposed methods have a reliable and positive effect on the convergence of the algorithm and the quality of the solutions. Results obtained by the MDFA for solving ED problems in the microgrid are compared with the results by other algorithms in previous literature. Simulation results accentuate the superiority of the proposed MDFA technique over the other methods.

2 Mathematical Formulation of the ED Problem

2.1 Generation Cost

The microgrid faces a variety of methods for portioning the requested power among DERs. The best way is to achieve the minimum operating cost of microgrid through the reasonable allocation of the distributed generations. It is generally accepted that the generation cost function for DERs can be modeled as a quadratic function, which can be written as follows [32, 33]:

$$C_{i} (t) = U_{i} \times (a_{i} \times (P_{i} (t))^{2} + b_{i} \times P_{i} (t) + c_{i} )$$
(1)

where \(C_{i} (t)\) is the hourly cost ($), and \(P_{i} (t)\) (MW) denotes output power of the i-th generation at period t, respectively. \(U_{i}\) is a binary variable. When \(P_{i} (t)\) is equal to 0, \(U_{i}\) is 0, otherwise \(U_{i}\) is 1. And \(a_{i}\), \(b_{i}\), and \(c_{i}\) are the cost coefficients of i-th DER.

2.2 Objective Function and Constraints

The microgrid aggregates various local production or consumption units that act in the electricity market as a single entity. In this paper, there are photovoltaic panels (PV), combined heat and power (CHP), and wind plants (WP) as DERs. In order to minimize the generation cost of the required power among DERs, an objective function (OF) that defined based on a quadratic cost function can be written as:

$$Min \, OF \, \sum\limits_{t = 0}^{T} {\sum\limits_{i = 1}^{{N_{DERs} }} {C_{i} (t){ = }\sum\limits_{t = 0}^{T} {\sum\limits_{i = 1}^{{N_{DERs} }} {U_{i} {\mkern 1mu} \, \times \,} } } } {\mkern 1mu} (a_{i} \times (P_{i} (t))^{2} + \, b_{i} \times P_{i} (t) + c_{i} )$$
(2)

Subject to:

$$\sum\limits_{i = 1}^{{N_{DERs} }} {P_{i} (t) = P_{L} (t)}$$
(3)
$$P_{CHP}^{\min } (t) \le P_{CHP} (t) \le P_{CHP}^{\max } (t)$$
(4)
$$P_{PV}^{\min } (t) \le P_{PV} (t) \le P_{PV}^{\max } (t)$$
(5)
$$P_{WP}^{\min } (t) \le P_{WP} (t) \le P_{WP}^{\max } (t)$$
(6)

where \(T\) stands for total hours. In this paper, \(T\) is equal to 23. \(N_{DERs}\) is the total number of DERs participating in the electricity market of microgrid, and its value is 6 in this paper. \(P_{L} (t)\) means the load demand in the microgrid at time t. \(P_{DER}^{\min } (t)\) and \(P_{DER}^{\max } (t)\) are the minimum and the maximum generation power of DER at time t.

In conventional optimization theory, the measure to handle the equality constraint is using penalty-function. From this perspective, an optimization problem with equality constraint can be converted to an optimization problem without equality constraint. By adding penalty-function, the problem defined by (2) is modified as follows:

$$Min{\text{ OF = }}\sum\limits_{t = 0}^{T} {\sum\limits_{i = 1}^{{N_{DERs} }} {C_{i} (t) = \sum\limits_{t = 0}^{T} {\sum\limits_{i = 1}^{{N_{DERs} }} {U_{i} } \times (a_{i} \times (P_{i} (t))^{2} } } } + \,b_{i} \times P_{i} (t) + c_{i} ){ + }P_{f} \times \left| {\sum\limits_{i = 1}^{{N_{DERs} }} {P_{i} (t) - P_{L} (t)} } \right|$$
(7)

where \(P_{f}\) is the penalty factor which plays a vital role in solving equality constraint in penalty-function.

2.3 Strategy for Solving Equality Constraint

Penalty-function is widely used in most documents to deal with an equality constraint. Owing to the traditional statement, an optimization problem without equality constraint can replace an optimization problem with equality constraint. Penalty-function has a great effect on dealing with equality constraint on many occasions, but it is not mature enough in the application of MDFA. In MDFA, using penalty-function may cause deviation during the period of searching for optimal solution. The penalty factor is the key to find global solutions, and it is determined by the specific data in penalty-function. Hence, it is hard to choose the most suitable penalty factor which greatly increases the computational time during the process of finding the best solution. Furthermore, due to the application of penalty-function, the ability of exploiting and exploring is weakened significantly in MDFA. In this case, the solution found by penalty-function can’t be guaranteed to be optimal because of premature convergence, especially in disposing of complex nonlinear problems. Thus, penalty-function won’t be applied in equality constraint during the process of MDFA in this paper. It’s simply assumed that the available DERs have enough power to supply the requested load in this paper. A strategy is applied in the step of initialization and position update in MDFA which will be introduced in Sect. 3 to solve the equality constraint. There are two scenarios including the sum of DERs’ output is higher than load at time t and the sum of DERs’ output is lower than load at time t. It’s assumed that the sum of output is higher than the load, and the strategy can be shown as follows:

  1. (1)

    Initialization: randomly initialize the value of DERs’ output and ensure that they are within the output limits.

  2. (2)

    Calculation: calculate the value of unbalance between the sum of the DERs’ output and the load and define it as Delta.

  3. (3)

    Check whether Delta is less than the precision K. Where K is the value of acceptable unbalance between the sum of the DERs’ output and the load. If yes, end this process. Otherwise, randomly choose a DER to increase its output by Delta. Note that the chosen DER can’t be chosen again in the late progress.

  4. (4)

    Check whether the chosen DER’s output is within the output range. If positive, end this process. Otherwise, adjust its output to its upper limit and return to step 2.

Since the available DERs have enough power to supply the requested load, a feasible solution must be generated by the above strategy. Figure 1 shows the flowchart of the strategy for solving equality constraints. If the sum of DERs’ output is lower than load, and vice versa.

Fig. 1
figure 1

The flowchart of the strategy for solving equality constraints

3 Proposed Methodology

3.1 Firefly Algorithm

Nowadays, FA becomes one of the most popular population-based algorithms [27]. The algorithm simulates the social behavior of the flashing features of fireflies that the fireflies will move to brighter fireflies and eventually find the optimal global position. In FA, each firefly represents a potentially feasible solution to the optimal problem. The following steps should be employed for implementing FA:

Initialization: first, N initial fireflies are randomly generated in the search space. Each firefly represents a vector of D dimension where the size of D is determined by the number of decision variables. In the previous paper, the structure of each firefly can be defined as the following:

$$X_{i} = \left[ {X_{i,1} ,X_{i,1} , \ldots ,X_{i,D}} \right]{; }\,i{ = 1, \,2,} \ldots N$$
(8)

Apparently, the vector dimension of each firefly is 1 \(\times\) D in original FA.

Fitness evaluation: calculate the value of the objective function of fitness for each firefly using (2).

Position update-The ith firefly updates its position by moving closer to the jth firefly, which is brighter than it. The way of the fireflies update their position can be written as [34]:

$$X_{{{\text{i}},firefly}}^{k + 1} = \left\{ \begin{gathered} X_{i,firefly}^{k} + \beta^{k} (X_{j,firefly}^{k} - X_{i,firefly}^{k} ) + \, \alpha^{k} (rand(.)_{1 \times D} \hfill \\ \, - 0.5)\quad \quad \quad if \, OF(X_{i,firefly}^{k} ) > OF(X_{j,firefly}^{k} ) \hfill \\ X_{i,firefly}^{k} \quad \quad \quad otherwise \, \hfill \\ \end{gathered} \right.$$
(9)

where \(\alpha\) is the random search factor, and its value is in the range of 0–1. And \(rand\) represents a random number generated from a uniformly distributed selected in the range [0, 1]. \(\beta\) is the attractiveness of a firefly which can be described as the following:

$$\beta \,{ = }\,\beta_{\min } + (\beta_{\max } - \beta_{\min } ) \cdot e^{{ - \gamma r^{2} }}$$
(10)

where \(\beta_{\min }\) and \(\beta_{\max }\) are set to 0.2 and 1, respectively. \(\gamma\) is the light absorption coefficient, and it is a fixed parameter. It will affect the brightness of fireflies and commonly set to 1. \(r\) is the Cartesian distance between the mth and nth firefly which can be defined as:

$$r_{m,n}^{k} = \sqrt {\sum\limits_{i = 1}^{N} {(X_{i,m}^{k} - X_{i,n}^{k} )}^{2} } {; }\,m,n = 1, 2, \cdots N$$
(11)

Fitness evaluation of new firefly: the objective function value of every new firefly should be calculated by using (2).

Offspring generation: if the brightness of the new fireflies generated by the position update step is higher than that of the current firefly, then it replaces the current firefly and becomes a new member of the population. The way of offspring generation can be described as:

$$X_{{{\text{i}},firefly}}^{k + 1} = \left\{ \begin{gathered} X_{i,firefly}^{k + 1} \quad \quad \, if \, OF(X_{i,firefly}^{k} ) \ge OF(X_{i,firefly}^{k + 1} ) \hfill \\ X_{i,firefly}^{k} \quad \quad otherwise \, \hfill \\ \end{gathered} \right.$$
(12)

Termination criterion-Check if the conditions for stopping the iteration have been met. In this paper, once the number of iterations reaches the maximum setting, the program stops and outputs the best solution. If not, turn to the step of fitness evaluation and repeat.

3.2 Multidimensional Firefly Algorithm

The FA is widely applied in various aspects of the power system due to its small number of parameters need for tuning and simple concept. In FA, its population diversity makes a great contribution to improving computational efficiency and convergence rate. FA is proved to its superiority compared with other algorithms in solving the problem of economic dispatch in a single hour. In this way, the dimension of a firefly is 1 \(\times\) D or D \(\times\) 1. However, it may convergence to an improper position or be caught in premature convergence in complex nonlinear problems, especially in solving ED problems of day-ahead scheduling. Therefore, MDFA is proposed to solve optimal day-ahead scheduling problems whose dimension is D \(\times\) E while satisfying various constraints. In the following few subsections, the structure of MDFA and the control parameters are discussed.

3.2.1 The Structure of MDFA

In MDFA, each firefly with D rows and E columns represents feasible solutions in the search space. We apply it to solve the ED problems of day-ahead scheduling in the power system. In a firefly, the data of each column represent the feasible solution of a single hour. The columns represent the total hours. The rows are determined by the number of participant decision variables. Thus, the vector corresponding to the i-th firefly can be expressed as following:

$$X_{i} = \left[ {\begin{array}{*{20}c} {X_{1}^{1} } & {X_{1}^{2} } & \cdots & {X_{1}^{E} } \\ \vdots & \vdots & \ddots & \vdots \\ {X_{j}^{1} } & {X_{j}^{2} } & \cdots & {X_{j}^{E} } \\ \vdots & \vdots & \ddots & \vdots \\ {X_{D}^{1} } & {X_{D}^{2} } & \cdots & {X_{D}^{E} } \\ \end{array} } \right];{ }\,i = 1,\,2 \ldots N$$
(13)

3.2.2 Dynamic Adjustment of α and β

Replacing random sequences with chaotic sequences has been demonstrated to improve the performance of the metaheuristic algorithm [35]. In [36], variants of the basic firefly algorithm with chaotic maps have been presented. The random movement factor α is the key to balance between exploitation and exploration of FA. Finding a specific strategy to determine the value of α can produce different effects on algorithms related to FA. Therefore, the manner to decide α has a significant impact on the performance of MDFA. In this paper, the variation of the random movement factor α is found to provide better performance particularly in MDFA, and it can be defined as:

$$\alpha^{{{\text{k}} + 1}} = \alpha^{k} * (0.2/iterMax)^{ \wedge } (1/iterMax)$$
(14)

where \(iterMax\) is the maximum number of iterations. Figure 2 shows the trajectories of α in MDFA.

Fig. 2
figure 2

The trajectories of α in MDFA

And for the attractiveness \(\beta\), it plays a vital role in the performance of MDFA. As the Cartesian distance \(r\) increases, the value of \(\beta\) stays too long at the beginning of \(\beta_{\min }\), and after reaching a certain number of iterations it quickly increases to \(\beta_{\max }\). This will have a negative impact on optimization. An improved strategy is proposed to solve it [26]. In [37], the formulation of the attractiveness has been proposed to improve the partially attracted firefly algorithm (PaFA). However, when we solve the high dimensional and broad search boundaries optimization problems, the value of the Cartesian distance between the fireflies is too large to avoid making the attractiveness stays unchanged at \(\beta_{\min }\). Furthermore, the value of attractiveness will increase to 1 very quickly when the difference between fireflies gradually close. In this case, the improved strategy in [26] is not applicable to MDFA, and the diversity of different locations can’t be adequately reflected so that the firefly can’t produce different attractiveness.

Thus, a novel strategy for \(\beta\) is urgently need to be raised so that the superiority of the population with its search experience and fast convergence speed can be utilized. In this paper, an improved calculation strategy of the attractiveness is proposed to improve MDFA which can be described as:

$$\beta \,{ = }\,\beta_{\min } + \frac{{\beta_{\max } }}{{{2 + 2}r}} + \frac{{(\beta_{\max } - \beta_{\min } ) \cdot e^{{ - \gamma r^{2} }} }}{2}$$
(15)

where \(r\) is the Cartesian distance which has been mentioned.

According to the above formulation, the attractiveness \(\beta\) is equal to \(\beta_{\max }\) at \(r\) = 0 and the attractiveness \(\beta\) decreases with the distance \(r\) increases. From this perspective, the proposed strategy is consistent with the characteristic of FA.

3.2.3 The Improved Strategy for MDFA

From the previous statement, each firefly has E solutions during total E hours in MDFA. It’s clear that there are plenty of changes for each solution in a firefly after the step of position update. In this way, the cost of each solution may be better or worse, and the total cost of solutions in a firefly is difficult to control, which limits immensely the efficiency of MDFA. Thus, a control strategy is proposed to modify the firefly gained by the step of position update to avoid the defect during the process of evolution for the firefly as following:

  1. (1)

    The firefly is obtained from the step of initialization and it is defined as P0. Let this firefly go through the step of position update, and the obtained firefly is defined as P1. They both have the output data of the generator in 24 h. Set i = 0, and set its maximum value to 23 in this paper.

  2. (2)

    The output data of P0 and P1 at i-th hour is defined as Pi0 and Pi1. Calculate the cost of Pi0 and Pi1, and their costs are defined as Fi0 and Fi1.

  3. (3)

    Check whether Fi0 is larger than Fi1. If yes, modify Pi0 to be consistent with Pi1. Otherwise, go to next step.

  4. (4)

    Increase i by one, and check whether i reaches the maximum value. If yes, output the firefly of P0 as the firefly.

obtained from the step of position update. And it’s also regarded as the firefly from the step of initialization in the next iteration in MDFA. Otherwise, repeat steps 3 and 4.

Figure 3 shows the strategy for a firefly in MDFA. The above strategy is executed to obtain new solutions which represented by a firefly. There are N fireflies are implemented by the strategy.

Fig. 3
figure 3

The strategy for MDFA

The proposed control strategy will help MDFA escape from the local optimum and increase the convergence speed, which will be confirmed in Sect. 4.

So far, a new improved version of FA called MDFA, which is shown in Algorithm 1, has been proposed for enlarging exploitation area and accelerating convergence speed. The MDFA has following advantages. First, it ensures that information is shared among the population, whatever for large-scale or high dimension optimization problem. So that the search experience of the population can be efficiently used. Second, the global search ability of the algorithm is enhanced. It significantly slows down the increased speed of the value of attractiveness, which improves the ability to escape from the local optimum. Third, it enlarges the exploitation area and accelerates convergence speed. Figure 4 shows the flowchart of the MDFA method.

Fig. 4
figure 4

The flow chart of the MDFA algorithm

4 Simulation Results and Discussion

In this section, in order to show the performance of the proposed algorithm, the MDFA is applied to solve the formulated problem in the microgrid. All data has been adopted from [20]. In this system, we consider total six decision variables, namely wind plant 1 (WP1), wind plant 2 (WP2), wind plant 3 (WP3), photovoltaic panel 1 (PV1), photovoltaic panel 2 (PV2) and a CHP in our test system. In addition, the 24-h load and the maximum power output for the WPs, PVs and CHP are shown in 3 in Appendix. The minimum power output of the WP, PV and.

CHP during 24 h are zero in this paper. We also assume that the rated capacity of wind plants, PV panels and CHP are 750 kW, 200 kW and 1000 kW, respectively. The cost coefficients of the DERs are also presented in Table 4 in Appendix. Based on the assumption that the available DERs have enough ability to supply the requested power at each hour, the proposed algorithm tries to deliver the required power during 24 h at minimum cost.

In order to effectively test that the proposed algorithm has an excellent performance in dealing with optimization problems, the optimization solutions obtained from the MDFA will be compared with the optimization results provided by five algorithms including genetic algorithm (GA), FA, MGA, particle swarm optimization with constriction factor (PSOcf), and particle swarm optimization with inertia weight (PSOw), which have been proven to be superior in solving optimization problems. In this paper, the settings of the algorithm parameters mentioned above except MDFA and FA are in [20]. The settings parameters of MDFA and FA are as following:

FA: N = 50, \(iterMax\) = 200, \(\alpha\) = 1 and \(\gamma\) = 1. It’s noted that FA is separately simulated at each hour, and the number of FA needs to be calculated is 24 in this paper, respectively.

MDFA: N = 50, \(iterMax\) = 200, \(\alpha\) = 1 and \(\gamma\) = 1.

The simulations are carried out on MATLAB (R2019a) environment using a desktop machine, which CPU is Intel Core (TM) i7 processor with 3.6 G-Hz clock frequency and 8 GB of RAM.

Table 1 shows the day-ahead scheduling of sources obtained by MDFA. It can be seen more intuitively that the power balance constraint is fully satisfied owing to the application of the proposed strategy to deal with equality constraints in MDFA. The comparison of the scheduling power obtained by GA, MGA, PSOcf, PSOw, FA and MDFA at each hour of the day is shown in Fig. 5. From Fig. 5, the cost of results provided by FA and MDFA is same or less than the cost of solutions gained by other mentioned algorithms at most hours in a day, and both FA and MDFA produce more accurate solutions than other investigated algorithms. But FA is trapped into local convergence at hour 1. The results of day-ahead scheduling obtained by FA, GA, MGA, PSOcf and PSOw are shown in Tables 5, 6, 7, 8, 9 in Appendix. In this paper, in order to ensure fairness for comparing the performance of all algorithms, the computing time for the mentioned algorithms is the total time to obtain the optimal results of six generators during 24 h. From [20], the average computing time required to solve scheduling problems at each hour for GA, MGA, PSOcf and PSOw are 2.03, 2.06, 1.30, and 1.24 s, respectively. And the average computing time for FA at each hour is 1.58 s. The computing time for the mentioned algorithms has to been converted into 24 h, and the total computational time of GA, MGA, PSOcf, PSOw, and FA is 48.72, 49.44, 31.2, 29.76 and 37.92 s.

Table 1 Results obtained by MDFA
Fig. 5
figure 5

The value of the generation cost at each hour of the day obtained by the investigated algorithms

Since the MDFA only needs to be calculated once to obtain the output results of six generators at 24 h, the total computing time for MDFA is 9.89 s during 24 h, which is less than other methods. The comparison of results quality gained by MDFA with other investigated algorithms is and listed in Table 2. From Table 2, if the summation of the costs (24 h) is calculated, MDFA, FA, MGA, PSOcf, PSOw and GA reaches to 1193.1, 1197.3, 1203.8, 1259.6, 1273.8, and 1868.5 $.

Table 2 Comparison of results by mentioned methods

As the mentioned algorithms except MDFA is hourly calculated, we don’t show their convergence characteristics anymore. The convergence characteristic of the MDFA that providing the best solutions in this paper is shown in Fig. 6. It can be clearly seen that the convergence curve of the MDFA appears to be smooth. And the MDFA converges fast to the optimal results whose number of iterations is 47. It indicates that the proposed improved algorithm enhances the global search capability of the original algorithm and is able to explore previously unexplored areas to provide better solutions. In combination with Table 2, it is evident that the generation cost provided by the MDFA are not only better than other methods, but also have higher stability than other methods. From the point of view that the MDFA regards the output of generations during 24 h as a whole, a firefly in MDFA is always a feasible solution meeting all constrains when we solve the solving the scheduling problem considering constraints such as ramp rate limits and other constraints. It shows that MDFA is fast, stable, and has ability to provide optimum solution and satisfy all constraints.

Fig. 6
figure 6

Convergence process of MDFA for solving the scheduling problem

5 Conclusion

In this paper, an improved algorithm called MDFA is presented and its superiority is demonstrated by optimally distributing the required power among DERs in a microgrid. A diminishing strategy was brought into MDFA for the trajectory of the random movement factor (α). And the novel attractiveness formula is introduced instead of initial formula for β, which enhances search area of the MDFA. Besides, the strategy of solving equality constraint, and the strategy to improve efficiency of MDFA are applied in this paper. Through these strategies, individuals are better than that in traditional FA and their search information can be fully utilized which ensure information sharing among the groups. Simulated results reveal that MDFA is more powerful than FA, GA, MGA, PSOcf and PSOw. MDFA not only finds the solutions with minimal generation cost, but also solves the scheduling problem at quite quick convergence speed. The proposed algorithm can be much more desirable than conventional algorithms in solving complex and nonlinear optimization problems related to day-ahead scheduling of power system.