Added distance attribute

This commit is contained in:
SimpleArt
2020-12-04 14:26:18 -05:00
parent 046592a3a8
commit 8c024a0290
2 changed files with 13 additions and 2 deletions

View File

@ -126,7 +126,7 @@ class GA(Attributes):
# Difference between best and i-th chromosomes
best_chromosome = self.population[0]
tol = lambda i: sqrt(abs(best_chromosome.fitness - self.population[i].fitness))
tol = lambda i: self.dist(best_chromosome, self.population[i])
# Change rates with:
multiplier = 1 + self.adapt_probability_rate
@ -185,7 +185,7 @@ class GA(Attributes):
# Difference between best and i-th chromosomes
best_chromosome = self.population[0]
tol = lambda i: sqrt(abs(best_chromosome.fitness - self.population[i].fitness))
tol = lambda i: self.dist(best_chromosome, self.population[i])
# First non-zero tolerance after amount_converged/4
for i in range(amount_converged//4, len(self.population)):