cgexplore.systems_optimisation.Generation¶
- class cgexplore.systems_optimisation.Generation(chromosomes, fitness_calculator, structure_calculator, num_processes=1)[source]¶
Bases:
objectDefine the chromosomes in a single generation.
Methods
Select the elite in the generation by fitness.
Calculate the fitness of all chromosomes.
Get the number of chromosomes in a generation.
Run the production and analyse of all chromosomes.
Select all in the generation.
Select the best in the generation by fitness.
Select the elite in the generation by fitness.
Select the worst in the generation by fitness.
Attributes
- Parameters:
chromosomes (Sequence[Chromosome])
fitness_calculator (FitnessCalculator)
structure_calculator (StructureCalculator)
num_processes (int)
- calculate_elite_fitness(proportion_threshold)[source]¶
Select the elite in the generation by fitness.
- select_best(selection_size)[source]¶
Select the best in the generation by fitness.
- Parameters:
selection_size (int)
- Return type:
- select_elite(proportion_threshold)[source]¶
Select the elite in the generation by fitness.
- Parameters:
proportion_threshold (float)
- Return type:
- select_worst(selection_size)[source]¶
Select the worst in the generation by fitness.
- Parameters:
selection_size (int)
- Return type:
- chromosomes: Sequence[Chromosome]¶
- fitness_calculator: FitnessCalculator¶
- structure_calculator: StructureCalculator¶