예제 #1
0
    def _initialize_connections(self):
        if self.genome_config.is_initial_fully_connected:
            # initialize fully connected network with no recurrent connections
            connections = self._compute_full_connections()
        else:
            # initialize network with only a few connections between input-output nodes
            connections = self._compute_random_connections(repetitions=min(
                self.initial_nodes_sample, len(self.input_nodes_keys)))

        for input_node, output_node in connections:
            key = (int(input_node), int(output_node))
            connection = ConnectionGene(key=key)
            connection.random_initialization()
            self.connection_genes[key] = connection
예제 #2
0
def add_connection(connection_genes, key):
    connection_i = ConnectionGene(key=key)
    connection_i.random_initialization()
    connection_genes[key] = connection_i
    return connection_genes