Guest User

Untitled

a guest
Jan 22nd, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. def nextGen(currPop, distDict, numChrome, mutRate):
  2.  
  3. genFit = {}
  4.  
  5. for i in currPop:
  6. tmp = fitness(i, distDict)
  7. genFit[tuple(i)] = tmp
  8. print(tmp)
  9.  
  10. genFitCum = dictCum(genFit)
  11.  
  12. print(len(genFit), len(currPop))
  13.  
  14. parentSelection = parents(genFitCum, numChrome)
  15.  
  16. children = breedPopulation(parentSelection, numChrome)
  17.  
  18. nextGeneration = mutatePop(children, mutRate)
  19.  
  20. return nextGeneration
Add Comment
Please, Sign In to add comment