Research Article

A New Metaheuristic-Based Hierarchical Clustering Algorithm for Software Modularization

Algorithm 3

Pseudocode of chromosome evaluation.
Input: a chromosome as ch
Output: update ch.fitness
ch.fitness = 0
tree ← decode the chromosome ch to tree
q ← Queue()
tree.root.cf = 1
q.push(tree.root)
while q is not empty do
 parent ← q.pop()
 child1, child2 ← t.children()
 child1.cf ← exCF(child1, parent)
 child2.cf ← exCF(child2, parent)
if child1.cf + child2.cf ≥ parent.cf then
  q.push(child1)
  q.push(child2)
else
  ch.fitness ← ch.fitness + parent.cf
 end if
end while