MOSA: fix breeding of next generation
Adding random tests in every iteration of the offspring generation makes
the offspring population large, which slows down the algorithm
dramatically.
@@ -154,15 +154,10 @@ class MOSATestStrategy(TestGenerationStrategy):
# Add new randomly generated tests
for _ in range(
- int(
- config.INSTANCE.population
- * config.INSTANCE.test_insertion_probability
- )
+ int(config.INSTANCE.population * config.INSTANCE.test_insertion_probability)
):
if len(self._archive.covered_goals) == 0 or randomness.next_bool():
- tch: tcc.TestCaseChromosome = (
- self._chromosome_factory.get_chromosome()
- )
+ tch: tcc.TestCaseChromosome = self._chromosome_factory.get_chromosome()
for fitness_function in self._fitness_functions:
tch.add_fitness_function(fitness_function)
else:
