Link Search Menu Expand Document

What is ACMA smart agents?

ACMA smart agents are three agents built with Deep Q-learning method upon tha old ACMA tool to refactor software systems. They contain two tools which must be run together: 1) custom ACMA tool and 2) its DQN Server.

View ACMA on GitHub View DQN Server on GitHub


Introduction

History

A-CMA refactors Java projects by receiving their Java byte-code as input. This tool first gets the Java byte-code and then extracts its structure (i.e. classes, methods, fields, relations, method-inputs, access levels, etc.). A-CMA can measure several metrics as well as the 26 metrics which we have used to represent the state shown in the table below.

Measure-IDDescription
numFieldsThe number of fields per class.
avrgFieldVisibilityThe average value of field visibility per class (where private has the lowest and public has the highest values).
numConstantsThe number of constant fields per class.
numOpsThe number of methods per class.
avrgMethodVisibilityThe average value of method visibility per class.
settersThe number of set methods per class.
gettersThe number of get-methods per class.
staticnessThe number of static methods per class.
nestingThe nesting level per class.
abstractnessThe ratio of abstract classes to all classes in a package.
numClsThe number of classes per package.
numInterfThe number of interfaces in a package.
packageNestingThe nesting level per package.
numOpsClsThe number of class operations per package.
iFImplThe number of implemented interfaces by a class.
NOCThe number of children per class.
numDescThe number of descendants per class.
numAncThe number of ancestors per class.
iC_AttrThe number of classes or interfaces used as attributes in a class.
eC_AttrThe number of external uses of a class as an attribute in other classes.
iC_ParThe number of classes or interfaces used as parameter types in class methods.
eC_ParThe number of external uses of a class as parameter type in methods.
Dep_InThe number of elements that depend on a class.
Dep_OutThe number of elements that are depended on by a class.
NumAssEl_sscThe number of associated elements in the same namespace of a class.
NumAssEl_nsbThe number of associated elements that are not in the same namespace of a class.

These metrics are also used to create configurations that will be used as fitness functions in their algorithms (before the performed modifications, A-CMA has only a limited number of search-based algorithms). We have modified the A-CMA tool in order to add DQN-based agents to it. The major modifications were (1) adding 10 new metrics used for the segregation criteria and (2) adding the proposed algorithms such as the learner, accountant, and gambler accountant agents, and finally (3) introducing a mechanism to segregate the actions. For calculating the reward in each step, we have used the built-in score function.

We also needed a Deep Q-Network (DQN in short). Therefore, we have created another project coded in the Python language named A-CMA DQN server. DQN is a deep neural network that is supposed to take the state of the problem as input and give the Q-values of each action as the output.

Architecture

The architecture of the refactoring tool is presented in figure below.

ACMA Architecture

All of these units are collaborating to refactor the software.