Parameters variation
This commit is contained in:
@@ -108,7 +108,7 @@ class GeneticOperators(object):
|
||||
while True:
|
||||
new_individual = copy.deepcopy(individual)
|
||||
for i in range(len(new_individual)):
|
||||
if i < 2 and random.random() < 0.1:
|
||||
if i < 2 and random.random() < 0.2:
|
||||
while new_individual[i] == individual[i]:
|
||||
new_individual[i] = random.randint(0, 2)
|
||||
elif i >= 2 and random.random() < self.indpb:
|
||||
@@ -167,6 +167,8 @@ class GeneticOperators(object):
|
||||
else: # Apply reproduction
|
||||
offspring.append(random.choice(population))
|
||||
|
||||
#~ for x in offspring:
|
||||
#~ print self.decode(x)
|
||||
# Evaluate the individuals with an invalid fitness
|
||||
invalid_ind = [ind for ind in offspring if not ind.fitness.valid]
|
||||
fitnesses = self.toolbox.map(self.evaluate, invalid_ind)
|
||||
|
Reference in New Issue
Block a user