def test_update_solution(chrom, fitness, optim, result): ga = StandardGA(fitness_test_sin_func, optim=optim) ga.best_chromosome = 1 ga.best_fitness = 100 ga._update_solution(chrom, fitness) assert ga.best_solution == result
def test_best_solution(): ga = StandardGA(fitness_test_sin_func) ga.best_chromosome = [1, 2] ga.best_fitness = 155 assert ga.best_solution == ([1, 2], 155)
def test_best_solution(): ga = StandardGA(fitness_test_sin_func) ga.best_chromosome = [1, 2] ga.best_fitness = 155 assert ga.best_solution == ([1,2], 155)