cgexplore.systems_optimisation.Generation

class cgexplore.systems_optimisation.Generation(chromosomes, fitness_calculator, structure_calculator, num_processes=1)[source]

Bases: object

Define the chromosomes in a single generation.

Methods

calculate_elite_fitness

Select the elite in the generation by fitness.

calculate_fitness_values

Calculate the fitness of all chromosomes.

get_generation_size

Get the number of chromosomes in a generation.

run_structures

Run the production and analyse of all chromosomes.

select_all

Select all in the generation.

select_best

Select the best in the generation by fitness.

select_elite

Select the elite in the generation by fitness.

select_worst

Select the worst in the generation by fitness.

Attributes

Parameters:
calculate_elite_fitness(proportion_threshold)[source]

Select the elite in the generation by fitness.

Parameters:

proportion_threshold (float)

Return type:

float

calculate_fitness_values()[source]

Calculate the fitness of all chromosomes.

Return type:

list[float]

get_generation_size()[source]

Get the number of chromosomes in a generation.

Return type:

int

run_structures()[source]

Run the production and analyse of all chromosomes.

Return type:

None

select_all()[source]

Select all in the generation.

Return type:

Sequence[Chromosome]

select_best(selection_size)[source]

Select the best in the generation by fitness.

Parameters:

selection_size (int)

Return type:

Sequence[Chromosome]

select_elite(proportion_threshold)[source]

Select the elite in the generation by fitness.

Parameters:

proportion_threshold (float)

Return type:

Sequence[Chromosome]

select_worst(selection_size)[source]

Select the worst in the generation by fitness.

Parameters:

selection_size (int)

Return type:

Sequence[Chromosome]

chromosomes: Sequence[Chromosome]
fitness_calculator: FitnessCalculator
num_processes: int
structure_calculator: StructureCalculator