Skip to content
Snippets Groups Projects
Commit fe7ae3c5 authored by Kappes Marques Rodrigo's avatar Kappes Marques Rodrigo
Browse files

cleaned the algogenetique

parent 6e66e365
No related branches found
No related tags found
No related merge requests found
...@@ -24,7 +24,7 @@ def main(N,tmax,pmutation, proportion): ...@@ -24,7 +24,7 @@ def main(N,tmax,pmutation, proportion):
#Creation of the initial population #Creation of the initial population
People=Population(N) People=Population(N)
#Avaliating the initial population #Evaluating the initial population for the histogram
S1=[] S1=[]
for individu in People.indiv: for individu in People.indiv:
individu.evaluate() individu.evaluate()
...@@ -55,6 +55,7 @@ def main(N,tmax,pmutation, proportion): ...@@ -55,6 +55,7 @@ def main(N,tmax,pmutation, proportion):
plt.subplot(221) plt.subplot(221)
plt.plot([i for i in range(tmax)], L) plt.plot([i for i in range(tmax)], L)
#Graph of the original population
plt.subplot(223) plt.subplot(223)
plt.hist(S1, range = (0, maximum+10), bins = 20, color = 'red') plt.hist(S1, range = (0, maximum+10), bins = 20, color = 'red')
...@@ -63,6 +64,7 @@ def main(N,tmax,pmutation, proportion): ...@@ -63,6 +64,7 @@ def main(N,tmax,pmutation, proportion):
print("Distance finale: ", best.distance) print("Distance finale: ", best.distance)
print("Avg:", sum(S2)/len(S2)) print("Avg:", sum(S2)/len(S2))
#Graph of the final population
plt.subplot(224) plt.subplot(224)
plt.hist(S2, range = (0,maximum+10), bins = 20, color = 'blue') plt.hist(S2, range = (0,maximum+10), bins = 20, color = 'blue')
plt.show() plt.show()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment