Loop through generations

This commit is contained in:
George Lacey 2017-09-26 16:16:53 +01:00
parent c8b34af323
commit 9d2494660b

View File

@ -7,7 +7,8 @@ args = args.parse_args()
pop = Population(args.pop) pop = Population(args.pop)
while True: for i in range(0, 5000):
print(pop)
input("Advance...")
pop.advance_generation() pop.advance_generation()
best = pop.best_fitness()
print("Best fit:\tx:%e,\ty:%e\tf:%e" % (best.x, best.y, best.fitness()))
print("Average fit:\t%e\n" % pop.avg_fitness())