Example #1
0
def test_best_individual_returned(one_island):
    generator = MultipleValueChromosomeGenerator(generate_zero,
                                                 VALUE_LIST_SIZE)
    best_indv = generator()
    one_island.load_population([best_indv], replace=False)
    archipelago = SerialArchipelago(one_island)
    assert archipelago.test_for_convergence(error_tol=ERROR_TOL)
    assert archipelago.get_best_individual().fitness == 0
Example #2
0
def test_convergence_of_archipelago_unconverged(one_island):
    archipelago = SerialArchipelago(one_island, num_islands=6)
    converged = archipelago.test_for_convergence(0)
    assert not converged
Example #3
0
def test_convergence_of_archipelago(one_island, island_list):
    archipelago = SerialArchipelago(one_island, num_islands=4)
    archipelago._islands = island_list

    converged = archipelago.test_for_convergence(0)
    assert converged