2.3.1. Problem Description and Model Formulation
In a grid-connected microgrid system, the configuration comprises photovoltaic generation, wind power, diesel generators, micro gas turbines, energy storage devices, and power exchange with the main grid. The power output of each subsystem is influenced by environmental conditions and equipment characteristics: photovoltaic output depends on solar irradiance and temperature, wind generation is constrained by wind speed variability, and diesel generators and gas turbines are subject to start–stop limitations and ramp rate constraints. Additionally, the charging and discharging efficiency as well as the state of charge (
SOC) of energy storage devices must strictly adhere to operational limits [
18]. During operation, the system must maintain real-time balance between load demand and the power outputs of generation units, while simultaneously satisfying both economic efficiency and environmental sustainability requirements [
19,
20].
The objective of this study is to minimize the total operating cost and environmental cost of the microgrid while satisfying all operational constraints. The scheduling variables represent the power outputs of six types of equipment across 24 hourly time intervals, resulting in a total decision space of 144 dimensions. The optimization objective function aims to minimize the sum of operating and environmental costs, where the operating cost includes the expenses associated with diesel generators, gas turbines, energy storage systems, and grid electricity transactions, and the environmental cost is quantified based on pollutant emissions from each unit and the corresponding mitigation expenses. To ensure that the obtained solutions comply with the physical and technical constraints, violations in storage
SOC fluctuation, ramp rates, and power balance are converted into penalty terms and incorporated into the objective function, thereby penalizing infeasible scheduling solutions in terms of fitness [
13].
Within the model, the power output of each device must remain within its prescribed upper and lower bounds. In each time period, the sum of power outputs from all generation units and grid interaction must exactly match the load demand. Additionally, the state of charge (
SOC) of the energy storage system must remain within a defined safe operating range at all times to prevent overcharging or deep discharging. The power purchased from or sold to the main grid is also subject to technical constraints imposed by the grid interface. Based on the above objectives and constraints, the microgrid scheduling problem is formulated as a high-dimensional, nonlinear, and multi-constrained optimization problem, mathematically expressed as follows:
Here, denotes the penalty function associated with the constraint violations, which ensures that any infeasible solutions are appropriately penalized during the optimization process. This mechanism guides the algorithm toward feasible solutions that satisfy all operational and technical constraints.
The establishment of this model not only provides an accurate mathematical foundation for the economic scheduling of microgrids but also lays the theoretical groundwork for solving the problem using the TDBO algorithm. By integrating operating cost, environmental cost, and constraint penalty terms into a unified framework, the model comprehensively captures the real-world operational characteristics of grid-connected microgrid systems. Furthermore, it defines a precise optimization objective that facilitates the application of the TDBO algorithm to achieve global optimization.
2.3.2. Algorithm Description
Principles and Overall Framework of the Tuned Dung Beetle Optimization Algorithm
The Dung Beetle Optimization (DBO) algorithm is selected as the core optimization tool for solving the multi-objective microgrid scheduling problem, and multiple strategic enhancements are introduced to improve its global exploration and local exploitation capabilities. The fundamental concept of the DBO algorithm is inspired by various behavioral patterns of dung beetles in nature, including rolling, dancing, stealing, and breeding—each corresponding to different search strategies executed by distinct types of individuals within the population [
21]. Similar to conventional intelligent algorithms, DBO operates on a population of candidate solutions, with each individual iteratively updated within the feasible solution space to minimize the comprehensive cost of the microgrid.
Specifically, the population size is defined as
, the maximum number of iterations as
, and the position of each individual is represented by
, where
corresponds to the power outputs of six types of devices over 24 scheduling intervals. The overall algorithmic flow is illustrated in
Figure 2. The fitness function of the algorithm is closely aligned with the objective function; in this work, the microgrid’s operating cost, environmental cost, and constraint penalties are integrated into a unified fitness metric, enabling the algorithm to balance economic efficiency and environmental performance throughout the evolutionary process.
To further enhance the adaptability of the Dung Beetle Optimization (DBO) algorithm in high-dimensional, multi-constrained problems, this study introduces structural improvements to the original DBO framework and proposes the Tuned Dung Beetle Optimization (TDBO) algorithm, which demonstrates higher innovation in terms of multi-strategy integration. Unlike previous studies that typically incorporate a single mechanism (such as Lévy flight or opposition-based learning) to improve performance, TDBO systematically integrates five strategies from multiple dimensions, including behavioral role modeling, search path structuring, perturbation mechanisms, and population dynamics control: individual role collaboration mechanism, dynamically scaled spiral search, Lévy flight-based long-distance perturbation, random opposition-based learning, and Gaussian local perturbation.
Particularly in terms of role division, this study is the first to map the “navigation–cooperation–competition” characteristics of dung beetle behavior in nature into three algorithmic subgroups: producers, searchers, and carriers, each assigned with distinct update strategies. This enables coordinated regulation between global exploration and local exploitation from the perspective of mechanism design. The structural innovation achieved through this multi-strategy coupling and behavioral heterogeneity constitutes one of the main theoretical contributions of TDBO compared with the original DBO and other multi-strategy metaheuristic algorithms.
Figure 3 schematically illustrates the transition from the basic DBO update pattern to the more diversified and adaptive update process in TDBO.
Dung Beetle Optimization Algorithm Multi-Subgroup Strategy
In the dung beetle optimization algorithm, individuals are typically divided into several subgroups, each assigned distinct behavioral patterns. The first group simulates the “rolling dung” behavior, where individuals determine their rolling direction based on the position of the worst-performing individual. The second group mimics the “dancing” behavior observed when encountering obstacles, randomly altering their movement direction through update mechanisms based on functions such as or . The third group performs a “stealing” operation, making large jumps by directly referencing the position of the best-performing individual. A portion of individuals also engage in reproduction or foraging, enabling fine-grained search within local regions.
To enhance the balance between global exploration and local exploitation, the algorithm classifies individuals in each generation into roles such as producers, searchers, and carriers based on their fitness ranking within the population. Each role follows a distinct update strategy, thereby maintaining population diversity and improving search efficiency.
Compared with the Dung Beetle Optimization (DBO) variants introduced in references [
12,
22], the Tuned Dung Beetle Optimization (TDBO) algorithm proposed presents a more comprehensive and structurally innovative design. While the algorithms in [
12,
22] typically enhance DBO using isolated mechanisms—such as incorporating Lévy flights [
12] or opposition-based learning strategies [
22]—they often improve only a single behavioral phase or rely on static update rules. In contrast, the TDBO algorithm systematically integrates five complementary strategies: dynamic role assignment among producers, searchers, and carriers; spiral search for fine-grained local exploitation; Lévy flight for long-distance exploration; random opposition-based learning to maintain population diversity; and Gaussian dimension-wise mutation for escaping stagnation. These mechanisms are embedded into a multi-stage update framework, allowing adaptive coordination between global and local search behaviors across different evolutionary phases.
Moreover, TDBO introduces a behaviorally mapped subgrouping model that is biologically inspired yet mathematically structured, enabling each subgroup to execute distinct update strategies based on its role and fitness rank. This formulation not only enhances convergence precision and robustness but also outperforms previous DBO variants in complex, high-dimensional constrained optimization scenarios such as microgrid scheduling. Therefore, the proposed TDBO represents a substantial methodological advancement over existing DBO-based algorithms.
Building upon these behavioral foundations, the TDBO algorithm incorporates several substantive methodological innovations that clearly differentiate it from both the canonical DBO and previous variants. Specifically, TDBO introduces a time-dependent contraction factor, which dynamically shrinks the search space as iterations proceed, thereby accelerating convergence and preventing excessive exploration in later optimization stages. Additionally, an adaptive spiral search mechanism is embedded to enhance local exploitation, enabling fine-tuned solution refinement during the middle and late evolutionary phases. The algorithm also employs distribution-based perturbation and dynamically controlled mutation, increasing population diversity and mitigating the risk of premature convergence. Unlike prior studies—which often improve DBO through the isolated addition of a single mechanism—TDBO systematically integrates these strategies into a unified, multi-stage update framework, wherein the interplay between global and local search is adaptively coordinated based on the evolutionary stage and population fitness ranking.
Moreover, TDBO employs a behaviorally mapped subgrouping model that leverages both biological inspiration and rigorous mathematical design: each subgroup (producers, searchers, carriers) is dynamically assigned according to real-time fitness rankings, and executes tailored update strategies specific to its role and phase. This structured role allocation is not a mere combination of existing strategies but a cohesive, biologically grounded system for adaptive population management. As a result, TDBO achieves superior convergence accuracy, stability, and scalability in high-dimensional, constrained optimization settings, as evidenced by its performance in microgrid scheduling scenarios.
In summary, the proposed TDBO represents a substantial methodological advancement over existing DBO-based algorithms, offering a structurally integrated and adaptively coordinated optimization framework, rather than a simple aggregation of heuristic enhancements. This not only clarifies but concretely substantiates the advantages of TDBO over prior approaches.
Multi-Strategy Enhancement Mechanisms
To overcome the limitations of the original Dung Beetle Optimization algorithm, such as its tendency to become trapped in local optima and its relatively slow convergence speed, multiple enhancement mechanisms are introduced:
First, a random opposition-based learning strategy is introduced. When early convergence is detected during the optimization process, a portion of individuals are reflected in the opposite direction to promote exploration and maintain population diversity. Second, a spiral search strategy is employed to enhance local exploitation capability, where a spiral factor defined as
is used to generate new positions for individuals. Third, Lévy flight is adopted to increase the probability of long-distance jumps, with Lévy-distributed random numbers used for large-step updates in the carrier subgroup, expressed as:
where:
It is typically set within the range [1.5, 2], where
and
are random variables following a normal distribution. Fourth, to address the stagnation issue of the dung beetle algorithm in local regions, Gaussian dimension-wise mutation is introduced. When an individual exhibits poor fitness or stagnation, Gaussian perturbation is applied to selected dimensions, allowing the individual to continue searching within its neighborhood. The expression can be defined as:
where
denotes the standard deviation, which is either decayed or adaptively adjusted to balance the breadth and depth of the search.
Fitness Evaluation and Penalty Term Design
During the algorithm’s iterative process, the objective function value of each individual is calculated based on the operational model of the microgrid system, and penalty terms for constraint violations are added to obtain the final fitness value. For the multi-objective optimization problem of the microgrid, this study combines the operating cost
and environmental cost
, and superimposes penalty terms
associated with constraints such as power balance, ramp rate limits, and
SOC violations, resulting in:
If an individual violates a given constraint, a corresponding penalty value is added to its fitness according to the degree of violation, ensuring that the algorithm favors solutions that comply with all physical constraints. With this fitness definition, the TDBO algorithm is capable of dynamically balancing global exploration and local exploitation during the updating process, thereby continuously approaching the optimal scheduling solution.
To enhance the systematicity and controllability of constraint handling, this study adopts a unified weighted penalty method to explicitly embed all constraint conditions into the fitness function. These include power balance constraints, upper and lower output limits of equipment, state of charge (
SOC) constraints for the energy storage system, grid power exchange limits, and ramp rate constraints of generating units. Each type of constraint is associated with an independent penalty function.
Here, α represents the weighting coefficients for each penalty term; denotes the sum of squared deviations in power balance; captures the SOC violation errors of the energy storage system; is the penalty term for ramp rate violations of generation units; and correspond to the boundary penalties for device output and grid interaction power, respectively. To avoid subjective bias in the optimization results caused by manual parameter settings, a sensitivity analysis of the weighting coefficients α is conducted in the simulation experiments. This ensures that the penalty functions effectively constrain infeasible solutions without overshadowing the dominance of the original optimization objectives. This mechanism enables TDBO to dynamically identify and penalize constraint-violating individuals during the optimization process, guiding the population to rapidly converge toward the feasible solution space.
The coefficients of in Equation (39)—such as cost, emission, and efficiency parameters—are determined based on a combination of engineering specifications, manufacturer data, and literature benchmarks relevant to distributed energy systems. The coefficients of , including cost, emission, and efficiency parameters, are determined based on a combination of actual engineering data, manufacturer technical documentation, and established values reported in the literature. For each generation unit and energy storage device, the corresponding coefficients are set according to typical performance specifications and operational characteristics for representative equipment widely used in practical microgrid applications.
This parameter selection approach ensures the flexibility and scalability of the proposed TDBO algorithm for different scenarios. By adjusting the coefficients to match the characteristics of specific devices or regional market/pricing structures, the model can be readily adapted to diverse microgrid configurations and operational environments. Sensitivity analyses further confirm that the algorithm maintains its effectiveness and robustness even when the coefficients vary within reasonable engineering ranges, supporting its practical applicability and generalization potential.
Specifically, coefficients representing fuel consumption, emission rates, and operational costs for each generation unit are set according to the technical documentation of actual equipment used in microgrid applications (e.g., typical values for diesel generators, gas turbines, and storage devices). Where direct measurement or manufacturer data are unavailable, reference is made to values reported in prior research and established engineering handbooks.
To clarify potential ambiguity, the coefficients and that appear in Equations (3) and (5) refer to the internal cost coefficients used in the economic modeling of gas turbines and diesel generators, respectively. These coefficients are associated with fuel cost components and are embedded within the operation cost models of individual generation units. In contrast, the coefficients (i = 1, 2, …, 5) presented in Equation (39) represent weighting parameters assigned to different constraint violation penalty terms—such as power balance, ramp rate, and SOC violations—in the fitness evaluation process. Therefore, the symbols used in Equations (3)–(5) and (39) refer to distinct quantities serving different roles within the model: the former relates to operational economics, and the latter to constraint enforcement
Although this study adopts a weighted summation approach to integrate the operating cost and environmental cost into a single-objective formulation, this strategy is a deliberate modeling choice made in consideration of engineering practicality and algorithmic convergence. Compared with traditional Pareto-based methods, the weighted sum method effectively reduces computational complexity and improves convergence speed while maintaining the feasibility of scheduling solutions. It is particularly suitable for microgrid scenarios that require fast response and explicit preference control.
The penalty coefficients used in the unified constraint violation function were selected through a combination of empirical tuning and sensitivity analysis. Initially, the coefficients were set based on established values commonly reported in the literature for similar multi-objective microgrid scheduling problems, ensuring that constraint violations were sufficiently penalized relative to the objective function scale. Subsequently, a series of parametric sensitivity tests were conducted to assess the impact of different penalty weights on solution feasibility and optimization performance. The selected values were those that consistently ensured all critical constraints—such as power balance, energy storage SOC limits, and ramp rate restrictions—were strictly enforced, while still allowing efficient exploration of the solution space. This calibration approach guarantees both the practicality and robustness of the penalty mechanism across diverse operating scenarios.
To demonstrate its multi-objective optimization capability, multiple sets of weighting coefficients were tested in simulation experiments. The results revealed distinct shifts in scheduling outcomes between economic and environmental objectives under different weights, confirming that the scalarized formulation still retains strong expressive power for multi-objective decision-making. Furthermore, the proposed TDBO algorithm is not a mere wrapper of traditional single-objective optimizers. Instead, it introduces strategic innovations such as role-based subpopulation division, spiral search, Lévy flight, and opposition-based learning, which together enhance global exploration and solution stability—further supporting the algorithm’s adaptability and novelty in complex energy system optimization.
Algorithm Iteration Process
Based on the aforementioned improvement strategies, the main iteration process of the Tuned Dung Beetle Optimization (TDBO) algorithm can be summarized as follows: first, the population is randomly initialized, with each individual representing a microgrid scheduling solution. Then, the fitness of all individuals is evaluated, and the population is divided into subgroups based on fitness ranking. Individuals assigned as producers, searchers, and carriers are updated using distinct position update equations, followed by boundary handling and the application of Gaussian or Lévy perturbations. Subsequently, fitness values are re-evaluated, and both the global best and individual historical best positions are updated. This process is repeated until the maximum number of iterations is reached or a convergence criterion is satisfied. Through this multi-subgroup, multi-strategy coordination mechanism, the algorithm is able to thoroughly explore the feasible solution space during iterations and gradually obtain scheduling solutions that are superior in both operational cost and environmental impact.
Simulation Settings
The simulation setup of the Tuned Dung Beetle Optimization (TDBO) algorithm for the multi-objective optimal scheduling problem of microgrids is configured as follows. All simulations are conducted using the MATLAB R2024b platform. First, forecast data for various microgrid components are extracted, including 24-h load profiles, predicted photovoltaic and wind power outputs, and corresponding electricity purchase and sale price information. Based on this dataset, the microgrid scheduling problem is formulated with 144 decision variables, representing the power outputs of six types of devices across 24 time periods. Upper and lower bounds are assigned according to the operational characteristics of each device—for example, the maximum outputs of photovoltaic and wind units are limited to their predicted values, the charging and discharging range of the energy storage system is set to [−30, 30] diesel generators and gas turbines are constrained by strict minimum and maximum output limits, and grid interaction power is bounded on both sides to ensure power balance at each time step.
In terms of algorithm parameter settings, the population size is set to 30, and the maximum number of iterations is 500. To verify the effectiveness and stability of the TDBO algorithm, the global best fitness value of each generation is recorded during the simulation process, and the corresponding convergence curve is plotted. The optimized results are decomposed into six sub-variables—namely, photovoltaic, wind power, energy storage, diesel generator, gas turbine, and grid interaction—to visually present the power dispatch strategy of each component. During execution, the algorithm applies different update rules to each subgroup and conducts boundary handling for updated individuals to ensure that all solutions remain within the feasible solution space.
Additionally, the simulation incorporates penalty function parameters to quantify the costs associated with violating constraints such as power balance, energy storage SOC limits, and ramp rate restrictions. This ensures that the objective function accurately reflects both the economic and environmental performance of the microgrid system. To guarantee the robustness of the simulation results, all experiments are repeated multiple times, and the optimal values, average performance, and convergence speeds are statistically analyzed and compared.
Although the multi-objective optimization method adopted in this study is implemented through a weighted summation model, it essentially retains the ability to balance and regulate preferences between conflicting objectives. During the simulation process, the operating cost and environmental cost were integrated using weight coefficients which transforms the multi-objective model into a scalar objective. The solution obtained under this configuration corresponds to a specific point on the Pareto front and represents the best compromise between economic efficiency and environmental sustainability under balanced preference settings.
To further demonstrate the preference-guided capability of the proposed method, multiple sets of weight combinations were tested. The results exhibit a clear trade-off trend between economic and environmental objectives, forming a set of feasible Pareto-like solutions. Among all feasible solutions, the final optimal solution selected in this study corresponds to the intermediate weight configuration (α = 0.5), which minimizes the overall cost while satisfying engineering constraints. This solution exhibits a well-balanced trade-off between economic and environmental objectives, ensuring strong representativeness, operational feasibility, and practical applicability.
Figure 4 illustrates the trade-off trends between operating cost and environmental cost under different weight coefficients (α) in the microgrid scheduling scheme. It can be observed that as α\alphaα increases, the operating cost decreases while the environmental cost increases, indicating a significant trade-off between the two objectives. When α\alphaα is small, the optimization is more focused on economic performance, resulting in lower operating costs but higher environmental costs; conversely, larger values of α\alphaα prioritize environmental benefits at the expense of higher operating costs.
Notably, around α = 0.5, the curves of operating cost and environmental cost are relatively close, and the error bars indicate that the fluctuations of both metrics are minimal. This suggests that the scheduling solution at α = 0.5 achieves a favorable balance between economic efficiency and environmental protection. Therefore, α = 0.5 is selected as the final weighting configuration, as it effectively reconciles cost control with emission reduction and aligns with the typical engineering principle of “compromise first” in real-world microgrid operation. The optimal solution under this weight is thus more representative and practically applicable.
The microgrid dispatching problem inherently exhibits multi-objective characteristics, involving trade-offs between economic efficiency and environmental sustainability. While the weighted summation method adopted in this study simplifies the multi-objective optimization into a single-objective framework, it is acknowledged that the selection of the weighting parameter α may not always achieve a perfectly balanced compromise between economic and environmental objectives.
To address this limitation, multiple α values were tested in the simulation analysis, and the resulting solutions were compared to illustrate the effect of different weightings. In practical applications, α can be flexibly tuned according to operator preferences, regulatory requirements, or specific scenario priorities. Future work will focus on integrating more advanced multi-objective optimization methods—such as Pareto-based evolutionary algorithms—to provide a broader set of compromise solutions and support more nuanced decision-making in microgrid scheduling.
All simulations and algorithm implementations were conducted using MATLAB R2024b. All algorithms were executed in single-threaded mode without parallel acceleration to ensure fair comparisons and reproducibility of the results.
Evaluation Metrics
This study employs multiple evaluation metrics to comprehensively assess the performance of the Tuned Dung Beetle Optimization (TDBO) algorithm in solving the multi-objective optimal scheduling problem of microgrids. First, with respect to the objective function of the scheduling model—namely, the joint minimization of operating cost and environmental cost—the optimal fitness value is defined as the primary indicator, where a lower value indicates better performance in terms of economic efficiency and environmental sustainability. Additionally, by statistically analyzing the best, average, and standard deviation values obtained from multiple independent runs, the algorithm’s stability and robustness can be intuitively evaluated. The best value reflects the algorithm’s peak performance in global exploration, the average value represents its overall effectiveness, and the standard deviation indicates the degree of dispersion in the solution set.
In addition, convergence speed serves as another critical evaluation metric. By recording the global best fitness value at each generation, a convergence curve is plotted to illustrate the number of iterations required for the algorithm to progress from initialization to final convergence. A fast convergence rate and a smooth curve indicate that the algorithm has achieved a favorable balance between exploration and exploitation. For the high-dimensional and nonlinear optimization problem addressed in this study, computational time is also considered as a supplementary metric to evaluate the algorithm’s solving efficiency under the given parameter settings.
In terms of constraint satisfaction, cumulative penalty values are calculated for violations of power balance, energy storage
SOC constraints, and ramp rate limits, and are compared with the objective function value to assess whether the algorithm can effectively guide individuals to converge within the feasible solution space. Specifically, if the power balance error of an individual at time step
t is denoted as
, the total violation index can be defined as:
A lower value of this index indicates that the scheduling solution better satisfies the operational constraints of the actual system.
Finally, based on the scheduling results, a disaggregated analysis of the output profiles of each subsystem—such as PV, WT, BESS, DE, MT, and Grid—is conducted. The cost contribution and environmental emissions of each device are calculated, enabling a comprehensive system-level evaluation of the scheduling solution’s overall performance.