Get_Offspring.py
This class will write the details of the genetic algorithm run.
- Organisms.GA.Get_Offspring.Create_An_Offspring(input_data)
This method is used to obtain an offspring
- Parameters:
input_data (tuple of many inputs) – A tuple of all the information needed to make a new offspring
- Returns:
The offspring and a string containing any information that would be useful for the user to see about how this cluster was made
- Return type:
Organisms.GA.Cluster and str.
- Organisms.GA.Get_Offspring.Create_An_Unoptimised_Offspring(cluster_number, chance_of_mutation, cell_length, vacuum_to_add_length, population, creating_offspring_mode, crossover_procedure, mutation_procedure)
This definition provides the methodology for how to create an offspring.
- Inputs:
cluster_number (int): the name of the cluster chance_of_mutation (float): the change than a mutation will occur, either as well as or instead of crossover, depending on input for creating_offspring_mode. cell_length (float): The size of the unit cell. vacuum_to_add_length (float)” The amount of vacuum to add to the unit cell” population (Organisms.GA.Population): This is the population that clusters will be taken from for mating and mutation schemes. creating_offspring_mode (str.): This tag indicates how the offspring are created.
creating_offspring_mode == ‘Mating_and_Mutation_Together’ - The mating scheme is run first, followed by a mutation scheme with some probability..
creating_offspring_mode == ‘Either_Mating_and_Mutation’ - Either the mating ‘or’ the mutation scheme will run, depending on a probability value.
crossover_procedure (Organisms.GA.Crossover): mutation_procedure (Organisms.GA.Mutation):
- Returns:
the newly created offspring cluster.
- Return type:
Organisms.GA.Cluster
- Organisms.GA.Get_Offspring.Will_Mutation_Occur(choice_mate_or_mutate, chance_of_mutation)
This method will determine if the algotithm should perform a mutation.
- Parameters:
choice_mate_or_mutate (float) – This is a random value between 0 and 1. If this value is less than self.chance_of_mutation, this indicates to perform a mutation
chance_of_mutation (float) – This a decimal value between 0 and 1 that determines the chance of a mutation.
- Returns:
If True; mutate. If False; do not mutate (mate).
- Return type:
bool.