コード例 #1
0
ファイル: GenomeTest.py プロジェクト: maxdubakov/NEAT
    def test_add_connection(self):
        print('\n\ntest_add_connection\nBEFORE 0')
        generation = Generation()
        genome = Genome(generation, 2, 1)
        for con in genome.connections():
            print(con)
        viz.construct(genome, 'before_0')
        genome._add_node()
        genome._add_connection()
        genome._add_connection()
        genome._add_connection()

        print('\nAFTER 0\n')
        for con in genome.connections():
            print(con)
        viz.construct(genome, 'after_0')
コード例 #2
0
    def test_excesses_and_disjoints(self):

        generation = Generation()
        genome_1 = Genome(generation, 1, 2)
        genome_2 = genome_1.copy_genome()
        viz.construct(genome_1, 'First Before')
        genome_1._add_node()
        genome_1._add_connection()
        for con in genome_1.connections():
            print(con)
        viz.construct(genome_1, 'First')
        genome_2._add_node()
        viz.construct(genome_2, 'Second')
        E, D = _excesses_disjoints(genome_1, genome_2)
        print('-' * 20)
        for con in genome_2.connections():
            print(con)
        print(f'Excesses: {E}')
        print(f'Disjoints: {D}')