-
Notifications
You must be signed in to change notification settings - Fork 6
/
gen_best_fitness.py
executable file
·43 lines (32 loc) · 1.07 KB
/
gen_best_fitness.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/python
#import math
import os
from sys import maxint
# Set these before running:
#fileName = "Results/newGO/lex/log19.txt"
#fileName = "Results/weighted/2f/log5.txt"
#fileName = "Results/two-frame-kata/bowling-lexicase/log1.txt"
#fileName = "Results/ULTRA/lexicase/log8.txt"
fileName = "Results/ULTRA/larger-lexicase/log3.txt"
errorType = "float"
# Main area
f = open(fileName)
gen = 0
best_mean_error = maxint
mean_errors = []
for line in f:
if line.startswith(";; -*- Report"):
gen = int(line.split()[-1])
if line.startswith("Mean:"):
gen_best_error = -1
if errorType == "float":
gen_best_error = float(line.split()[-1])
elif errorType == "int" or errorType == "integer":
gen_best_error = int(line.split()[-1])
else:
raise Exception("errorType of %s is not recognized" % errorType)
mean_errors.append(gen_best_error)
#print
#print "Best fitnesses of runs:"
for gen, mean_error in enumerate(mean_errors):
print "Gen: %3i | Best Fitness (mean) = %8.2f" % (gen, mean_error)