Create Population class
This commit is contained in:
parent
9563ba7222
commit
2c7ffe39a3
16
src/population.py
Normal file
16
src/population.py
Normal file
|
@ -0,0 +1,16 @@
|
|||
from individual import Individual
|
||||
|
||||
|
||||
class Population(object):
|
||||
|
||||
def __init__(self, size):
|
||||
self.members = []
|
||||
for current in range(0, size):
|
||||
self.members.append(Individual())
|
||||
|
||||
def fitness_function(self):
|
||||
total = 0
|
||||
for member in self.members:
|
||||
total += member.fitness_function()
|
||||
return total
|
||||
|
Loading…
Reference in New Issue
Block a user