Skip to Content
EnergiesEnergies
  • Article
  • Open Access

3 December 2026

26 Pages

When Does a Metaheuristic Outer Search Pay off in Planning Integrated Energy Systems? Certified Benchmarks of GWO– and PSO–MILP Against Exact Bounds

and
NOVA School of Science and Technology, UNINOVA-CTS and LASI, NOVA University Lisbon, 2829-516 Caparica, Portugal
*
Author to whom correspondence should be addressed.
This article belongs to the Section F2: Distributed Energy System

Abstract

Hybrid approaches in which a population-based algorithm proposes capacities and a mixed-integer linear program (MILP) evaluates their operation are common for sizing integrated energy systems (IESs), but their designs are rarely checked against the exact optimum. This paper benchmarks the authors’ Grey Wolf Optimizer with an inner MILP (GWO–MILP) and the corresponding particle swarm (PSO–MILP) and gaining–sharing knowledge-based (GSK–MILP) searches against the exact MILP and its lower bound, for a community of three IESs under six contingency scenarios. With linear device models, GWO–MILP runs end on average 0.09–0.39% and at worst 0.53% above the exact solutions and reproduce the direction, but not the size, of the planning effects, whereas the exact MILP is faster and certifies gaps of 0.01–0.30%. With size-dependent costs and efficiencies, an MILP with size grids comes within 0.1% of the best design found. For a standard on the shedding probability of the cost-minimising operating policy, simulating the policy matters more than the search: the outer search reaches violation probabilities of 6–8% at 2.0–3.4% higher cost, while an MILP with a tighter shedding cap and a wider uncertainty set, tuned by the same simulation, reaches about 5% at 4.4%. At equal budget, GWO–MILP, PSO–MILP and GSK–MILP end within 0.2 percentage points of each other. A metaheuristic outer search therefore rarely pays off and should be benchmarked against an exact bound.

1. Introduction

Integrated energy systems (IESs) couple electricity, heat, cooling and gas through conversion and storage devices, so that synergies between these four carriers can be exploited that would be missed if each carrier were planned individually [1,2]. When device models are linear or piecewise linear, the design of an IES and its operation over representative periods can be formulated as a single mixed-integer linear program (MILP). Branch-and-bound solvers return, together with the best design found, a lower bound on the optimum, which shows how close this design is to the global optimum [3,4,5].
Despite this, a large part of the sizing literature relies on population-based metaheuristics, including genetic algorithms, particle swarm optimisation (PSO) and the Grey Wolf Optimizer (GWO) [6,7,8,9]. A common hybrid method lets a metaheuristic propose the capacities in an outer loop, while an inner optimisation, usually an MILP solved with a commercial solver, schedules the devices for each candidate and feeds its cost back to the outer loop [10,11]. Recent studies use the same bilevel structure with a metaheuristic in the upper level [12,13], or reduce it to a single-level MILP through the optimality conditions of a linear lower level [14]. Metaheuristics require only an evaluation of a candidate solution, which makes them attractive when the operating problem is non-convex, discontinuous or a black-box simulation model. The first author applied GWO to optimal load shedding in an earlier study [15], and the GWO–MILP scheme benchmarked here was developed during the same doctoral research, so the benchmark is a self-benchmark of the authors’ own method.
There are three main weaknesses in this literature. First, a metaheuristic returns the best design it finds and does not provide a bound, and claims of near-optimality are rarely verified against an exact solution of the same model. The few comparisons available concern building operation rather than planning; they find the metaheuristic within about 1% of a (piecewise) linear program, but much slower [16,17]. Second, algorithms are usually compared with each other on the same budget. By the no-free-lunch theorem, however, no algorithm is the best on all problems [18], so such rankings say little beyond the instance tested. Finally, several popular algorithms, including GWO, have been shown to repeat the mechanisms of well-known swarm methods behind a new metaphor [19,20,21], and valid comparisons of stochastic methods require appropriate statistical tests [22].
Two further strands of literature bear on the question. Planning problems whose operating stage is itself an optimisation are bilevel; with a convex lower level, they can be reduced to a single-level MILP through optimality conditions and big-M constants, which must be chosen with care [23], whereas mixed-integer lower levels require dedicated methods [24]. Robust planning against a polyhedral uncertainty set is usually solved by column-and-constraint generation [25], of which the box set used here is the simplest case. Between pure metaheuristics and exact solvers lie matheuristics, which combine the two [26]; modern MILP solvers already contain such heuristics; for instance, relaxation induced neighbourhood search (RINS) [27], so an exact MILP run is itself a hybrid of bounding and heuristic search. Comparisons of an outer search with the exact solution of the same IES sizing model, however, remain rare.
In this study, we examine when a metaheuristic outer search is advantageous in IES planning, using a planning problem whose exact optimum and lower bound can be computed. The problem is the capacity planning of a community of three interconnected IESs that can exchange electricity, heat and cooling, under six structural contingency scenarios and a box worst case of renewable output and demand. It is based on the case-study data of [28]. Its contributions are
  • A benchmark of the GWO–MILP outer search against the exact MILP and its certified lower bound, with repeated runs and diagnostics of the inner solves, for four planning cases of increasing difficulty (Section 4.1).
  • A comparison of three ways of handling size-dependent device costs and efficiencies: an outer search over all capacities, an MILP with size grids and piecewise-linear costs, and a reduced search over the few nonlinear sizes (Section 4.2).
  • A test of the case usually made for the outer search: a reliability standard on the shedding probability of the cost-minimising operating policy, which the planning MILP does not express directly, with the outer search compared with a family of MILP surrogates—a higher value of lost load, a tighter shedding cap and a wider uncertainty set—on 3000 out-of-sample samples (Section 4.3).
  • A comparison of GWO, PSO and the gaining–sharing knowledge-based algorithm (GSK) [29,30] at equal budget, in which all are scored against the exact optimum rather than against each other, with an ablation of the GWO modifications (Section 4.4), and recommendations on the choice of planning method (Section 5).
The planning problem and the benchmark instances are given in Section 2, the methods in Section 3 and the results in Section 4; Section 5 discusses the results and Section 6 concludes.

2. Planning Problem and Benchmark Instances

2.1. Community and Cases

The community includes three neighbouring IESs, each connected to the electricity and gas networks. Each IES can install photovoltaic units (PV), wind turbines (WT), a combined heat and power (CHP) unit, a battery (ESS), an electric boiler (EB), a gas boiler (GB), thermal storage (TS), an absorption chiller (ACH) and an electric chiller (ECH). In total, there are nine resources and 27 capacities. The electrical, heating and cooling demands and the normalised PV and WT profiles on three representative days (summer, transitional and winter) are those of the community of [28]. Each IES may buy at most 1500 kW from the grid, sell at most 500 kW to it and draw at most 1000 kW of gas; where a market is allowed, it may exchange at most 500 kW of each carrier with each peer.
Each IES has its own feeder connected to a common bus, which is tied to the upstream grid through a transformer and a medium-voltage feeder. Six structural scenarios describe the loss of grid and peer connections (Table 1). A fault stops the exchange of electricity, while the exchange of heat and cooling continues. The probabilities are a deliberate stress case that makes the contingencies visible in the designs. Four cases are planned (Table 2), with or without a peer-to-peer (P2P) market, and either for the normal topology only or for all six scenarios.
Table 1. Structural scenarios (stress case).
Table 2. Planning cases (P2P, peer-to-peer).

2.2. Formulation

The planning problem minimises the total annual cost of the community, the sum of the annualised investment and the expected operating cost of every IES:
min X   C tot = ∑ i ∈ I C i inv + C i OC
C i inv = ∑ r ∈ R C R F r   c r I   X i , r ,     CR F r = d 1 + d n r 1 + d n r − 1
C i OC = ∑ s ∈ S ω s ∑ z ∈ Z D z ∑ t = 1 24 C t , z , i , s E + C t , z , i , s OM + C t , z , i , s C O 2 + C t , z , i , s IL + C t , z , i , s P 2 P
where crI is the specific investment cost, nr the lifetime and d the interest rate, which give the capital recovery factor CRF, and the operating cost (3) sums the costs of grid and gas purchases net of sales, operation and maintenance (O&M), CO2 emissions, load shedding and P2P transaction charges over the structural scenarios s with probabilities ωs, the representative days z with weights Dz and the hours t. The five terms of (3) are, in this order, the costs of grid and gas purchases net of sales (E), of operation and maintenance (OM), of CO2 emissions, of load shedding (IL) and of P2P transaction charges, each of IES i in hour t of day z and scenario s. The operating constraints, summarised in Appendix A, comprise the energy balances of electricity, heat and cooling, the device models, the storage dynamics with charge/discharge binaries, the connection limits and the P2P exchanges, whose electrical part is switched off by binary parameters in the contingency scenarios. The CHP unit is modelled by an extraction-condensing operating region [31] whose corner points scale with the capacity XCHP and are multiplied by the binary on/off status uCHP in every hour, day and scenario, so these constraints are bilinear. Load shedding is admitted at 0.5 $/kWh for each carrier, with up to 20% of the demand in the normal topology and up to the full demand in the contingencies:
0 ≤ P t , z , i , s IL ≤ γ s P t , z , i L ,   0 ≤ H t , z , i , s IL ≤ γ s H t , z , i L ,   0 ≤ Q t , z , i , s IL ≤ γ s Q t , z , i L ,     γ S 1 = 0.2 ,   γ s ≠ S 1 = 1
Renewable output and electrical demand are protected by a box uncertainty set [32] with relative half-widths of 0.15 and 0.10; because each hourly electrical balance contains a single uncertain term, its worst case is the lowest renewable output together with the highest demand in every hour, and the balance is imposed at this realisation. Every capacity is semicontinuous, Xi,r ∈ {0} ∪ [50, Xrmax] (kW or kWh). The problem therefore has three kinds of binaries—CHP status, storage charge/discharge and the installation decisions—and bilinear products of capacity and status.

2.3. Benchmark Cost Data and Instances

With published technology costs (CHP at 2000 $/kW, PV and WT at 691 and 1041 $/kW), the community installs neither CHP units nor batteries, which makes planning easy. All benchmarks therefore use harder cost data, under which CHP units and batteries and their binaries are installed: CHP at 800 $/kW, PV and WT at 1456 and 1544 $/kW, and a battery throughput cost of 0.003 $/kWh without cycle ageing (Table 3). Prices follow the time-of-use structure of [28] (Table 4). Each IES has the same candidate resources and bounds. The benchmarks admit shedding of up to 20% of the demand in the normal topology (Equation (4)). The cost data and the contingency probabilities are chosen to make the benchmark hard, not to represent a particular site; the planning results themselves, such as the saving of the market or the reduction in electricity not supplied, illustrate the methods and are not meant as planning findings.
Table 3. Candidate resources (benchmark cost data); COP, coefficient of performance.
Table 4. Prices and economic data of Instance I.
Two instances are used. Instance I uses the data of Section 2.1 and Table 3 and Table 4 and serves for the benchmark with linear device models (Section 4.1). Instance II is an earlier preparation of the same case-study data that differs from Instance I in the time-of-use tariff (valley, flat and peak prices of 0.0546, 0.105 and 0.1624 $/kWh, from 22:00 to 06:00, 06:00 to 10:00 and 13:00 to 17:00, and 10:00 to 13:00 and 17:00 to 22:00) and in a few hourly values of the renewable and heat-demand profiles; it serves for the size-dependent data, the reliability standard and the comparison with PSO and GSK (Section 4.2, Section 4.3 and Section 4.4). Every comparison of methods is made within one instance, and costs are not comparable between instances. Instance II was kept for Section 4.2, Section 4.3 and Section 4.4 for a practical reason: the outer search runs that these tests required, about 40 h in total, had already been made on it. We do not claim that the comparisons are independent of the instance: the gaps differ between the instances—0.26–0.30% for the best GWO–MILP designs of Cases 1 and 2 on Instance I and 0.13–0.22% on Instance II (Section 4.1 and Section 4.4)—although the exact MILP beats the outer search on both. Both instances are available on request (Data Availability Statement).
Table A1 (Appendix B) summarises both instances. The exact MILP objectives of Cases 1–4 are 7144.6, 7218.2, 6812.9 and 6747.5 k$/year on Instance I (Section 4.1), and those of Cases 1 and 2 are 6988.6 and 7072.3 k$/year on Instance II (Section 4.4). On the hourly profiles of Instance I, the electrical peaks of IES 1–3 are 2.12, 1.77 and 1.93 MW; the heat peaks, all on the winter day, are 0.39, 2.80 and 2.06 MW; and the cooling peaks, all on the summer day, are 0.49, 2.92 and 0.93 MW; IES 2 has no heat demand on the summer day and no cooling demand on the other days. The mean capacity factors on the summer, transitional and winter days are 0.26, 0.16 and 0.07 for PV and 0.19, 0.18 and 0.19 for the WTs; the peaks of Instance II are the same, and its mean capacity factors differ by at most 0.01.
For the tests of Section 4.2, four resources receive size-dependent data from published sources (Table 5). The shape of the size dependence is taken from the source and its level is set to the cost data of Table 3 at a reference size; between data points, values are interpolated linearly in ln X and held constant outside the data range. For the CHP unit, the specific cost is almost flat up to about 630 kW (814 $/kW at 100 kW, 797 $/kW at 633 kW) and falls to 575 $/kW at 2000 kW, and the full-load efficiency rises from 0.30 at 100 kW to 0.43 at 2000 kW. With a size-dependent efficiency, the admissible CHP size depends on the size itself through the gas limit. Every nonlinearity is, however, a separable function of a single capacity.
Table 5. Size-dependent device data.

3. Methods

3.1. Exact MILP

Each product w = XCHP × uCHP of a bounded continuous capacity, 0 ≤ XCHP ≤ Xmax, and a binary status is replaced by one auxiliary variable and the McCormick envelope [36], which is exact for a binary factor:
w ≤ X max u ,     w ≤ X ,     w ≥ X − X max 1 − u ,     w ≥ 0
With u = 0, the constraints force w = 0 and with u = 1 they force w = X, so the planning problem becomes an MILP whose relaxation gives a valid lower bound. CPLEX then returns the cost of the best design found and a lower bound that no design can beat; their relative difference certifies how far the design can be from the global optimum. For three IESs, six scenarios and three days of 24 h, the model has 27 capacity variables and several thousand binaries. CPLEX used all cores, a relative gap of 10−4 and a time limit of 1 h (4 h for Case 3). For a binary factor, (5) coincides with the standard big-M linearisation of the product of a binary and a bounded continuous variable, with Xmax as the constant, and adds no approximation. The disjunctive constraints (A2)–(A3) of the CHP region and the exclusion of simultaneous charging and discharging of the storage use the constant M = 106; a constant of the order of the capacity bounds (2000 kW for the CHP unit, 1500 kW of storage power) would be valid as well and would tighten the LP relaxation, but its effect on the solution times was not tested.
For the size-dependent data of Table 5, the MILP selects among discrete CHP (and chiller) sizes with binary variables, each size with its own part-load curve (a size grid of 50, 100 or 200 kW), and represents the PV and battery costs as piecewise-linear functions with special ordered sets of type 2 (SOS2) [37]. The grid restricts the CHP sizes, so the MILP gap refers to the gridded problem, and all designs are re-evaluated with the nonlinear model.

3.2. GWO–MILP Outer Search

Fixing the capacities X turns the planning problem into an operating problem. The outer search minimises
F X = ∑ i C i inv X + min y ∈ Y X ∑ i C i OC X ,   y
where Y(X) is the feasible set of the operating variables for the fixed capacities. For fixed X, the inner problem is an MILP over all scenarios and days. It contains CHP commitment and storage binaries, so F(X) is non-convex and discontinuous in X. Generalised Benders decomposition [38] needs a convex second stage and the integer L-shaped method [39] binary first-stage variables, so neither applies directly, whereas a derivative-free search needs only evaluations of F. Applying them would require relaxing the operating binaries in the subproblems or discretising the capacities, which changes the problem, and such variants were not tested. Since the problem is an MILP, the natural reference is the exact solver, which itself combines branch and bound with MILP-based heuristics such as RINS [27]. In Cases 1 and 2, without a market, the problem separates into three independent problems of nine capacities each; the exact MILP exploits this structure implicitly, whereas the outer search, as in most hybrid sizing studies, works on all 27 capacities at once. A per-IES variant of the outer search, which exploits this separability, is therefore also tested (Section 3.3).
The GWO [40] is used as the outer search because it is among the most widely used metaheuristics in recent IES and microgrid sizing studies [8,9,12,13], needs few parameters and is the method of the authors’ earlier work [15]; PSO, the most common baseline, and GSK, a recent competition winner, serve for comparison (Section 3.3). In GWO, each agent is a vector of the 27 capacities within their bounds. At iteration l, every agent X moves towards the three best designs found so far, Xα, Xβ and Xδ:
D k = C k ∘ X k − X ,   X ′ k = X k − A k ∘ D k ,   k ∈ { α , β , δ } ,     X new = 1 / 3 X ′ α + X ′ β + X ′ δ
with Ak = 2a·r1 − a and Ck = 2r2 for uniform random vectors r1 and r2 and the element-wise product ∘. Here X is the position of the agent being updated, Xk the position of leader k, Dk the distance between them and X′k the position proposed by leader k; r1, r2, Ak and Ck are drawn anew for every agent, leader and coordinate, and l = 1, …, Itmax counts the iterations. Two changes to the standard update were made. The control parameter decreases faster and never reaches zero, so the search turns exploitative after about two thirds of the iterations but keeps some exploration:
a l = max 0 ,   2 − 3 l / I t max + 0.05 sin l / 10 + 0.06
and, as a mutation, ⌈27/4⌉ = 7 coordinates of each agent are replaced before every update by uniform random values within their bounds; since the update then moves every coordinate towards the leaders, these values enter only through the distances Dk and enlarge the steps of the chosen coordinates. Both changes address the small budget of 100 iterations and the flat cost surface near the optimum (Section 4.1). With the standard linear decrease in a(l) to zero, the steps vanish towards the end of the run, and the population contracts around the leaders before the flat region near the optimum has been searched; the positive floor of a(l) and the mutation keep the steps of some coordinates large enough to continue refining the design until the budget is spent. Section 4.4 compares this variant with the standard GWO at the same budget and seeds: in Case 1, the modifications lower the mean final gap from 0.65% to 0.26%, and all five runs, instead of one, end within 0.5% of the optimum. The population has 50 agents and a run 100 iterations, i.e., 5000 inner MILP evaluations (Figure 1). Half of the initial agents are drawn uniformly from the upper half of each capacity range, which favours feasible designs, and the other half from the whole range. Each evaluation solves the inner MILP with CPLEX (relative gap 10−4, 60 s limit); infeasible candidates are charged 5 × 106 $, and capacities below 50 kW (kWh) are set to zero. Cases 1 and 2 were run five times, Case 3 three times and Case 4 once, with fixed seeds; the best, mean and worst designs are reported (Table 6 and Table 7).
Figure 1. GWO–MILP planning scheme. The colours of the boxes have no meaning; the arrows show the order of the steps, the curved arrow the return to the next iteration l, and X* is the best design found.
Table 6. GWO–MILP versus the exact MILP (Instance I; k$/year).
Table 7. Repeatability of the GWO–MILP runs (Instance I; planned total cost, k$/year).

3.3. PSO–MILP and GSK–MILP

For the comparison of Section 4.4, a standard global-best PSO [41] with an inertia weight [42] decreasing linearly from 0.9 to 0.4 and c1 = c2 = 2 was implemented with the same encoding, fitness function, bounds, 50 kW threshold, infeasibility penalty and parallel scheme as GWO–MILP:
v k l + 1 = w l v k l + c 1 r 1 ∘ p k − X k l + c 2 r 2 ∘ g − X k l ,   X k l + 1 = X k l + v k l + 1
where pk is the best position of particle k, g the best position of the swarm, w(l) = 0.9 − 0.5 L/Itmax, and the velocities are clamped to 20% of the range of each capacity. With 50 particles and 100 iterations, PSO–MILP has the same budget of 5000 inner MILP evaluations as GWO–MILP. Both start from populations drawn with the same rule (Section 3.2) from distinct seeds (1000 + run for GWO, 2000 + run for PSO), so the two searches differ only in their position update and their random numbers. PSO is used in its standard form, as a reference that needs no tuning; the effect of the two GWO modifications is measured separately against the standard GWO (Section 4.4).
For the same comparison, the gaining–sharing knowledge-based algorithm (GSK) [29], whose adaptive variants were among the best methods of the CEC 2020 and CEC 2021 competitions [30], was implemented in its standard form with the same encoding, fitness function, bounds, threshold, penalty, initialisation rule, parallel scheme and budget (50 individuals and 100 generations, including the initial population). Each individual updates its coordinates in a junior phase, from its neighbours in the population ranked by fitness and a random individual, and in a senior phase, from the best, middle and worst groups of the population, with the share of junior coordinates decreasing as (1 − l/Itmax)K. The standard parameters were used: knowledge rate K = 10, knowledge factor kf = 0.5, knowledge ratio kr = 0.9 and p = 0.1 for the best and worst groups, with greedy selection and seeds 3000 + run. Because of the time available, GSK was run five times on Case 1 only.
In Cases 1 and 2, which have no market, the modified GWO was also applied to each IES separately (per-IES GWO–MILP): it searches the nine capacities of one IES with 30 agents and 56 iterations, i.e., 1680 inner evaluations per IES and 5040 in total, about the budget of GWO–MILP, and each evaluation solves the operating MILP of that IES only. The cost of a run is the sum of the three IES costs, and its convergence is measured by the sum of the three best costs after the same iteration, as if the three searches ran side by side. For the exact designs of Cases 1 and 2, the three single-IES solves add up to the full operating MILP within 0.0001%. Five runs were made per case, with seeds 4000 + 10·run + IES.

3.4. Reduced Search and Polishing for Size-Dependent Data

Because only a few capacities have size-dependent data, two hybrids are also tested. The reduced search is a deterministic coordinate (pattern) search over the three CHP sizes only, and each evaluation solves the exact planning MILP for all other capacities. Starting from a given design, it first switches each CHP unit off or on (at 200 kW) and then changes one CHP size at a time by ±100 kW, keeping every change that lowers the cost, and reduces the step to 50, 25 and 10 kW when no change helps. It has no population and no random numbers; in Table 8, it needed 11 MILP evaluations. Polishing fixes the nonlinear sizes of the best GWO–MILP design and solves the planning MILP for the rest, once.
Table 8. Size-dependent CHP data only (Instance II, Case 2).

3.5. Reliability Standard and Policy Evaluation

A planner may want a standard on the behaviour of the operating policy rather than on the planned dispatch. Here, for every IES, the probability that the cost-minimising operating policy sheds more than 20% of the realised electrical demand in some hour of the normal topology must not exceed 5%:
p i X = 1 N ∑ n = 1 N 1 max t , z P t , z , i , n IL P t , z , i , n L > 0.2 ≤ 0.05
where n indexes forecast-error samples of renewable output and electrical demand, and shedding and demand refer to the normal topology. In (10), 1[·] is the indicator function, N the number of samples, t = 1, …, 24 and z the hours and representative days, and PILt,z,i,n and PLt,z,i,n the electricity shed by the operating policy and the realised electrical demand of IES i in sample n. The forecast errors are normally distributed and follow a first-order autoregressive process over the 24 h of each day with coefficient 0.5; their standard deviations are 10% of the installed capacity for PV, 19% for the WTs and 13% of the demand. The renewable errors are common to the three IESs, and the demand errors are independent between them. The errors are not truncated at the box of Section 2.2, so a sample may lie outside it. The planning cap (4) does not apply to the operating policy, which may shed up to the full demand at 0.5 $/kWh; a violation occurs when the shedding exceeds 20% of the realised demand in some hour. The shedding PIL is the output of a mixed-integer operating problem solved for each sample, so (10) constrains the outcome of a lower-level optimisation: the planning problem becomes bilevel with a mixed-integer lower level, for which we know of no compact single-level MILP reformulation. With the CHP commitment fixed, the re-dispatch of a sample is effectively a linear program; since the storage binaries are redundant at the optimum with positive throughput costs and efficiencies below one, so it could be replaced by its optimality conditions with big-M constants and a violation indicator per sample and IES [23,24]. The commitment, however, is the outcome of the mixed-integer day-ahead problem and changes with X, and such a reformulation would have at least the size of the sample average approximation (SAA) problem below (about 2.1 million constraints for 100 samples) plus the complementarity binaries; it was not attempted. The criterion is therefore not compactly expressible in the planning MILP, which is weaker than saying that it is inexpressible. A chance-constrained SAA [43], in which the planner also chooses the dispatch of every sample, can be written as an MILP, but it assumes an operator that minimises violations rather than costs; it is therefore a relaxation, which can bound the cost of meeting (10) from below but does not return a design that meets it. The operating policy re-optimises the dispatch for each sample with the CHP commitment fixed to its day-ahead schedule. For the outer search, the policy is simulated for each candidate on N = 100 in-sample error samples, independent of the 3000 out-of-sample samples used for evaluation, and the fitness (6) is penalised:
F pen X = F X + π ∑ i max 0 ,   V i X − A
where Vi is the number of in-sample samples in which IES i violates the 20% threshold, A is the allowance and π = 105 $ per violating sample in excess of it. In (11), F(X) is the fitness (6), and Vi(X) = N·pi(X) is evaluated on the N = 100 in-sample samples. Allowances of five and two samples are tested, with one search run each. The search is seeded with the exact and GWO–MILP designs and with the VoLL surrogate designs, and runs 30 + 20 iterations. The outer search is compared with three MILP surrogates, each solved as the exact planning MILP with modified data: a higher value of lost load (VoLL) of electricity of 1, 2 or 5 $/kWh; a tighter shedding cap γS1 of 0.15, 0.10, 0.05 or zero in the normal topology (4); and wider half-widths of the box set, with 0.25 and 0.15 or 0.35 and 0.20 for renewable output and demand, alone and combined with a tighter cap. The surrogates act on the MILP’s own planned operation at the box worst case, not on the policy that will actually run, so their violation probabilities are known only after the policy simulation.

3.6. Implementation and Metrics

The outer searches run in MATLAB R2022b (The MathWorks, Natick, MA, USA) with the Parallel Computing Toolbox and every evaluation in GAMS 24.1.2 (GAMS Development Corporation, Fairfax, VA, USA) with CPLEX 12.5.1 (IBM, Armonk, NY, USA); GAMS data exchange (GDX) files carry the capacities of one agent to GAMS and its operating cost and solver status back to MATLAB. The 50 evaluations of an iteration are independent and run on 10 parallel MATLAB workers, each with its own numbered model and data files. A candidate is charged the infeasibility penalty if the model status is neither optimal nor integer feasible. The exact MILP runs entirely in GAMS. All computations used the same four-core notebook (Intel Core i5-1035G4 (Intel Corporation, Santa Clara, CA, USA), 8 GB RAM), so the wall-clock times of both methods refer to the same hardware; they are only indicative (Section 5). Each run is seeded and checkpointed.
Each design is scored by its gap to the best exact solution and to the lower bound, and each run by its wall-clock time. For the comparison of the algorithms, the metrics are the best, mean and worst gap to the exact optimum after the full budget, the number of evaluations needed to come within 0.5% of it, and the time per run; the final gaps of the algorithms are compared with a Wilcoxon rank-sum test [22]. Because a non-significant test does not show equivalence, the mean gaps of GWO and PSO are also compared with two one-sided t-tests (TOST) [44] for an equivalence margin of ±0.2 percentage points. Five runs were made per algorithm and case because a run takes 0.5–7.6 h on the notebook. Section 4.4 gives the 95% confidence intervals of the mean gaps (Student’s t); they are ±0.03 to ±0.21 percentage points wide, narrower than the differences on which the conclusions rest—between the outer searches and the certified exact solutions, between the modified and the standard GWO, and between searches over 27 and over nine capacities. Differences between GWO, PSO and GSK below about 0.2 percentage points, however, cannot be resolved with five runs.

4. Results

4.1. Linear Device Models (Instance I)

Table 6 compares the best GWO–MILP designs with the exact MILP. They lie 0.06–0.30% above the best exact solutions and at most 0.36% above the lower bound; the worst of the repeated runs lies up to 0.58% above it. Over all runs, the designs lie on average 0.33%, 0.39% and 0.09% above the exact solutions in Cases 1–3 (Table 7; 95% confidence intervals of the means ±0.10, ±0.14 and ±0.06 percentage points) and at worst 0.45%, 0.53% and 0.10%, and the best designs of Table 6 cost five runs in Cases 1 and 2 and three in Case 3, i.e., 155, 490 and 1371 min. The exact MILP solves Cases 1 and 4 within 1 min and reaches certified gaps of 0.05% and 0.30% within its 1 h and 4 h limits in the harder Cases 2 and 3, whereas a GWO–MILP run takes 31–457 min. The exact MILP is therefore faster by about two orders of magnitude in Cases 1 and 4 and by a factor of 1.6–1.9 in Cases 2 and 3, where it stops at its time limit, and it certifies its result. These ratios refer to single runs on the same notebook and are indicative (see the diagnostics below). In Case 3, the GWO–MILP design is only 0.06% above the exact incumbent because the exact MILP itself stops at a gap of 0.30%; measured against the lower bound, both designs are within 0.36% of the optimum, and the exact incumbent remains the better of the two.
Across independent runs, the spread between the best and the worst design is 0.04–0.23% (Table 7), and the convergence curves of all runs approach the exact incumbent from above without reaching it within 100 iterations (Figure 2).
Figure 2. Convergence of the GWO–MILP runs of Cases 1–3 (Instance I; best run in bold, the other runs as thin coloured lines), with the incumbent (dashed) and the lower bound (dotted) of the exact MILP; in Case 1, they lie within 0.01% of each other.
Inner-solve diagnostics. To check whether the 60 s limit of the inner MILPs distorts the outer search, the first ten iterations (501 evaluations) of a Case 2 and a Case 3 run were replayed on Instance II, which has the same model size, with the solver status and wall-clock time of every evaluation logged (Table A2, Appendix C). In Case 2, no evaluation reached the limit (median 9.8 s). In Case 3, with the market, 26% of all evaluations and 31% of the feasible ones ran into it (median 26.7 s, 90th percentile 66 s), so part of the fitness values of Case 3 come from truncated inner solves, which makes F(X) noisy and slightly inflated during the search; 26% and 16% of the candidates were infeasible and penalised. The final designs are hardly affected: re-evaluating the 13 final GWO–MILP designs of Cases 1–3 of Instance II with an inner gap of 10−6 and a 1200 s limit changed their costs by at most 0.002%. The ten parallel workers, each running CPLEX with its default thread setting, oversubscribe the four cores of the notebook, which slows down the outer search; on a machine with one core per worker, the time ratios above would be smaller.
The designs differ only in quantities that depend on single capacities, because the cost surface is flat near the optimum; the CHP units of IESs 1–3 in Case 3, for instance, have 394, 69 and 306 kW with GWO–MILP and 448, 101 and 187 kW with the exact MILP. The directions of the conclusions that a planner would draw agree, but not their sizes: the market saves 5.8% with GWO–MILP and 5.6% with the exact MILP (Case 3 vs. Case 2), and planning for the contingencies lowers the expected electricity not supplied by 31% and 24% with GWO–MILP (without and with the market) and by 16% and 19% with the exact MILP. The direction of every effect is thus preserved, but effects that rest on small differences in single capacities, such as the reliability benefit of planning for outages, are not reproduced in size. Because the optimum is flat, such effects are not identifiable properties of near-optimal designs, which makes the expected electricity not supplied a weak metric for comparing them. Like all costs, it is evaluated at the box worst case of renewable output and demand, so ‘expected’ refers to the structural scenarios and day weights only.

4.2. Size-Dependent Device Data (Instance II)

With size-dependent CHP data only (Table 8), the size grid MILP comes within 0.1% of the best design found within its 60 min limit for every grid width, whereas GWO–MILP needs more than 9 h and stays 0.33% above it. This run is six times slower than the GWO–MILP runs of Section 4.4 on the same instance with the same 5000 evaluations because its inner MILP contains the SOS2 part-load curves of the CHP units, which make every evaluation slower. The best design found comes from the reduced search started from the design of the 100 kW grid; it needs 11 MILP evaluations and 15 min, i.e., 75 min including the MILP that provided its start, and improves on that start by only 0.017%, within the accuracy of the comparison. The reduced search is local: started from CHP sizes of 450, 0 and 0 kW instead, it removes the CHP unit and ends 0.17% above the best design found. None of these designs are certified, since the MILP gaps refer to the gridded problem. Starting from the GWO–MILP design of Case 3, the reduced search removes the CHP units of the community one by one and ends without cogeneration at 6700.0 k$/year, so the market saves 6.1%; with size-dependent data, cogeneration thus no longer pays in the community, although the linear cost data of Section 2.3 were chosen so that it does. This does not affect the comparison of the methods, but it shows that the CHP units installed in Section 4.1 depend on these cost data.
All designs re-evaluated with the nonlinear model. MILP gap: gap of the gridded problem at the time limit. Best design found: reduced search; no design is certified.
With four size-dependent resources, i.e., 12 of the 27 capacities nonlinear (Table 9), GWO–MILP ends 2.0% above the MILP design after 30 iterations (1500 evaluations, 113 min, against 60 min for the MILP), and 1.1% above it after polishing, which takes 0.1 min; it reaches the MILP design only when seeded with it. At 30 iterations, GWO–MILP is far from converged (cf. Figure 2), so part of its gap is due to the budget; a run of 100 iterations would have taken about 6 h and was not made. The monolithic MILP uses a 200 kW grid for the CHP and chiller sizes and SOS2 cost functions with breakpoints at 0, 50, 100, 200, 400, 800, 1600, 3200, 6400 and 10,000 kW for PV and 0, 50, 100, 200, 400, 800, 1600 and 3000 kWh for the battery; its gap of 0.35% refers to this approximation, and the reduced search was not run for this case. Separable nonlinearities such as size-dependent costs and efficiencies are therefore better handled within an MILP; in our tests, an outer search over all capacities was not competitive.
Table 9. Four size-dependent resources—CHP, PV, battery, electric chiller (Instance II, Case 2).

4.3. A Reliability Standard on the Operating Policy (Instance II)

Table 10 and Figure 3 compare the designs of the isolated IESs (Case 2) with respect to the shedding standard (10). The violation probabilities are estimated on 3000 out-of-sample samples, for which the 95% Clopper–Pearson intervals [45] are about ±1 percentage point wide. The cheapest design, the exact MILP, violates the standard in 17.5% (IES 2) and 13.0% (IES 3) of the samples; IES 1 violates at most 0.9% for all designs. Raising the value of lost load to 5 $/kWh costs 1.4% and lowers the probability of IES 2 to 11.8%, but leaves IES 3 at 11.0%, because it penalises shedding in the planned dispatch at the box worst case, not in the policy that faces the forecast errors. Tightening the shedding cap of the planning MILP acts mainly on IES 2: with γS1 = 0, i.e., no shedding in the normal topology at the box worst case, the probability of IES 2 falls to 3.6% at 1.0% higher cost, whereas that of IES 3 stays at 10.4%. Widening the box set alone shifts the violations between the IESs rather than lowering them (22.0% and 9.8% with half-widths of 0.25 and 0.15). The combination acts on both IESs: with γS1 = 0 and half-widths of 0.25 and 0.15, the probabilities are 1.7% and 5.1% at 4.4% higher cost, and with half-widths of 0.35 and 0.20, they are 0.9% and 2.6%, with upper confidence limits below 5%, at 16.5%.
Table 10. Designs of the isolated IESs and the 5% shedding standard (Instance II, Case 2; costs in k$/year).
Figure 3. Planning cost above the exact MILP design and out-of-sample violation probability of the worse IES for the isolated IESs (Instance II, Case 2; 3000 samples, 95% Clopper–Pearson intervals). The dashed line marks the 5% standard; the horizontal axis is logarithmic above 1%.
GWO–MILP with policy evaluation in the fitness reaches 7.7% and 5.9% with an allowance of five in-sample violations, at 2.0% higher cost, and 6.7% and 5.4% with an allowance of two, at 3.4%. Neither design meets the standard: all four point estimates exceed 5%, and only the interval of IES 3 for the tighter allowance (4.6–6.2%) contains it. The search also overfits its 100 in-sample samples: its designs violate the threshold in five and two of them, but in 5–8% of the out-of-sample samples, and tightening the allowance from five to two moves the out-of-sample probabilities by only 0.5–1.0 percentage points while costing 98 k$/year. This optimism bias is inherent in selecting designs on a small sample; a larger in-sample set or a stricter allowance would reduce it at a proportionally higher cost of every evaluation.
Figure 3 shows the resulting trade-off between cost and the violation probability of the worse IES. At violation probabilities of 6–8%, the outer search with policy evaluation lies on the frontier: no surrogate tested reaches this range at 2.0–3.4% higher cost, with the closest being γS1 = 0.10 with the wider box (10.3% at 0.9%). At about 5%, however, the surrogate with γS1 = 0 and the wider box is better than the tighter allowance in both IESs (1.7% and 5.1% against 6.7% and 5.4%) at 1.0 percentage point higher cost, and only a surrogate demonstrates the standard at 95% confidence, at 16.5% higher cost. The surrogates were tuned with the same policy simulation that the outer search uses; each needs one planning MILP of less than 2 min and one out-of-sample evaluation, whereas the outer search needs 2500 evaluations with 100 policy simulations each. What the criterion requires is therefore the simulation of the operating policy rather than the outer search, which is an MILP surrogate whose parameters are adjusted until the simulated policy meets the standard reaches it, whereas the outer search without policy simulation (GWO–MILP: 12.0% and 11.1%) does not.
The chance-constrained sample average approximation of Section 3.5 does not help either. The exact MILP design already keeps the shedding within 20% in all 100 in-sample samples if the dispatch of each sample is re-optimised to minimise shedding, so it is feasible for the SAA-MILP, although its cost-minimising policy violates the standard in 17.5% and 13.0% of the out-of-sample samples: physical feasibility of the samples and reliability of the operating policy are different criteria, and only the second is the standard.
Several of these designs have batteries at or near their upper bound of 3000 kWh in IES 2 (Table 10), so the isolated designs may be limited by the bounds rather than unable to reach lower probabilities; larger bounds were not tested. The P2P community (Case 3), whose policy violates the threshold in 0.03% of the samples at a cost 5.8% below the exact isolated design, changes the topology and is therefore a reference rather than a sizing alternative.

4.4. GWO, PSO and GSK at Equal Budget (Instance II)

GWO is often reported to outperform PSO in sizing studies. Because the exact optima of Cases 1 and 2 are known here (6988.6 and 7072.3 k$/year, lower bounds 6987.9 and 7071.6 k$/year), all algorithms can be scored against them rather than against each other (Table 11). The GWO values are computed from the stored run histories of the benchmark runs; their mean gaps of 0.26% and 0.30% coincide by chance with the best-run gaps on Instance I (Table 6), which we have checked against the run histories of both instances.
Table 11. GWO–MILP versus PSO–MILP, GSK–MILP, the standard GWO–MILP and the per-IES GWO–MILP at equal budget (Instance II; five runs each; gaps to the exact optimum).
Standard deviation of the final gaps: 0.09% (GWO) and 0.11% (PSO) in Case 1, 0.11% and 0.12% in Case 2; 0.17% for the standard GWO and 0.08% for GSK in Case 1; 0.02% and 0.04% for the per-IES GWO in Cases 1 and 2. Per-IES GWO–MILP: nine capacities per IES, 3 × 1680 evaluations.
At the end of the budget, the final gaps of GWO and PSO do not differ significantly (Wilcoxon rank-sum p = 0.55 in Case 1 and 0.69 in Case 2), and the TOST shows them to be equivalent within ±0.2 percentage points: the 90% confidence intervals of the difference in their mean gaps (PSO − GWO) are −0.07 to 0.17 percentage points in Case 1 and −0.11 to 0.16 in Case 2. Their mean gaps differ by 0.05 and 0.03 percentage points, less than the run-to-run spread of about 0.1 percentage point; two runs of each algorithm come within 0.25% of the optimum in Case 1, and two of GWO and one of PSO in Case 2. GSK, ran on Case 1, ends with a mean gap of 0.27% (0.20–0.35%), with all five runs within 0.5% and three within 0.25% of the optimum, and does not differ significantly from GWO (p = 0.84) or PSO (p = 1.0). The convergence curves differ in shape (Figure 4): PSO descends faster in the first 40–50 iterations, while GWO, whose steps shrink as its control parameter decreases, refines better in the last third and reaches 0.5% after a median of 3400–3550 evaluations, against 3850 for GSK and 4075–4350 for PSO. The times per run are indicative only: the GWO runs were made before the PSO and GSK runs, on the same notebook but not in an otherwise idle state, so their differences are not interpreted.
Figure 4. Median gap to the exact optimum of GWO–MILP, the standard GWO–MILP, PSO–MILP and GSK–MILP by iteration (50 MILP evaluations each) for Cases 1 and 2 (Instance II; the standard GWO and GSK on Case 1 only); thin dotted and dashed lines show the best and worst runs, and the dash-dotted line marks a gap of 0.5%. The means are given in Table 11.
The two modifications of Section 3.2 matter. The standard GWO, with a(l) decreasing linearly from two to zero and without the mutation, was run five times on Case 1 with the same seeds, initialisation and budget (Table 11). Its final gaps are 0.41–0.84% (mean 0.65%), against 0.13–0.35% (mean 0.26%) for the modified GWO; the modified variant ends lower in each of the five pairs of runs with equal seeds (rank-sum p = 0.008), and all five of its runs come within 0.5% of the optimum, against one of the standard GWO. The median curves of the two variants coincide for the first 30–40 iterations; afterwards, as its steps shrink towards zero, the standard GWO slows down and its median gap is still 1.0% after 80 iterations, when that of the modified variant is 0.4%. The modifications thus bring GWO to the level of the standard PSO, which reaches a mean gap of 0.31% without tuning; none of the algorithms, however, certifies its design, and all end above the optimum.
GWO has been shown to be biassed towards the origin of the search space, so that it performs well on test functions whose optimum lies at zero [46]. Many optimal capacities are zero here, which could favour GWO; however, the initialisation favours the upper half of the ranges, the 50 kW threshold that sets small capacities to zero applies to all algorithms alike, and PSO and GSK reach the same gaps, so such a bias does not appear to drive the comparison.
Exploiting the separability of the isolated IESs helps the outer search considerably (Table 11). The per-IES GWO–MILP ends 0.05–0.12% above the optimum in Case 1 and 0.04–0.13% in Case 2 (mean 0.09% in both), which is about a third of the gaps of GWO–MILP over all 27 capacities (rank-sum p = 0.008 in both cases), and reaches 0.5% after a median of 2250 and 2160 evaluations. A run takes 29 min in Case 1, against 3.7 min for the exact MILP of Instance II, and 54 min in Case 2, against 130 min for the exact MILP to certify a gap of 0.01%. In Case 2, the per-IES search thus finishes earlier than the exact MILP on this machine, although none of its runs reaches the optimum or certifies its design, and the exact MILP was not decomposed by IES. Part of the disadvantage of the outer search in Cases 1 and 2 is therefore due to the dimension of the search rather than to the outer search as such.

5. Discussion

Why the exact route wins. The only nonlinearities of the planning problem with linear device models are products of a capacity and a binary status, which the McCormick envelope linearises exactly, and the size-dependent data are separable functions of single capacities, which size grids and SOS2 functions represent inside the MILP. In both situations the branch-and-bound solver exploits the structure of the problem—the coupling of the 27 capacities through shared balances and limits—that the outer search sees only through 5000 point evaluations. A metaheuristic run then costs as much as, or more than, the exact MILP, finds a design within a few tenths of a percent of the optimum, and cannot say how close it is. For a problem that is already an MILP, this is expected, and the benchmark quantifies it. In Cases 1 and 2, the isolated IESs are separable; an outer search that exploits this comes within 0.13% of the optimum and, in Case 2, finishes faster than the exact MILP, but it still does not certify its designs (Section 4.4).
Whether the outer search is needed. A criterion on the behaviour of an operating policy, such as the shedding standard of Section 4.3, is the output of a simulation with a mixed-integer lower level and is not compactly expressible in the planning MILP; a chance-constrained approximation can only bound its cost from below (Section 3.5). This is the case usually made for an outer search, and it holds only in part. The criterion needs the simulation of the operating policy, which the outer search provides in its fitness, but an MILP surrogate whose shedding cap and uncertainty set are adjusted with the same simulation reaches the standard as well, at a higher cost than the outer search at violation probabilities of 6–8% and at a lower one at about 5% (Figure 3). None of the isolated designs tested demonstrates the standard at 95% confidence below 16.5% higher cost, and the outer search overfits its in-sample samples. For the IESs considered here, the policy simulation is therefore indispensable and the outer search is not; it may still pay off where no MILP parameter acts on the criterion, for instance, for detailed device simulators or operating rules that are not optimisation-based, but this was not tested. The P2P community, whose policy violates the threshold in 0.03% of the samples, shows that the topology can matter more than the sizing method.
Effect of problem size. The size of the planning MILP grows linearly with the number of IESs, structural scenarios, representative days and time steps per day, and so does the number of operating binaries, whereas the solution time of branch and bound grows faster and less predictably. Larger networks, longer horizons and finer time steps, therefore, affect the exact route first, but they affect the outer search as well: every one of its evaluations solves an inner MILP of the full operating size, and a population-based search over more capacities needs more evaluations to reach the same gap, so its cost grows at least as fast as that of the exact MILP. For the present community, doubling the number of IESs to six (54 capacities, nine structural scenarios) still leaves the monolithic MILP within 0.04% of the optimum after 1 h. Where the monolithic MILP no longer reaches a small gap, for instance, for many IESs or a full year of hourly or sub-hourly operation, the natural next step is to decompose it rather than to replace it, by scenario, by period or between investment and operation where the second stage is convex [38], so that a bound is retained. An outer search remains appropriate for the few variables or criteria that the MILP cannot represent (Section 3.4), and its cost should be weighed against the time of one inner MILP evaluation, which grows with the operating horizon. Table 12 summarises the recommendations.
Table 12. Recommended planning method by situation.
Table A3 (Appendix D) collects the evidence on problem size. For the exact MILP, doubling the number of IESs from three to six, with nine instead of six structural scenarios, multiplies the binary variables by 3.0 (3915 to 11,718) and the equations by 3.9 (117,026 to 455,774); with the market, the solution time grows from 0.1 to 0.8 min, whereas for the isolated IESs it grows from 3.3 min to the 1 h limit, at a certified gap of 0.04%. For the outer search, the effect of the dimension is seen within one instance: searching nine instead of 27 capacities lowers the evaluations needed to come within 0.5% of the optimum from 3400–3550 to 2160–2250 and the mean gap from 0.26–0.30% to 0.09%, while the time per evaluation is set by the size of the inner MILP, which grows with the number of IESs and scenarios (29 and 54 min per run of the per-IES search with one and six scenarios). An outer search over 54 capacities was not run; by these trends, it would need more evaluations, each about as large as the operating MILP of six IESs, so its run time would grow at least as fast as that of the exact MILP. On this hardware, the monolithic exact MILP thus reaches its practical limit at about six isolated IESs with nine scenarios and three representative days, whereas the outer search already needs 0.5–7.6 h per run for three IESs.
Implications for the literature. Studies that size IESs with a metaheuristic should report the gap of their designs to an exact bound whenever one can be computed, for instance, for the linear core of their model, and compare algorithms against that bound rather than against each other. On the present problem, the choice of metaheuristic matters less than this benchmark: GWO, PSO and GSK end equally far, 0.1–0.5%, above the optimum, consistent with analyses showing that GWO shares its core mechanisms with established swarm methods [19,20,21] and with the no-free-lunch theorem [18]. Their tuning matters as much as the choice between them: without its two modifications, GWO ends 0.4–0.8% above the optimum (Section 4.4). The directions of the conclusions a planner draws are robust to such gaps, but effects that rest on small differences in single capacities, such as the reliability value of planning for outages in Section 4.1, are not.
Limitations. The benchmark uses one community of three IESs with three representative days, and two data instances; larger problems, for which the exact MILP may not reach small gaps, could shift the balance towards decomposition or hybrid methods (see Effect of problem size), although for the published technology, it costs the exact MILP of a six-IES community (54 capacities, nine structural scenarios), which still certifies a gap of 0.04% within 1 h for the isolated IESs and solves the community with the market in under 1 min. Where the exact MILP does reach its limits, the hybrids of Section 3.4 suggest that the outer search should be restricted to the few variables that the MILP cannot handle. Five runs per algorithm give limited statistical power, the wall-clock times were measured on a notebook and are indicative, and the reliability standard was tested for the isolated IESs only and with 100 in-sample samples. Several comparisons are not fully matched: the per-IES search was tested with GWO only, and the exact MILP was not decomposed by IES; the GWO–MILP run of Table 9 had 30 iterations only; the reduced search was not run for the four-resource case; and GSK was run on Case 1 only. That standard was moreover tested with one criterion, one instance and one search run per allowance, and the surrogates were tuned on the same policy simulation, so these results are indicative. Matheuristics such as fix-and-relax, decomposition methods and a reformulation of the policy criterion through optimality conditions were not tested. Only three metaheuristics were tested; other derivative-free methods, such as differential evolution, CMA-ES or surrogate-based optimisation, may need fewer evaluations, but they would not provide a bound either. Finally, CPLEX 12.5.1 is an older release; current MILP solvers are generally faster, and since both methods spend almost all their time in the same solver, a newer release would speed up both, but not necessarily in the same proportion, so the time ratios could change in either direction; no current release was available to us.

6. Conclusions

This paper benchmarked a GWO–MILP outer search and its PSO–MILP and GSK–MILP counterparts against the exact MILP of the same IES planning problem and its lower bound, for a community of three IESs under six structural contingency scenarios. The answer to the title question is rarely. The main findings are the following.
(1)
Linear device models. GWO–MILP runs end on average 0.09–0.39% and at worst 0.53% above the exact solutions, with 95% confidence intervals of the mean gaps within ±0.14 percentage points, and they reproduce the direction, but not the size, of the planning effects. The exact MILP solves the easy cases within a minute and certifies gaps of 0.01–0.30% in the hard ones, which is 1.6 to about 100 times faster on the same machine.
(2)
Separability. Where the IESs are not coupled, searching each IES separately reduces the gaps of the outer search to 0.04–0.13% and, with six scenarios, finishes before the exact MILP, but still without a certificate; part of the disadvantage of the outer search is therefore due to its dimension.
(3)
Size-dependent data. An MILP with size grids and SOS2 costs comes within 0.1% of the best design found in 60 min, whereas GWO–MILP ends 0.3% above it after 5000 evaluations and 2.0% after 1500; a reduced search over the CHP sizes finds the best design, but it is local and needs a good start.
(4)
Reliability of the operating policy. For a standard on the shedding probability of the cost-minimising policy, the decisive ingredient is the simulation of the policy, not the search: the outer search with simulated policy reaches violation probabilities of 6–8% at 2.0–3.4% higher cost and overfits its in-sample samples, an MILP surrogate tuned by the same simulation reaches about 5% at 4.4% and demonstrates the standard at 16.5%, and a higher value of lost load barely helps. The P2P community keeps the violations at 0.03%.
(5)
Choice of algorithm. At equal budget, the modified GWO, the standard PSO and GSK end within 0.2 percentage points of each other, whereas the standard GWO ends 0.4–0.8% above the optimum: tuning matters as much as the choice of metaheuristic, and neither matters as much as the benchmark against an exact bound.
(6)
Problem size. The exact MILP of six isolated IESs with nine scenarios still reaches a certified gap of 0.04% in 1 h, whereas the cost of the outer search grows with the size of its inner MILP and with the number of capacities.
For practitioners, this suggests formulating the planning problem as an MILP wherever the device models permit, with size grids for separable nonlinearities; exploiting separability and decomposition before turning to a metaheuristic; reserving an outer search for criteria that no MILP parameter can reach, always combined with policy simulation and out-of-sample evaluation; and reporting the gap of every design to an exact bound. Future work should test decomposition methods and reformulations of policy criteria through optimality conditions on larger communities and longer horizons, more runs and further metaheuristics, and current MILP solvers.

Author Contributions

Conceptualization, S.H. and J.F.M.; methodology, S.H. and J.F.M.; software, S.H.; validation, S.H.; formal analysis, S.H.; investigation, S.H.; data curation, S.H.; visualisation, S.H.; writing—original draft preparation, S.H.; writing—review and editing, J.F.M.; supervision, J.F.M. All authors have read and agreed to the published version of the manuscript.

Funding

This research was partially funded by Fundação para a Ciência e a Tecnologia (FCT), Portugal, grant number UID/00066/2025 (Centre of Technology and Systems—CTS).

Institutional Review Board Statement

Not applicable.

Data Availability Statement

The hourly demand profiles and renewable capacity factors of both benchmark instances were digitised from Figures C.1 and C.2 of the supplementary material of [28]. Restrictions apply to the availability of these third-party data; the digitised data are available from the corresponding author on reasonable request. All other data are given in Section 2 and Table 1, Table 2, Table 3, Table 4 and Table 5. The MATLAB and GAMS code is available from the corresponding author on reasonable request.

Acknowledgments

This work is part of the Ph.D. thesis of S. Hosseinpour, “Coordinated Planning and Operation of Interconnected Integrated Energy Systems Considering Uncertainty and Peer-to-Peer Market”, in the Ph.D. Programme in Electrical and Computer Engineering at NOVA School of Science and Technology, supervised by J. F. Martins. During the preparation of this manuscript, the authors used Claude (Anthropic; models available October–November 2026, accessed via claude.ai) to improve the language and readability of the text, to condense material from the first author’s doctoral thesis into the manuscript and to check the consistency of the reported numbers. All numbers in the manuscript were verified by the authors against the run logs. The authors have reviewed and edited the output and take full responsibility for the content of this publication.

Conflicts of Interest

The authors declare no conflicts of interest. The funders had no role in the design of the study; in the collection, analyses, or interpretation of data; in the writing of the manuscript; or in the decision to publish the results.

Abbreviations

The following abbreviations and symbols are used in this manuscript:
ACH, ECHAbsorption and electric chiller
CHPCombined heat and power unit
EB, GBElectric and gas boiler
ESS, TSBattery and thermal storage
GSKGaining–sharing knowledge-based algorithm
GWO, PSOGrey Wolf Optimizer, particle swarm optimisation
IESIntegrated energy system
MILPMixed-integer linear program
P2PPeer-to-peer
PV, WTPhotovoltaic unit, wind turbine
SAA, TOSTSample average approximation, two one-sided tests
SOS2Special ordered set of type 2
VoLLValue of lost load
A, πAllowance of in-sample violations and penalty per violating sample in (11)
CRFrCapital recovery factor of resource r
Dz, ωsWeight of representative day z, probability of structural scenario s
ItmaxNumber of iterations of the outer search
MBig-M constant of the CHP region and storage constraints (Appendix A)
NNumber of in-sample forecast-error samples
uCHPBinary on/off status of the CHP unit
ViNumber of in-sample samples in which IES i violates the 20% threshold
X, Xi,rVector of capacities, capacity of resource r in IES i
γsShedding limit in scenario s, share of the demand (4)
κGi,s, κPij,sBinary parameters of the grid and peer connections in scenario s

Appendix A. Operating Constraints of the Planning Problem

This appendix gives the main operating constraints of Section 2.2. The indices t, z, i and s are omitted where they are clear; all constraints hold for every hour, representative day, IES and structural scenario. The hourly operating cost in (3) is the sum of the cost of grid electricity and gas net of grid sales, the O&M cost, which is charged on throughput for storage, the emission cost at the carbon price of Table 4, the cost of shedding each carrier and the transaction charge on every traded kWh; the payments between IESs cancel over the community and therefore do not appear in (3). The gas intake of the CHP unit follows from its condensing efficiency of 0.45 and power-loss ratio of 0.156 [31], and that of the gas boiler from its efficiency.

Appendix A.1. CHP Unit

The CHP unit operates within a polygon with corner points A–D in the plane of electrical and thermal output [31]; the binary uCHP indicates whether the unit is on, and M = 106 is a big-M constant (Section 3.1):
P CHP ≤ P A + P A − P B H A − H B   H CHP − H A
P CHP ≥ P B + P B − P C H B − H C   H CHP − H B − M 1 − u CHP
P CHP ≥ P C + P C − P D H C − H D   H CHP − H C − M 1 − u CHP
0 ≤ H CHP ≤ H B   u CHP ,     P C   u CHP ≤ P CHP ≤ P A   u CHP
Because the capacity is a planning variable, the corner points scale with it:
P A = X CHP ,   P B = X CHP / 1.15 ,   P C = 0.375   X CHP ,   P D = 0.45   X CHP ,   H A = H D = 0 ,   H B = 0.835   X CHP ,   H C = 0.095   X CHP
The products XCHP · uCHP in (A4) are the bilinear terms linearised exactly by (5).

Appendix A.2. Conversion Units and Storage

The boilers and chillers convert energy at constant efficiencies and coefficients of performance (0.95 for the electric boiler, four for the electric chiller and 1.2 for the absorption chiller) within their installed capacities.
The state of charge of the battery returns to 50% at the end of every representative day in every scenario:
E t = E t − 1 + η ch P t ch − P t dch / η dch ,     E 0 = E 24 = 0.5   X ESS
The state of charge stays between 10% and 100% of the capacity, charging and discharging are each limited to half the capacity, and a binary variable excludes simultaneous charging and discharging. Thermal storage is modelled in the same way, with its own efficiencies, charging and discharging powers and binary.

Appendix A.3. Grid, Gas and P2P Exchange

Under the normal topology, every IES may buy at most 1500 kW from the grid, sell at most 500 kW to it and draw at most 1000 kW of gas (Section 2.1). A purchase of IES i from IES j matches a sale of IES j to IES i, and every bilateral exchange is bounded:
P ij pb = P ji ps ,     0 ≤ P ij pb ≤ P p , max ,     0 ≤ P ij ps ≤ P p , max
Likewise for heat (H) and cooling (Q), there are limits of 500 kW per carrier when a market is allowed and zero otherwise. In the structural scenarios of Table 1, the binary parameters κGi,s and κPij,s indicate whether IES i can exchange electricity with the grid and with IES j, and multiply the corresponding electrical limits.

Appendix A.4. Energy Balances

Load shedding is bounded by (4). Electricity, heat and cooling are balanced every hour; the electrical balance is an inequality, so surplus renewable power can be curtailed:
P b − P s + P CHP + P dch − P ch + ∑ j ≠ i P ij pb − P ij ps − P EB − P ECH + P IL ≥ P L − P RE
H CHP + H GB + H EB − H ACH + H dch − H ch + ∑ j ≠ i H ij pb − H ij ps = H L − H IL
Q ECH + Q ACH + ∑ j ≠ i Q ij pb − Q ij ps = Q L − Q IL
Here, the renewable output is the installed PV and WT capacity times the normalised profiles, and the expected electricity not supplied reported in Section 4.1 is the shed electrical energy weighted by the scenario probabilities and the day weights.

Appendix B. Summary of the Benchmark Instances

Table A1. Summary of the two benchmark instances.

Appendix C. Diagnostics of the Inner MILP Solves

The first ten iterations (501 evaluations) of the first GWO–MILP run of Case 2 and of Case 3 on Instance II, which has the same model size as Instance I, were replayed with the same seeds, budget and parallel scheme, and the CPLEX model status and wall-clock time of every inner MILP were logged (Table A2).
Table A2. Inner MILP solves in the first ten iterations of GWO–MILP (Instance II).

Appendix D. Effect of Problem Size

Table A3. Problem size, exact MILP and outer search for different numbers of IESs and structural scenarios.

References

  1. Mancarella, P. MES (multi-energy systems): An overview of concepts and evaluation models. Energy 2014, 65, 1–17. [Google Scholar] [CrossRef] [Scilit]
  2. Geidl, M.; Koeppel, G.; Favre-Perrod, P.; Klöckl, B.; Andersson, G.; Fröhlich, K. Energy hubs for the future. IEEE Power Energy Mag. 2007, 5, 24–30. [Google Scholar] [CrossRef] [Scilit]
  3. Gabrielli, P.; Gazzani, M.; Martelli, E.; Mazzotti, M. Optimal design of multi-energy systems with seasonal storage. Appl. Energy 2018, 219, 408–424, Correction in Appl. Energy 2018, 212, 720.. [Google Scholar] [CrossRef] [Scilit]
  4. Mavromatidis, G.; Orehounig, K.; Carmeliet, J. Design of distributed energy systems under uncertainty: A two-stage stochastic programming approach. Appl. Energy 2018, 222, 932–950. [Google Scholar] [CrossRef] [Scilit]
  5. Elsido, C.; Bischi, A.; Silva, P.; Martelli, E. Two-stage MINLP algorithm for the optimal synthesis and design of networks of CHP units. Energy 2017, 121, 403–426. [Google Scholar] [CrossRef] [Scilit]
  6. Fathima, A.H.; Palanisamy, K. Optimization in microgrids with hybrid energy systems—A review. Renew. Sustain. Energy Rev. 2015, 45, 431–446. [Google Scholar] [CrossRef] [Scilit]
  7. Sharafi, M.; ElMekkawy, T.Y. Multi-objective optimal design of hybrid renewable energy systems using PSO-simulation based approach. Renew. Energy 2014, 68, 67–79. [Google Scholar] [CrossRef] [Scilit]
  8. Zhu, W.; Guo, J.; Zhao, G.; Zeng, B. Optimal sizing of an island hybrid microgrid based on improved multi-objective grey wolf optimizer. Processes 2020, 8, 1581. [Google Scholar] [CrossRef] [Scilit]
  9. Aeggegn, D.B.; Nyakoe, G.N.; Wekesa, C. Optimal sizing of grid connected multi-microgrid system using grey wolf optimization. Results Eng. 2024, 23, 102421. [Google Scholar] [CrossRef] [Scilit]
  10. Xue, Y.; Zhang, C.; Jiang, F.; Dou, W.; Zhang, H.; Yang, C. Optimal capacity allocation method of integrated energy system considering renewable energy uncertainty. Front. Energy Res. 2022, 10, 1016756. [Google Scholar] [CrossRef] [Scilit]
  11. Lyu, C.; Zhang, Y.; Bai, Y.; Yang, K.; Song, Z.; Ma, Y.; Meng, J. Inner-outer layer co-optimization of sizing and energy management for renewable energy microgrid with storage. Appl. Energy 2024, 363, 123066. [Google Scholar] [CrossRef] [Scilit]
  12. Ren, X.-Y.; Li, L.-L.; Ji, B.-X.; Liu, J.-Q. Design and analysis of solar hybrid combined cooling, heating and power system: A bi-level optimization model. Energy 2024, 292, 130362. [Google Scholar] [CrossRef] [Scilit]
  13. Wang, Y.; Guo, L.; Wang, Y.; Zhang, Y.; Zhang, S.; Liu, Z.; Xing, J.; Liu, X. Bi-level programming optimization method of rural integrated energy system based on coupling coordination degree of energy equipment. Energy 2024, 298, 131289. [Google Scholar] [CrossRef] [Scilit]
  14. Rowe, K.; Cooke, K.; Mokryani, G.; Campean, F.; Chambers, T. A bi-level multi-node optimal siting, sizing, and operation of multi energy system in an integrated energy network of electricity-gas-heat with peer-to-peer trading. Appl. Energy 2025, 382, 125256. [Google Scholar] [CrossRef] [Scilit]
  15. Hosseinpour, S.; Martins, J. Optimal load shedding for smart power grid resilience enhancement considering cyber-physical constraints. In Technological Innovation for Connected Cyber Physical Spaces (DoCEIS 2023); Camarinha-Matos, L.M., Ferrada, F., Eds.; IFIP Advances in Information and Communication Technology; Springer: Cham, Switzerland, 2023; Volume 678, pp. 67–81. [Google Scholar] [CrossRef] [Scilit]
  16. Ikeda, S.; Ooka, R. Metaheuristic optimization methods for a comprehensive operating schedule of battery, thermal energy storage, and heat source in a building energy system. Appl. Energy 2015, 151, 192–205. [Google Scholar] [CrossRef] [Scilit]
  17. Pickering, B.; Ikeda, S.; Choudhary, R.; Ooka, R. Comparison of metaheuristic and linear programming models for the purpose of optimising building energy supply operation schedule. In CLIMA 2016—Proceedings of the 12th REHVA World Congress; Heiselberg, P.K., Ed.; Aalborg University: Aalborg, Denmark, 2016; Volume 6; Available online: http://vbn.aau.dk/files/233775414/paper_529.pdf (accessed on 30 November 2026).
  18. Wolpert, D.H.; Macready, W.G. No free lunch theorems for optimization. IEEE Trans. Evol. Comput. 1997, 1, 67–82. [Google Scholar] [CrossRef] [Scilit]
  19. Sörensen, K. Metaheuristics—The metaphor exposed. Int. Trans. Oper. Res. 2015, 22, 3–18. [Google Scholar] [CrossRef] [Scilit]
  20. Camacho-Villalón, C.L.; Dorigo, M.; Stützle, T. Grey wolf, firefly and bat algorithms: Three widespread algorithms that do not contain any novelty. In Swarm Intelligence (ANTS 2020); Lecture Notes in Computer Science; Springer: Cham, Switzerland, 2020; Volume 12421, pp. 121–133. [Google Scholar] [CrossRef] [Scilit]
  21. Aranha, C.; Camacho Villalón, C.L.; Campelo, F.; Dorigo, M.; Ruiz, R.; Sevaux, M.; Sörensen, K.; Stützle, T. Metaphor-based metaheuristics, a call for action: The elephant in the room. Swarm Intell. 2022, 16, 1–6. [Google Scholar] [CrossRef] [Scilit]
  22. Derrac, J.; García, S.; Molina, D.; Herrera, F. A practical tutorial on the use of nonparametric statistical tests as a methodology for comparing evolutionary and swarm intelligence algorithms. Swarm Evol. Comput. 2011, 1, 3–18. [Google Scholar] [CrossRef] [Scilit]
  23. Pineda, S.; Morales, J.M. Solving linear bilevel problems using big-Ms: Not all that glitters is gold. IEEE Trans. Power Syst. 2019, 34, 2469–2471. [Google Scholar] [CrossRef] [Scilit]
  24. Kleinert, T.; Labbé, M.; Ljubić, I.; Schmidt, M. A survey on mixed-integer programming techniques in bilevel optimization. EURO J. Comput. Optim. 2021, 9, 100007. [Google Scholar] [CrossRef] [Scilit]
  25. Zeng, B.; Zhao, L. Solving two-stage robust optimization problems using a column-and-constraint generation method. Oper. Res. Lett. 2013, 41, 457–461. [Google Scholar] [CrossRef] [Scilit]
  26. Maniezzo, V.; Stützle, T.; Voß, S. (Eds.) Matheuristics: Hybridizing Metaheuristics and Mathematical Programming; Annals of Information Systems; Springer: New York, NY, USA, 2009; Volume 10. [Google Scholar]
  27. Danna, E.; Rothberg, E.; Le Pape, C. Exploring relaxation induced neighborhoods to improve MIP solutions. Math. Program. 2005, 102, 71–90. [Google Scholar] [CrossRef] [Scilit]
  28. Tang, B.-J.; Cao, X.-L.; Li, R.; Xiang, Z.-B.; Zhang, S. Economic and low-carbon planning for interconnected integrated energy systems considering emerging technologies and future development trends. Energy 2024, 302, 131850. [Google Scholar] [CrossRef] [Scilit]
  29. Mohamed, A.W.; Hadi, A.A.; Mohamed, A.K. Gaining-sharing knowledge based algorithm for solving optimization problems: A novel nature-inspired algorithm. Int. J. Mach. Learn. Cybern. 2020, 11, 1501–1529. [Google Scholar] [CrossRef] [Scilit]
  30. Mohamed, A.W.; Hadi, A.A.; Agrawal, P.; Sallam, K.M.; Mohamed, A.K. Gaining-sharing knowledge based algorithm with adaptive parameters hybrid with IMODE algorithm for solving CEC 2021 benchmark problems. In Proceedings of the 2021 IEEE Congress on Evolutionary Computation (CEC), Kraków, Poland, 28 June–1 July 2021; pp. 841–848. [Google Scholar] [CrossRef] [Scilit]
  31. Danish Energy Agency; Energinet. Technology Data—Generation of Electricity and District Heating; Danish Energy Agency: Copenhagen, Denmark, 2016; Available online: https://ens.dk/en/analyses-and-statistics/technology-data-generation-electricity-and-district-heating (accessed on 30 November 2026).
  32. Ben-Tal, A.; Nemirovski, A. Robust solutions of linear programming problems contaminated with uncertain data. Math. Program. 2000, 88, 411–424. [Google Scholar] [CrossRef] [Scilit]
  33. U.S. Environmental Protection Agency. Combined Heat and Power Partnership, Catalog of CHP Technologies, Full Report; U.S. Environmental Protection Agency: Washington, DC, USA, 2017. Available online: https://www.epa.gov/sites/default/files/2015-07/documents/catalog_of_chp_technologies.pdf (accessed on 30 November 2026).
  34. Ramasamy, V.; Zuboy, J.; Woodhouse, M.; O’Shaughnessy, E.; Feldman, D.; Desai, J.; Walker, A.; Margolis, R.; Basore, P. U.S. Solar Photovoltaic System and Energy Storage Cost Benchmarks, With Minimum Sustainable Price Analysis: Q1 2023; NREL/TP-7A40-87303; National Renewable Energy Laboratory: Golden, CO, USA, 2023. Available online: https://www.osti.gov/biblio/2005540 (accessed on 30 November 2026).
  35. ANSI/ASHRAE/IES Standard 90.1-2019; Energy Standard for Buildings Except Low-Rise Residential Buildings. ASHRAE: Atlanta, GA, USA, 2019. Available online: https://www.ashrae.org/technical-resources/bookstore/standard-90-1 (accessed on 30 November 2026).
  36. McCormick, G.P. Computability of global solutions to factorable nonconvex programs: Part I—Convex underestimating problems. Math. Program. 1976, 10, 147–175. [Google Scholar] [CrossRef] [Scilit]
  37. Beale, E.M.L.; Tomlin, J.A. Special facilities in a general mathematical programming system for non-convex problems using ordered sets of variables. In Proceedings of the Fifth International Conference on Operational Research; Lawrence, J., Ed.; Tavistock Publications: London, UK, 1970; pp. 447–454. [Google Scholar]
  38. Geoffrion, A.M. Generalized Benders decomposition. J. Optim. Theory Appl. 1972, 10, 237–260. [Google Scholar] [CrossRef] [Scilit]
  39. Laporte, G.; Louveaux, F.V. The integer L-shaped method for stochastic integer programs with complete recourse. Oper. Res. Lett. 1993, 13, 133–142. [Google Scholar] [CrossRef] [Scilit]
  40. Mirjalili, S.; Mirjalili, S.M.; Lewis, A. Grey wolf optimizer. Adv. Eng. Softw. 2014, 69, 46–61. [Google Scholar] [CrossRef] [Scilit]
  41. Kennedy, J.; Eberhart, R. Particle swarm optimization. In Proceedings of the ICNN’95—International Conference on Neural Networks, Perth, WA, Australia, 27 November–1 December 1995; pp. 1942–1948. [Google Scholar] [CrossRef] [Scilit]
  42. Shi, Y.; Eberhart, R. A modified particle swarm optimizer. In Proceedings of the 1998 IEEE International Conference on Evolutionary Computation Proceedings, Anchorage, AK, USA, 4–9 May 1998; pp. 69–73. [Google Scholar] [CrossRef] [Scilit]
  43. Luedtke, J.; Ahmed, S. A sample approximation approach for optimization with probabilistic constraints. SIAM J. Optim. 2008, 19, 674–699. [Google Scholar] [CrossRef] [Scilit]
  44. Schuirmann, D.J. A comparison of the two one-sided tests procedure and the power approach for assessing the equivalence of average bioavailability. J. Pharmacokinet. Biopharm. 1987, 15, 657–680. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  45. Clopper, C.J.; Pearson, E.S. The use of confidence or fiducial limits illustrated in the case of the binomial. Biometrika 1934, 26, 404–413. [Google Scholar] [CrossRef] [Scilit]
  46. Niu, P.; Niu, S.; Liu, N.; Chang, L. The defect of the Grey Wolf optimization algorithm and its verification method. Knowl.-Based Syst. 2019, 171, 37–43. [Google Scholar] [CrossRef] [Scilit]
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Article Metrics

Citations

Article Access Statistics

Article metric data becomes available approximately 24 hours after publication online.