Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
TheAlbion committed Mar 14, 2017
2 parents a6ec45c + 63202db commit 020aaf5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
16 changes: 11 additions & 5 deletions EA/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
from deap import algorithms
from deap import base
from deap import creator

import datetime
from deap import tools

import config
Expand Down Expand Up @@ -168,13 +170,10 @@ def mate_individuals(ind1, ind2):
top1_list = []

for gen in range(NUMBER_OF_GENERATIONS):
offspring = algorithms.varAnd(population, toolbox, cxpb=0.1, mutpb=0.02)
offspring = algorithms.varAnd(population, toolbox, cxpb=0.1, mutpb=0.2)
fits = list(toolbox.map(toolbox.evaluate, offspring))
print(list(fits))
print(len(fits))
print(len(offspring))
for fit, ind in zip(fits, offspring):
print(fit)
ind.fitness.values = fit
population = toolbox.select(offspring, k=len(population))
top1 = tools.selBest(population, k=1)
Expand All @@ -191,4 +190,11 @@ def mate_individuals(ind1, ind2):
for ind in generation:
fitness_list.append(ind.fitness.values)
print(fitness_list)
print(type(fitness_list[0]))
print(type(fitness_list[0]))

image_name = str(datetime.datetime.now()) + '.png'

plt.plot([x[0] for x in fitness_list])
plt.ylabel('some numbers')
plt.savefig(image_name)

6 changes: 6 additions & 0 deletions EA/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
appdirs==1.4.3
cycler==0.10.0
deap==1.0.2
matplotlib==2.0.0
numpy==1.12.0
packaging==16.8
pi==0.1.2
pyparsing==2.2.0
python-dateutil==2.6.0
pytz==2016.10
six==1.10.0

0 comments on commit 020aaf5

Please sign in to comment.