# Capacity-Operation Collaborative Optimization for Wind-Solar-Hydrogen Multi-Energy Supply System
## 3 Bi-Level Capacity-Operation Collaborative Optimization Method
### Solving Algorithm  
In this research, a composite algorithm is presented, integrating both NSGA-II and LP methodologies, fortified with an elite strategy. This approach targets the bi-level capacity-operation collaborative optimization framework. The NSGA-II technique is designated for the primary multi-objective capacity arrangement optimization, while the LP approach focuses on the subsequent operation scheduling optimization. The workings of this bi-level optimization approach are graphically depicted in Figure 3. The methodology to navigate through this bi-level optimization framework is as follows:  
Step 1: Set the operational parameters for the NSGA-II algorithm. This includes determining the population size, denoted as N, and the ceiling for iterations, termed \(\text{Gen}_{\text{max}}\). In the context of this research, values of 300 for N and 80 for \(\text{Gen}_{\text{max}}\) were chosen to ensure a balance between the speed of convergence and the efficacy of the algorithm.  
Step 2: Commence with an initial population setting of \(\text{Gen}=1\). Based on the site-specific conditions (referenced in Table 4), the optimization boundaries for the primary decision variables are set. These variables encompass loop count or SF size (\(x_{1}\)), CSP capacity (\(x_{2}\)), TES capacity (\(x_{3}\)), PV capacity (\(x_{4}\)), WT count or WF capacity (\(x_{5}\)), PEM capacity (\(x_{6}\)), HST capacity (\(x_{7}\)), and PEMFC capacity (\(x_{8}\)); N integer arrays \(R_{i}\) (\([x_{i,1}\), \(x_{i,2}\), \(x_{i,3}\), \(x_{i,4}\), \(x_{i,5}\), \(x_{i,6}\), \(x_{i,7}\), \(x_{i,8}\)) (with \(i\) ranging from 1 to N) are randomly selected to form the foundational population for the NSGA-II algorithm.  
Step 3: Integrate the capacity distribution parameters \(R_{i}\) derived from the population into the secondary optimization model. The application of the linear programming methodology becomes pivotal in addressing this secondary model, seamlessly merging time-sequenced meteorological data with load and wind energy statistical insights.  
Step 4: The computation shifts towards determining both the LCOE and CO2 emissions for each individual within the population. This involves the utilization of Equations (3) and (4). Subsequently, non-dominance ranking and crowding computations are executed, harnessing the computed outcomes to establish rank values and crowding extents for every member.  
Step 5: The current population count is scrutinized. Should this count align with N, the progression moves to Step 6. However, in case of a mismatch, the advancement transitions to Step 7.  
Step 6: Generate an offspring population half the size of N. This population size is halved from N and is realized through a combination of selection processes, crossover, and mutation techniques. The amalgamation of this offspring cohort with the original population gives rise to a merged assembly, boasting a total size of 1.5 N. At this point, the loop is directed back to Step 3.  
Step 7: N members are meticulously chosen based on their ranking and crowding metrics. These selected individuals lay the foundation for the forthcoming generation. An important conditional assessment takes place: if the generation count (Gen) surpasses a predefined threshold (Genmax), the optimization procedure draws to a close, culminating in the display of the Pareto front. Alternatively, if Gen remains within the prescribed limit, its value is incremented by one, and the cycle reverts back to Step 6.