-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathevaluate.py
32 lines (26 loc) · 866 Bytes
/
evaluate.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
import matplotlib as matplotlib
from PIL import Image
import matplotlib.pyplot as plt
from main import fitness
def compare_fitness(copy_folder, style):
f = open("report-{}.txt".format(copy_folder), "r")
line = f.readline()
generation = []
fitness = []
while line is not None and len(line) > 2:
param = line.split(", ")
generation += [int(param[0].split(" ")[1])]
fitness += [float(param[1].split(" ")[1].split("\n")[0])]
print(generation[len(generation) - 1])
line = f.readline()
plt.plot(generation, fitness, style)
f.close()
# plt.plot(fits, style)
compare_fitness("piter_griffin", 'bo')
compare_fitness("griffin", 'b^')
compare_fitness("chessboard", 'go')
compare_fitness("cv", 'ro')
compare_fitness("cv2", 'r^')
compare_fitness("tron", 'mo')
compare_fitness("tron2", 'm^')
plt.show()