Skip to content

Instantly share code, notes, and snippets.

@amankharwal
Created September 8, 2020 05:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amankharwal/0669e651c571bb96237e7b759877a1da to your computer and use it in GitHub Desktop.
Save amankharwal/0669e651c571bb96237e7b759877a1da to your computer and use it in GitHub Desktop.
def newGeneration(generation, size):
top4 = generation[:4, 0]
newGen = generation[:2,0]
for i in range(0, 4):
for j in range(0, 4):
if(i != j):
c1, c2 = crossover(top4[i], top4[j], size)
newGen = np.append(newGen, c1)
newGen = np.append(newGen, c2)
#print(newGen)
return newGen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment