|
SELAB3 Python Code
|
A class that represents a Genome, it contains an encoding, methods for evaluation, methods to mutate and methods to compare to other genomes. More...
Public Member Functions | |
| None | __init__ (self, Optional[Genome] parent_genome=None) |
| Create a Genome, if no parent is given a random encoding will be generated. More... | |
| None | mutate (self) |
| Mutate the encoding of the genome. | |
| str | get_urdf (self) |
| Get the urdf string for an encoding. More... | |
| float | calculate_diversity_from (self, Genome other_genome) |
| Calculate the diversity to another genome. More... | |
| Genome | crossover (self, Genome other_genome) |
| Do a crossover with another genome. More... | |
| int | get_amount_of_joints (self) |
| Count the amount of joints a genotype represents. More... | |
| int | __hash__ (self) |
Public Attributes | |
| amount_of_modules | |
| genotype_graph | |
| workspace | |
| genome_id | |
A class that represents a Genome, it contains an encoding, methods for evaluation, methods to mutate and methods to compare to other genomes.
| None morphevo.genome.Genome.__init__ | ( | self, | |
| Optional[Genome] | parent_genome = None |
||
| ) |
Create a Genome, if no parent is given a random encoding will be generated.
Otherwise, it will use the mutated encoding of its parent as encoding.
| parent_genome | The optional parent. |
| float morphevo.genome.Genome.calculate_diversity_from | ( | self, | |
| Genome | other_genome | ||
| ) |
Calculate the diversity to another genome.
This function compares modules on the same level of the arm. If a module is a different type the difference for that level is 1 on the amount of modules in the longest arm (same for missing modules). Else you calculate the percentage of length difference between the modules.
| other_genome | The genome you want to compare with. |
Do a crossover with another genome.
For every module you will run a chance to determine of which parent you will include its module. If one parent is shorter the top modules of the other parent can still be included at the end of the arm.
| other_genome | The other genome to crossover with. |
| int morphevo.genome.Genome.get_amount_of_joints | ( | self | ) |
Count the amount of joints a genotype represents.
| str morphevo.genome.Genome.get_urdf | ( | self | ) |
Get the urdf string for an encoding.