From c639175bec58158bd9d4217186ee3d23619b3aab Mon Sep 17 00:00:00 2001 From: vrettasm Date: Thu, 6 Feb 2025 13:55:44 +0100 Subject: [PATCH] Fix bug in average_hamming_distance --- pygenalgo/engines/auxiliary.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pygenalgo/engines/auxiliary.py b/pygenalgo/engines/auxiliary.py index 3bba68f..f3f5850 100644 --- a/pygenalgo/engines/auxiliary.py +++ b/pygenalgo/engines/auxiliary.py @@ -2,7 +2,6 @@ from dataclasses import dataclass, field from pygenalgo.genome.chromosome import Chromosome - # Public interface. __all__ = ["hamming_distance", "average_hamming_distance", "apply_corrections", "SubPopulation"] @@ -61,7 +60,7 @@ def average_hamming_distance(population: list[Chromosome]) -> float: total_diffs, total_genes = 0, 0 # Iterate through all the population. - for i, item1 in enumerate(population[:-1]): + for i, item1 in enumerate(population): # Get the size of the chromosome. It is # assumed that all chromosomes have the