# Harnessing Energy Balance and Genetic Algorithms for Efficient Building Demolition
## 2 Materials and Methods
### Multi-Source Energy Balance  
The multi-source energy balance is a method designed to ensure that, within a designated area, multiple iterations of energy diffusion and relocation lead to an equilibrium in the energy boundaries of each source point. The core of this method is to determine the optimal influence range for each energy release point through meticulous energy distribution and adjustments. Initially, energy release points are established. Whether these points are located within or outside the target range, they can be fine-tuned to their optimal positions using iterative algorithms. The specific steps for implementing the multi-source energy balance are detailed below:  
Step 1. The initial step is to determine the energy release points. We first expand our dataset to cover a rectangular area. Using an equal division strategy, we select the midpoint on the median line within each divided area as the initial energy release points. It is important to note that these initial points may be located within or outside the target range. However, through our iterative algorithm, these points can be adjusted to their ideal energy release locations. This method provides an effective way to determine the initial energy release points, laying the groundwork for subsequent optimization processes. For instance, the schematic diagram of equal division for a U-shaped dataset is as shown in Figure 3. The blue, red, and green lines represent the strategies for dividing areas, and the red circles represent the chosen initial positions. Step 2. In our methodology, we constructed a Cartesian coordinate system based on the dimensions of the rectangular region, designating its vertex as the origin, with both x and y axes scaled in meters. As depicted in Figure 4, using the U-shaped data as a representative example, our dataset encompasses numerous pixel points, which were predefined during the dataset formulation. All subsequent computations are anchored in this coordinate framework. The data are delineated by pixels, with each pixel equating to a physical span of 0.25 m in real-world dimensions. This coordinate system facilitates a meaningful connection between our model and actual architectural structures, thereby bolstering its practical relevance. Figure 4: Dataset coordinate schematic diagram. Figure 3: Schematic diagram of the initial energy release point location. Furthermore, for each energy release point within the region, we employ a potential function to model energy diffusion. In our study, the energy transfer process from energy release points constitutes a vital component. To accurately depict this process, we have chosen to utilize the fundamental calculation formula for shock wave overpressure resulting from point energy release. This formula is widely acknowledged as an effective tool for universally characterizing the phenomenon of shock wave overpressure, particularly when energy release points are involved [10]. The formula's precise depiction of the energy transfer process allows us to delve deeply into the dynamic behavior. The potential function is defined as follows:  
\[\mathrm{P}=\frac{0.082}{R}+\frac{0.0265}{R^{2}}+\frac{0.686}{R^{3}} \tag{1}\]  
where \(R\) represents the proportional distance:  
\[\mathrm{R}=\frac{r}{W^{\frac{1}{3}}} \tag{2}\]  
In this context, \(r\) represents the distance from the current position to the energy release center (m), while \(W\) is the equivalent value of the release amount (kg). The unit of the potential function is given in Mpa. In our algorithm, the initial value of R is set to 0.25 m and is increased by 0.25 m with each iteration. As illustrated in Figure 5, during the first iteration, we first compute the energy diffusion value for Region A, followed by that for Region B. In the subsequent iteration, we reverse the order, starting with Region B and then moving to Region A. Throughout the iterations, we first compute the area where the blue circle is located, followed by the area of the green circle.