# Low-Carbon Operation Strategy of Park-Level Integrated Energy System with Firefly Algorithm
## 4 Operational Strategy Optimization Model
### Optimization Method  
The firefly algorithm (FA) is a stochastic optimization algorithm based on swarm intelligence derived from the study of the mating behavior of fireflies in nature. In this algorithm, each individual is treated as a particle within the search space. Particle movement in the search space is guided by the emitted light intensity and light absorption coefficient of neighboring particles. The movement of a particle is directed towards positions with higher fluorescence values, where fluorescence corresponds to the fitness function value. Therefore, individuals navigate the dynamic decision space by seeking positions with the highest fluorescence values to determine the optimal value of the fitness function. Evidently, the FA comprises two key elements: luminosity and attractiveness. Luminosity reflects the quality of the firefly's current position and determines its movement direction, while attractiveness governs the distance the firefly will move. Through the continuous updating of luminosity and attractiveness, the algorithm achieves goal optimization. The relative brightness of a firefly is expressed as:  
\[I=I_{0}\times e^{-\gamma\tau_{ij}} \tag{25}\]  
In this equation, \(I_{0}\) represents the maximum self-luminosity of fireflies at the center (\(r=0\)), which is associated with the objective function value. The higher the objective function value, the greater the self-luminosity. \(\Gamma\) denotes the light intensity absorption coefficient and may be treated as a constant. \(R_{ij}\) stands for the spatial distance between firefly \(I\) and \(j\). When solving discrete problems, the distance can be defined based on the actual situation using the following expression:  
\[\beta=\beta_{0}\times e^{-\gamma\tau_{ij}}=\left\|x_{i}-x_{j}\right\|=\sqrt{ \sum_{k=1}^{d}\left(x_{i,k}-x_{j,k}\right)} \tag{26}\]  
In this equation, \(d\) denotes the spatial dimension and \(x_{i,k}\) represents the \(k^{\text{th}}\) component of firefly \(I\) in a \(d\)-dimensional space. Firefly attractiveness can be expressed by the following equation:  
\[\beta=\beta_{0}\times e^{-\gamma\tau_{ij}^{2}} \tag{27}\]  
In this equation, \(\beta_{0}\) represents the maximum attractiveness, which is the attractiveness at the light source location (\(r=0\)); due to the gradual attenuation of fluorescence with increasing distance and absorption by the propagation medium, an optical intensity absorption coefficient is introduced to capture this characteristic, and it can be set as a constant. The position update of firefly \(I\) movement towards firefly \(j\) is calculated using the following formula:  
\[x_{i}=x_{i}+\beta\times(x_{j}-x_{i})+\alpha\times(rand-1/2) \tag{28}\]  
In this equation, \(x_{i}\) and \(x_{j}\) represent the spatial positions of fireflies \(I\) and \(j\), respectively. \(A\) denotes the step size factor, a constant within the range [0, 1]. \(Rand\) is a random factor uniformly distributed in the range [0, 1]. The light absorption coefficient \(\gamma\) has a significant impact on the attractiveness \(\beta\), determining the individual firefly's movement span, convergence speed, and other factors. When the distance between two fireflies is relatively small, the expansion of the attractiveness function is as follows:  
\[\beta=\beta_{0}\times e^{-\gamma r_{ij}^{2}}=\beta_{0}(1-\gamma r_{ij}^{2}+0.5 \gamma^{2}r_{ij}^{4}+\ldots) \tag{29}\]  
If the light absorption coefficient approaches zero, the attractiveness tends towards \(\beta_{0}\). Thus, the position update formula is:  
\[x_{i}=x_{i}+\beta_{0}\times(x_{j}-x_{i})+\alpha\times(rand-1/2) \tag{30}\]  
If \(\beta_{0}\) is equal to 1, the position update formula is as follows:  
\[x_{i}=x_{j}+\alpha\times(rand-1/2) \tag{31}\]  
In this context, if the emitted light from fireflies undergoes no attenuation in space, each firefly can directly locate the optimal and brightest individual within its vicinity. If the light intensity absorption coefficient \(\gamma\) is relatively large, then \(\beta\) also takes a larger value.