Multi-objective Integer Linear Programming approach for Automatic Software Cognitive Complexity Reduction

📅 2026-01-29
📈 Citations: 0
Influential: 0
📄 PDF
🤖 AI Summary
This study addresses the challenge of automatically reducing code cognitive complexity while preserving software functionality to enhance maintainability and security. The authors propose a novel optimization approach based on multi-objective integer linear programming, formulating cognitive complexity reduction as a combinatorial optimization problem. By integrating static code analysis with extract-method refactoring, the method simultaneously minimizes cognitive complexity—as defined by SonarSource—and other metrics such as lines of code, yielding a Pareto-optimal solution set. This work represents the first application of multi-objective integer linear programming to the automated optimization of cognitive complexity and introduces a parameterized solver that effectively achieves significant complexity reduction without altering program behavior.

Technology Category

Application Category

📝 Abstract
Clear and concise code is necessary to ensure maintainability, so it is crucial that the software is as simple as possible to understand, to avoid bugs and, above all, vulnerabilities. There are many ways to enhance software without changing its functionality, considering the extract method refactoring the primary process to reduce the effort required for code comprehension. The cognitive complexity measure employed in this work is the one defined by SonarSource, which is a company that develops well-known applications for static code analysis. This extraction problem can be modeled as a combinatorial optimization problem. The main difficulty arises from the existence of different criteria for evaluating the solutions obtained, requiring the formulation of the code extraction problem as a multi-objective optimization problem using alternative methods. We propose a multi-objective integer linear programming model to obtain a set of solutions that reduce the cognitive complexity of a given piece of code, such as balancing the number of lines of code and its cognitive complexity. In addition, several algorithms have been developed to validate the model. These algorithms have been integrated into a tool that enables the parameterised resolution of the problem of reducing software cognitive complexity.
Problem

Research questions and friction points this paper is trying to address.

cognitive complexity
multi-objective optimization
code refactoring
software maintainability
combinatorial optimization
Innovation

Methods, ideas, or system contributions that make the work stand out.

Multi-objective Integer Linear Programming
Cognitive Complexity Reduction
Code Refactoring
Combinatorial Optimization
Software Maintainability
🔎 Similar Papers
No similar papers found.
A
Adriana Novoa-Hurtado
ITIS Software, University of Málaga
R
Rubén Saborido
ITIS Software, University of Málaga
Francisco Chicano
Francisco Chicano
Associate, University of Málaga
Computer ScienceSBSECombinatorial Optimization Problems
M
Manuel Giménez-Medina
Ayesa Advanced Digital Services Limited (ASDA)