From 51028346fdce8e41ef4327057da42af7e4688348 Mon Sep 17 00:00:00 2001 From: wls2002 Date: Thu, 30 Jan 2025 19:50:26 +0800 Subject: [PATCH] update cal_spawn_numbers_by_fitness --- src/tensorneat/algorithm/neat/species.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/tensorneat/algorithm/neat/species.py b/src/tensorneat/algorithm/neat/species.py index e868d2b..a34f4ea 100644 --- a/src/tensorneat/algorithm/neat/species.py +++ b/src/tensorneat/algorithm/neat/species.py @@ -299,7 +299,8 @@ class SpeciesController(StatefulBaseClass): # normalize the fitness before calculating the spawn number # consider that the fitness may be negative # in this way the species with the lowest fitness will have spawn_number = 0 - species_fitness = species_fitness - jnp.min(species_fitness) + # 2025.1.31 updated, add +1 to avoid 0 + species_fitness = species_fitness - jnp.min(species_fitness) + 1 # calculate the spawn number rate by the fitness of each species spawn_number_rate = species_fitness / jnp.sum(