基于自适应交叉的多目标软件重构推荐方法
CSTR:
作者:
作者单位:

作者简介:

通讯作者:

中图分类号:

基金项目:

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


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

Fund Project:

  • 摘要
  • |
  • 图/表
  • |
  • 访问统计
  • |
  • 参考文献
  • |
  • 相似文献
  • |
  • 引证文献
  • |
  • 资源附件
  • |
  • 文章评论
    摘要:

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

    Abstract:

    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.

    参考文献
    相似文献
    引证文献
引用本文

郑梅艳,张 杨.基于自适应交叉的多目标软件重构推荐方法[J].河北科技大学学报,2026,47(2):200-208

复制
分享
相关视频

文章指标
  • 点击次数:
  • 下载次数:
  • HTML阅读次数:
  • 引用次数:
历史
  • 收稿日期:2025-09-30
  • 最后修改日期:2026-01-27
  • 录用日期:
  • 在线发布日期: 2026-04-27
  • 出版日期:
文章二维码