Application of genetic algorithm in Jobshop (Part 7: Overall process)

Source: Internet
Author: User

"" " 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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.