# Harnessing Energy Balance and Genetic Algorithms for Efficient Building Demolition
## 2 Materials and Methods
### Optimization with an Enhanced Genetic Algorithm  
The Genetic Algorithm is an optimization algorithm grounded in [PERSON]'s Theory of Evolution that is especially apt for tackling complex optimization problems. This algorithm exhibits significant self-learning, self-adaptation, and self-optimization characteristics, as validated in the studies by [PERSON], [PERSON], [PERSON], [PERSON], [PERSON], [PERSON], and others [22]. The fundamental principle of the Genetic Algorithm is encoding each potential solution as a \"chromosome,\" with each chromosome representing a specific solution. Subsequently, each chromosome is evaluated based on predetermined criteria and ranked according to its fitness. Chromosomes with a higher fitness are more likely to be selected to generate the next generation. Through operations like selection, crossover, and mutation, a new population is generated and used for the next round of evaluation and selection. This process continues until the fitness of a chromosome meets the preset requirements, at which point the solution represented by this chromosome is deemed optimal. Building on the framework of the traditional Genetic Algorithm, we have made specific algorithmic improvements for the optimization problem of energy release points. In our proposed improved algorithm, genes are represented using binary encoding--specifically, each gene represents a regional center, i.e., the coordinates of the energy release point. To achieve precise localization, we assigned 12-bit binary encoding to each coordinate, with each bit representing 0 or 1, thereby representing 4095 different positions. In this encoding scheme, each pixel value corresponds to an actual distance of 0.25 m; thus, the 12-bit binary encoding represents a physical distance range of 1000 m. A straight-line distance of 1000 m is substantial, encompassing the scale of most architectural structures one might encounter in real-world scenarios. Therefore, this setting is not just about precision; it significantly enhances the algorithm's applicability and relevance to real-world architectural scenarios. To ensure that both large and small areas are as close in size as possible, we have devised a specific crossover strategy. After numerous iterations of energy balance adjustments, the positions of the energy release points within each area have been essentially determined, negating the need for major modifications. Consequently, we selected the regions with the largest and smallest coverage areas and executed a crossover operation on the lower six bits of their central coordinate's binary encoding (gene). The physical distance represented by these six bits is 16 m, a level of precision that is adequate for fine-tuning  
Figure 7: Multi-source Energy Balance. requirements. Through this crossover operation, we can identify more accurate positions for energy release. Our algorithm retains the foundational structure of genetic algorithms. By employing innovative encoding schemes and crossover strategies, we have pinpointed more accurate coordinates for the energy release source points. The specific steps are as follows:  
Step 1. Crossover Operation: After several rounds of energy balance adjustments, we have determined the coordinates of energy diffusion source points for each region, as well as the coordinates of the surrounding boundary pixels. Furthermore, we have calculated the area size associated with each source point. We then select the regions with the largest and smallest coverage areas for gene crossover operations, producing new coordinates for energy release source points. This operation specifically alters only two random bits within the lower six bits, with a crossover probability of 0.96. This means there is a 96% likelihood of executing random two-bit crossovers in each iteration. The objective of this operation is to introduce slight modifications while preserving the overall region, aiming for enhanced precision in optimization.