We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6427a3a commit c921595Copy full SHA for c921595
neat/genes.py
@@ -76,6 +76,14 @@ def crossover(self, gene2):
76
setattr(new_gene, a.name, getattr(self, a.name))
77
else:
78
setattr(new_gene, a.name, getattr(gene2, a.name))
79
+
80
+ # Implement the 75% disable rule from the NEAT paper:
81
+ # If either parent has a disabled gene, there is a 75% chance
82
+ # the offspring gene will be disabled.
83
+ if hasattr(new_gene, 'enabled'):
84
+ if not self.enabled or not gene2.enabled:
85
+ if random() < 0.75:
86
+ new_gene.enabled = False
87
88
return new_gene
89
0 commit comments