Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def nextGen(currPop, distDict, numChrome, mutRate):
- genFit = {}
- for i in currPop:
- tmp = fitness(i, distDict)
- genFit[tuple(i)] = tmp
- print(tmp)
- genFitCum = dictCum(genFit)
- print(len(genFit), len(currPop))
- parentSelection = parents(genFitCum, numChrome)
- children = breedPopulation(parentSelection, numChrome)
- nextGeneration = mutatePop(children, mutRate)
- return nextGeneration
Add Comment
Please, Sign In to add comment