Skip to content

Commit 7df363c

Browse files
committed
fix bug in UniqueGenotype: neighbouring_population_size panics when genes_size < 2
1 parent 0d25077 commit 7df363c

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/genotype/unique.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,9 @@ impl<T: Allele + Hash> HillClimbGenotype for Unique<T> {
205205
}
206206

207207
fn neighbouring_population_size(&self) -> BigUint {
208+
if self.genes_size < 2 {
209+
return BigUint::ZERO;
210+
}
208211
let n = BigUint::from(self.genes_size);
209212
let k = BigUint::from(2usize);
210213

0 commit comments

Comments
 (0)