# Harnessing Energy Balance and Genetic Algorithms for Efficient Building Demolition
## 2 Materials and Methods
### Multi-Source Energy Balance
The iterative calculation will continue until an energy equilibrium is achieved between adjacent boundaries. In each iteration, the initial coordinate values of the energy release points are set to K (where k = 1, 2, \(\ldots\), N), with N denoting the number of energy release points. The values of pixel coordinates passed during the diffusion process are modified to the corresponding K based on the coordinate values of the energy release points. By assessing whether these traversed pixel coordinate values have been preemptively changed, we can ascertain if we have reached the boundary of the adjacent region. In other words, this signifies whether the current iteration has realized the energy balance between adjacent boundaries. Step 3. After reaching an equilibrium between adjacent boundary regions, we scan through all pixel values. Depending on the distinct K values, we tally the pixels within different regions. With each pixel representing an area of 0.25 m \(\times\) 0.25 m, we can compute the total area of all regions. Assuming the current region is labeled as \(i\), its diffusion area is denoted as \(S_{i}\). We then take the centroid of this diffusion range as the new energy release point and commence the next round of iterative processing. Steps 2 and 3 are executed repeatedly. The iteration concludes once the condition defined by Equation (3) is satisfied, signaling that the final equilibrium state has been  
Figure 5: Iterative computation. attained. Additionally, \(P_{1}\) represents the error ratio of the difference in area between two iterations. This ratio will be provided in the subsequent experimental setup. \[\frac{S_{c}-S_{l}}{S_{l}}\leq P_{1} \tag{3}\]  
In Equation (3), \(S_{c}\) represents the area of the region calculated in the current iteration, while \(S_{l}\) represents the area of the region calculated in the previous iteration. When the difference between the two is within \(P_{1}\), we consider that the iteration has reached equilibrium. Step 4. Upon the completion of the iterations, we observed a phenomenon termed the \"oscillation effect\". According to the potential function formula, pixel oscillations occur at the boundary between two adjacent areas. For instance, as shown in Figure 6, during the initial computation, the energy diffusion value for Area A is calculated first, followed by that for Area B. Consequently, the boundary pixels(blue circles) are attributed to Area A. In the subsequent computation, the order is reversed, with Area B being computed before Area A, resulting in the boundary pixels(blue circles) being attributed to Area B. This variation in pixel attribution due to the change in the computation sequence is what we define as the \"oscillation effect\". We further designate the region experiencing this oscillation as the \"oscillatory region\". The schematic diagram is as follows:  
In each computational process, we consistently record the pixel coordinates of the boundary and keep a record of the traversed pixel blocks, each measuring 0.25 m by 0.25 m. This information is utilized to calculate the diffusion area of the energy release point. Given that the pixels within the \"oscillation region\" align with the recorded boundary coordinates, we choose to dynamically allocate these oscillating pixel blocks to the region currently being computed, based on the direction of the calculation process. For example, as illustrated in Figure 5, when the boundary oscillation condition is met, and the computation has progressed to the blue-shaded Area A, we assign this oscillation region to Area A. As our algorithm undergoes multiple iterations, each with a very small area error threshold, dynamic allocation continues to yield satisfactory results. This multi-source point energy balancing method takes into account the even distribution of energy and can achieve the convergence of energy diffusion from multiple sources in a relatively short time.