"" " pop is a population, the form of each individual in the population is, (Makespan, chromosome ) " ""
Pop = [(Computestarttimes (G, I) [-1], G) forGinchinitpopulation (PS, I)]2 forItinchXrange (1, mit+1): "" "MIT is the number of iterations " ""3 #Random Ordering of the population4 Shuffle (pop) "" "disrupts the order of the individual in the pop" ""5Hpop = Len (pop)/2 "" "Hpop is half of the population" ""6 forIinchxrange (Hpop): "" "traverse the first half of the population " ""7 ifRandom () <PC: "" "if the random number between [0,1] < PC" ""8 #Create new Elements9CH1 = Crossover (pop[i][1], Pop[hpop + i][1], I) "" "to generate next generation by cross " ""TenCH2 = Crossover (Pop[hpop + i][1], pop[i][1], I) "" "togenerate next generation by cross " "" One ifRandom () <pm: ""if the random number between [0,1] < PM "" " ACH1 =Mutation (CH1) "" "CH1 mutation " "" - ifRandom () <pm: ""if the random number between [0,1] < PM "" " -CH2 =Mutation (CH2) "" "CH2 Mutation" "" thePop.append ((Computestarttimes (CH1, I) [-1], CH1)) "" "put the evolved chromosome back into the population " " -Pop.append ((Computestarttimes (CH2, I) [-1], CH2)) - #Sort individuals in increasing timespan order and - #Select only the most ones for the next iteration + Pop.sort () "" "to sort the chromosomes in pop by Makespan " " -Pop =pop[:p S] "" extracts the first PS chromosomes in a pop "" " + returnPOP[0] "" returns Makespan largest chromosome "" "
Application of genetic algorithm in Jobshop (Part 7: Overall process)