it s alive, need to smooth fitness
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import numpy as np
|
||||
import random
|
||||
from brain import Neural_Network
|
||||
from params import MUTATION_RATE
|
||||
|
||||
def genetic_selection(brains):
|
||||
# tot_fitness = sum ([int(b.fitness) for b in brains])
|
||||
@@ -36,7 +37,7 @@ def cross_mutate_genes(p1_gene, p2_gene):
|
||||
else :
|
||||
choice = p2_gene[idx]
|
||||
# Mutation
|
||||
if random.random() < 0.005 :
|
||||
if random.random() < MUTATION_RATE :
|
||||
choice[random.randint(0, len(choice) - 1)] = random.random()
|
||||
print("Mutation !")
|
||||
child.append(choice)
|
||||
|
||||
Reference in New Issue
Block a user