# An Automatic Software Defect Repair Method Based on Multi-Objective Genetic Programming
###### Abstract  
Due to the explosive growth of software quantity and the mixed ability of software developers, a large number of software defects emerge during the later stages of software maintenance. The search method based on genetic programming is one of the most popular in search algorithms, but it also has some issues. The single-objective approach to validate and select offspring patches without considering other constraints can affect the efficiency of patch generation. To address this issue, this paper proposes an automatic software repair method based on Multi-objective Genetic Programming (MGFRepair). Firstly, the method adopts a lightweight context analysis strategy to find suitable repair materials. Secondly, it decouples the replacement statements and insertion statements in the repair materials, using a lower-granularity patch representation method to encode the patches in the search space. Then, the automatic software defect repair is treated as a multi-objective search problem, and the NSGA-II multi-objective optimization algorithm is used to find simpler repair patches. Finally, the test case filtering technique is used to accelerate the patch validation process and generate correct patches. MGFRepair was experimentally evaluated on 395 real Java software defects from the Defects4J dataset. The experimental results show that MGFRepair can generate test case-passing patches for 51 defects, of which 35 defect patches are equivalent to manually generated patches. Its repair the efficiency and success rate are higher to other excellent automatic software defect repair methods such as JGenProg, RSRepair, ARJA, Nopol, Cappen, and SequenceR. genetic programming; automatic software repair; multi-objective optimization; context analysis +
Footnote †: journal: Medical  
causes controversy in fitness function studies. In the search process, GenProg utilizes genetic programming by defining crossover and mutation operations of code snippets to increase the search space for patches, thereby recombining existing code snippets. However, [PERSON] et al. (2018) reported PraPR (practical program repair), a program repair technique based on JVM bytecode, which mitigates some of the drawbacks of source-code-level repair, such as complex structure and long iteration compilation time. Bytecode-level repair can effectively overcome these disadvantages, but there is still no fundamental solution for the significant computational resources consumed by genetic programming. Recognizing the drawbacks of genetic programming, [PERSON] et al. (2018) proposed RSRepair (Random-Search-based Repair) in 2014. This method adopts the same repair framework as GenProg but replaces the genetic algorithm with random search. Comparative experimental analysis shows that the genetic programming algorithm in GenProg does not play a significant role. The use of random search algorithms can not only correctly fix the same bugs but also achieve higher repair efficiency for 23 bugs compared to genetic algorithms. To improve upon the search efficiency of genetic programming, [PERSON] (2018) proposed ARJA (automated repair of Java), which not only enriches GenProg's search space but also improves the search efficiency through test case filtering. This alleviates the infinite loop caused by the computational complexity of the fitness function and prevents the deterioration of the patch search process. However, while ARJA improves GenProg in many ways, it does not fundamentally alleviate the problem of patch overfitting. In 2020, [PERSON] et al. (2020, 2020) proposed a new solution called ARJA-e (an enhanced version of ARJA) to address this issue. By detecting overfitting patches, it effectively solves the problem of patch overfitting, but the experimental results remain the same. The aforementioned repair methods, including GenProg, RSRepair, and ARJA, adopt a single objective to select offspring patches. This does not perfect the selection process, resulting in the inability to select higher-quality offspring patches during genetic iteration.