def __str__(self) -> str: save_string = "" save_string += surround_tag("innovation_number", str(self.innovation_number)) save_string += surround_tag("node_number", str(self.node_number)) save_string += surround_tag("connection_innovations", save_dict(self.connection_innovations)) save_string += surround_tag("node_innovations", save_dict(self.node_innovations)) save_string += surround_tag("node_depths", save_dict(self.node_depths)) return save_string
def __str__(self) -> str: save_string = "" save_string += surround_tag("weight", str(self.weight)) save_string += surround_tag("in_node", str(self.in_node)) save_string += surround_tag("out_node", str(self.out_node)) save_string += surround_tag("innovation_number", str(self.innovation_number)) save_string += surround_tag("enabled", str(self.enabled)) return save_string
def __str__(self) -> str: save_string = "" save_string += surround_tag("input_size", str(self.input_size)) save_string += surround_tag("output_size", str(self.output_size)) save_string += surround_tag("raw_fitness", str(self.raw_fitness)) genes_string = "" for gene in self.genes: genes_string += surround_tag("gene", str(gene)) save_string += surround_tag("genes", genes_string) return save_string
def save(self, file_path): save_string = "" save_string += surround_tag('current', str(self.current_generation)) past_string = "" for generation in self.past: surround_tag("generation", str(generation)) save_string += surround_tag("past", past_string) save_file = open(file_path, 'w') save_file.write(save_string) save_file.close()
def __str__(self) -> str: save_string = "" save_string += surround_tag("representative", str(self.representative)) save_string += surround_tag("age", str(self.age)) save_string += surround_tag("niche_fitness", str(self.niche_fitness)) save_string += surround_tag("max_fitness", str(self.max_fitness)) genomes_string = "" for genome in self.genomes: genomes_string += surround_tag("genome", str(genome)) save_string += surround_tag("genomes", genomes_string) return save_string
def __str__(self) -> str: save_string = "" save_string += surround_tag("generation_count", str(self.generation)) save_string += surround_tag("population", str(self.population)) save_string += surround_tag("gene_pool", str(self.gene_pool)) return save_string