if scores[i] < b_fitness: b_fitness = scores[i] b_gene = gene children = [] for i in range(g.n_pop / 2): p1 = g.t_selection(scores) p2 = g.t_selection(scores) ch1, ch2 = g.u_crossover(g.population[p1], g.population[p1]) children.append(g.mutation(ch1)) children.append(g.mutation(ch2)) g.population = children print "f1(x) = %f" % b_fitness # TEST NUM. 2 -- f2(x1, x2) g = GA(n_gen, n_pop, p_mut, p_xover, l_dna * 2) b_gene = "" b_fitness = 999999 g.init_population() for _ in range(g.n_gen):