-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain_old.py
37 lines (32 loc) · 941 Bytes
/
main_old.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
# This is a sample Python script.
# Press Shift+F10 to execute it or replace it with your code.
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.
import matplotlib.pyplot as plt
import numpy as np
from Original.Population import PopulationClass
import time
I_PATH = "Test_images/test4.jpg"
x = PopulationClass(I_PATH,7,1000)
x.print_poly_image()
x.print_values()
start = time.time()
fit_vec = []
fitt = 100000000
for i in range(1000):
x.do_the_evolution()
if i%100 == 0:
end = time.time()
print('Iteration:', i, ' Elapsed time: ', end-start)
start = time.time()
summ = x.fitness_sum
fit_vec.append(summ)
if summ < fitt and i >200:
fitt = summ
# a = copy.deepcopy(x)
#print(summ)
# x.print_poly_image()
plt.plot(fit_vec)
plt.show()
x.print_poly_image()
# a.print_poly_image()
x.print_values()