Пример #1
0
 def test_gene_value_all(self):
     chromosome = 67  # 1000011
     chromosome_size = 7
     start_pos = 1
     end_pos = 7
     individual = Individual(chromosome_size=chromosome_size, chromosome=chromosome)
     self.assertEqual(67, individual.gene_value(start_pos, end_pos))
Пример #2
0
 def test_gene_value_first_bits(self):
     chromosome = 67  # 1000011
     chromosome_size = 7
     start_pos = 1
     end_pos = 3
     individual = Individual(chromosome_size=chromosome_size, chromosome=chromosome)
     self.assertEqual(3, individual.gene_value(start_pos, end_pos))