Exploiting Antipheromone in Ant Colony Optimisation for Interactive Search-Based Software Design and Refactoring

Preventing user-fatigue in interactive meta-heuristic search places as great an emphasis on efficiency as it does on effectiveness. Engagement may also be boosted if the system provides a sense of "responsiveness" - for example, avoiding unpopular solutions as well as exploiting preferred ones. In this paper we explore one possible way of achieving these goals using the concept of "anti-pheromones" in different forms of Ant Colony Optimisation. Taking search-based software design and refactoring as a case study, we use extensive offline experiments to investigate differences of timescale and method for applying anti-pheromones. Results confirm our predictions that most combinations are in fact counter-productive. However, applying high levels of anti-pheromone, only in the initial stages of a run, can rapidly steer the search away from unproductive regions, reducing the number of evaluations required by up to 20% without compromising solution fitness.


INTRODUCTION
Assisting the software engineer with the cognitively demanding task of design and refactoring has attracted much research attention within the field of Search-Based Software Engineering (SBSE) e.g. [3], [5]. In interactive metaheuristic search effective and efficient search performance is crucial to prevent user fatigue [8]. In SBSE, as elsewhere, the notion of fitness is fundamental to selection in metaheuristic search. However, it has been proposed that misfit of a candidate solution within its context is significant. For example, Alexander [1] suggests that designers are more adept at recognising solution/context ensemble misfit than good fit, and use their perceptions of misfit to derive improved candidate solutions. In agile software development methodologies, the notion of design as misfit rectification can be Permission to make digital or hard copies of part or all of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for third-party components of this work must be honored. For all other uses, contact the owner/author(s). 2. If search is in a good region then penalising "worst" solutions with antipheromone may be counter-productive.

BACKGROUND
In 2002, Montgomery and Randall [4] noted that in nature, various ant species exploit many hormones in foraging behaviours. They suggested the use of antipheromone as a "repellent substance" to artificial ants, acting in combination with, but in contrast to, pheromone as an attractant. Building on Ant Colony System (ACS) [2], the authors suggested three extensions incorporating antipheromone by (i) subtracting pheromone for the worst solution path, (ii) making pheromone 'repellent' for poorer solutions, and (iii) making explorer ants that are arracted to areas of little pheromone.

PROPOSED APPROACH
Building on previous research [6], we extend Ant Colony Optimization by means of two mechanisms: • Phased Antipheromone, where an initial phase of search (during which both antipheromone and pheromone are deposited) precedes a pheromone phase (in which only pheromone is deposited); • Subtractive Antipheromone, in which a single ant, being the worst solution in the colony, removes or reduces pheromone from the worst solution path.

Solution Encoding
ACO generally uses a representation where candidate solutions (i.e. paths) are encoded by a permutation of a fixed set of values. However, each candidate solution is represented as a permutation of a set comprising design elements (i.e. attributes and methods) and "end-of-class" markers. Further details of the solution encoding are described at [6].

Cost Measure
The cost measure employed in the proposed approach draws on two metrics of design quality, which are to be minimised and lie in the interval (0,1]. The first relates to dependency coupling between design classes (fCBO), while the second reflects design symmetry (fNAC ). The cost measure combines the two elements with equal weight: Further details of the dependency coupling measure, f CBO and the design symmetry cost measure, f N AC are available at [6].

Search Algorithm
The ACO algorithm variants used in this paper are inspired by Simple-ACO [2] and MAX-MIN Ant System [7]. In the Simple-ACO algorithm all ants of the colony update the pheromone table in turn according to the cost value of their path. An initial phase of antipheromone deposit is implemented as a percentage of the total number of evaluations. Where the algorithm is in its antipheromone phase, we introduce an additional mechanism for the single worst ant in the colony, wherein pheromone values are reduced to 50%, 10% and 0% of their original values. Similarly, if the MMAS variant algorithm is in its antipheromone phase, we introduce two mechanisms. Either pheromone is reduced to the MAX-MIN minimum threshold parameter Mmin, or a 50% reduction of the original pheromone value is applied, subject to the MAX-MIN minimum threshold.

METHODOLOGY
We conducted experiments with the two antipheromone ACO algorithm variants (Simple-ACO and MMAS) for each of four problem instances i.e. Cinema Booking System, Graduate Development Program, Select Cruises and a randomised instance [6]. The resulting data for Cost and number of Evaluations were analysed using a two-way Analysis of Variance.

RESULTS
For Simple-ACO variant algorithm, initial antipheromone phases were trialled by reducing pheromone values by 50%, 10% and 0%. Findings indicated that for all design problem instances, compared with no antipheromone deposit, values of Cost and Evaluations are inferior. Analysis of Variance indicated that the differences are significant.
For the MMAS algorithm variant, initial antipheromone phases were trailed with pheromone reductions to a 50% or original, and Mmin. For 50% reduction, values of Cost and Evaluations are inferior, and the differences are statistically significant. However, for reductions to Mmin, Cost values obtained are not significantly different from those obtained without antipheromone. Furthermore, the number of Evaluations is lower for antipheromone phases of up to 10%, and the reductions of up to 20% achieved are statistically significant. Reductions of 20%, 13% and 11% are achieved for the CBS, GDP and Randomised problem instances respectively. Results for the CBS problem instance are shown in figure 1; the picture is very similar for GDP and Random.

CONCLUSIONS
For search-based software design and refactoring, we investigated a number an antipheromone approaches to Ant Colony Optimisation, wherein pheromomone values are reduced for the single worst ant in the colony. Using an MMAS-based antipheromone variant, the number of evaluations required to achieve best cost measures is reduced up to 20%, without compromising solution quality. We conclude early phase application (i.e. up to 10% of evaluations) helps steer search away from poor solutions, whereas extended application (i.e. above 20%) can be counter-productive, especially if search has arrived at promising regions.