def test_population_size_after_crossover_net12_2(self):
     list_of_demands = get_demands_from_file(net12_2_string_demands)
     first_population = generate_first_population(list_of_demands)
     first_population_length = len(first_population)
     new_population = crossover_chromosomes(first_population, 1)
     if len(first_population) % 2 == 0:
         self.assertEqual(first_population_length * 2, len(new_population))
     else:
         self.assertEqual(first_population_length * 2 - 1,
                          len(new_population))
Пример #2
0
 def test_numbers_of_demands_net12_2(self):
     __number_of_demands_net12_2 = get_number_of_demands(net12_2_string_demands)
     __list_of_demands_net12_2 = get_demands_from_file(net12_2_string_demands)
     self.assertEqual(__number_of_demands_net12_2, len(__list_of_demands_net12_2))
Пример #3
0
 def test_numbers_of_demands_net4(self):
     __number_of_demands_net4 = get_number_of_demands(net4_string_demands)
     __list_of_demands_net4 = get_demands_from_file(net4_string_demands)
     self.assertEqual(__number_of_demands_net4, len(__list_of_demands_net4))
 def test_demand_volumes_on_chromosome_list_of_genes_net12_2(self):
     list_of_demands = get_demands_from_file(net12_2_string_demands)
     first_population = generate_first_population(list_of_demands)
     for chromosome in first_population:
         for gene in chromosome.list_of_genes:
             self.assertEqual(gene.demand_volume, sum(gene.list_of_alleles))
 def test_size_of_generated_chromosome_list_of_genes_net12_2(self):
     number_of_demand_paths = get_number_of_demands(net12_2_string_demands)
     list_of_demands = get_demands_from_file(net12_2_string_demands)
     chromosome = generate_chromosome(list_of_demands)
     self.assertEqual(number_of_demand_paths, len(chromosome.list_of_genes))