-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot_test.py
More file actions
executable file
·34 lines (28 loc) · 1021 Bytes
/
plot_test.py
File metadata and controls
executable file
·34 lines (28 loc) · 1021 Bytes
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
#!/usr/bin/python
import testoob
from unittest import TestCase
from random import random, randint
import sys
from test_common import *
from plot import *
from evolve import Score
class G:
def __init__(self):
self.scores = []
for i in range(100):
d = Score(random(), (i/20)*random(), i/10*random())
self.scores.append(d)
self.mutationStats = []
for i in range(100):
d = (random(), randint(0,10), random())
self.mutationStats.append(d)
data = G()
class PlotTest(TestCase):
def test_plot_generation_vs_fitness(self):
plot_generation_vs_fitness(data, 'test/plot_generation_vs_fitness.pdf')
def test_plot_mutation_vs_prob_improvement(self):
plot_mutation_vs_prob_improvement(data, 'test/plot_mutation_vs_prob_improvement.pdf')
def test_plot_mutation_vs_fitness_change(self):
plot_mutation_vs_fitness_change(data, 'test/plot_mutation_vs_fitness_change.pdf')
if __name__ == "__main__":
test_main()