Exemplo n.º 1
0
    def mutate(self, unit):
        """
		Overrides a number of tree nodes from an individual AST
		"""
        #pdb.set_trace()
        nodes = unit.dna.serialize()
        for i in range(self.mut):
            mutation = T.AST(self.func_set, self.var_set)()
            chosen = random.choice(nodes)
            chosen.replace(mutation)
Exemplo n.º 2
0
    def gene_generator(self, function_set, value_set):
        """
		In this case the genes are replaced with a tree
		"""
        return T.AST(function_set, value_set)