Research Article

Loop Selection for Multilevel Nested Loops Using a Genetic Algorithm

Algorithm 1

Initial population generation.
Input:all loop layer set , all direction vector set
Output:chromosome set of the initial population
(1)functionINITIALISEPOPULATION ()
(2) Calculate the population size
(3)fordo
(4)  Calculate the set of loop layers () that cover the direction vector of
(5)end for
(6)fordo
(7)  fordo
(8)   Randomly choose a loop layer () from and add it to the set
(9)  end for
(10)  whiledoDelete the redundant loop layer
(11)    () randomly remove the loop layer from the set
(12)   fordo
(13)    Calculate the number of loop layers () in the set that covers the direction vector of
(14)    ifthen
(15)     
(16)     break;
(17)    end if
(18)   end for
(19)  end while
(20)  Generate Chromosome that corresponds to and add it to the set
(21)end for
(22)end function