首页|期刊导航|河北科技大学学报|基于自适应交叉的多目标软件重构推荐方法

基于自适应交叉的多目标软件重构推荐方法OA

Recommendation method for multi-objective software refactoring based on adaptive crossover

中文摘要英文摘要

为解决传统交叉算子机械交换基因片段容器引入过度随机性,导致生成无效重构的问题,提出一种基于自适应交叉算子的重构推荐方法 RefCross.首先,通过源代码分析工具解析 Java 项目并构建代码结构模型获取代码度量信息;其次,设计适应度函数并基于度量信息计算适应度值,引导交叉算子的优化方向;最后,构建基于特征匹配的父代分类机制并制定交叉策略,结合共同基因保留、差异基因自适应选择及精英基因强化策略,生成兼顾优质特征继承与解空间多样性的子代重构序列,以降低无效重构生成概率.结果表明,与现有方法相比,RefCross 在 6 个开源项目上的精确率、召回率和 F1 分数上均取得更优表现,其平均 F1 分数达到 77.82%,较基线方法提升 9.10个百分点.该方法能够有效提升重构推荐的有效性与准确性,可为自动化重构决策提供支持.

To address the problem of excessive randomness introduced by the mechanical exchange of gene fragments in traditional crossover operators,which leads to the generation of invalid refactoring operations,this paper proposed a refactoring recommendation method called RefCross based on an adaptive crossover operator.Firstly,the submitted Java projects were parsed using source code analysis tools to construct a code structure model to extract code metrics.Then the fitness function was designed and the fitness value was calculated based on the extracted code metrics to guide the optimization direction of the crossover operator.Finally,the parent classification mechanism based on feature matching was constructed,and the crossover strategy was formulated.By combining with common gene retention,adaptive selection of differential genes,and the elite gene reinforcement strategy,the offspring refactoring sequences that balanced high-quality feature inheritance and diversity in the solution space was generated,thereby reducing the probability of generating ineffective refactoring operations.The results show that RefCross outperforms existing methods in precision,recall,and F1 score metrics on six open-source projects,achieving an average F1 score of 77.82%,representing a baseline improvement of 9.10 percentage points.This method effectively enhances the effectiveness and accuracy of refactoring recommendations,providing strong support for automated refactoring decisions.

郑梅艳;张杨

河北科技大学信息科学与工程学院,河北 石家庄 050018河北科技大学信息科学与工程学院,河北 石家庄 050018

信息技术与安全科学

软件工程多目标优化交叉算子重构推荐父代分类

software engineeringmulti-objective optimizationcrossover operatorrefactoring recommendationparent classification

《河北科技大学学报》 2026 (2)

200-208,9

国家自然科学基金(61440012,J2524003)河北省自然科学基金(F2023208001,F2026208004)河北省引进留学人员资助项目(C20230358)

10.7535/hbkd.2026yx02009

评论