GenotypeGraph is a directed graph encoding for the genome of an arm.
More...
GenotypeGraph is a directed graph encoding for the genome of an arm.
◆ __init__()
| None morphevo.genome.GenotypeGraph.__init__ |
( |
|
self, |
|
|
float |
anchor_length = 1.0 |
|
) |
| |
- Parameters
-
| anchor_length | The length of the anchor module. |
◆ __len__()
| def morphevo.genome.GenotypeGraph.__len__ |
( |
|
self | ) |
|
Return amount of modules in the arm without anchor.
◆ add_module()
| None morphevo.genome.GenotypeGraph.add_module |
( |
|
self, |
|
|
ModuleType |
module_type, |
|
|
float |
length |
|
) |
| |
Add a module to the graph, will join nodes if type is the same as last node.
- Parameters
-
| module_type | The type of the module. |
| length | The length of the module. |
◆ get_change_index()
| int | None morphevo.genome.GenotypeGraph.get_change_index |
( |
|
self, |
|
|
float |
chance |
|
) |
| |
Get the index where a change (addition of deletion) can occur.
This depends on the outcome of a chance. If chance fails None is returned to represent no mutation.
- Returns
- Index of mutation or None.
◆ get_last_node()
Get the last node in the graph encoding.
- Returns
- The last node in the graph encoding.
◆ get_random_module()
| Module morphevo.genome.GenotypeGraph.get_random_module |
( |
|
self | ) |
|
Iterator to iterate graph module after module instead of node after node.
- Returns
- Module
◆ iterate_graph()
| def morphevo.genome.GenotypeGraph.iterate_graph |
( |
|
self, |
|
|
bool |
ignore_anchor = True |
|
) |
| |
Iterator to iterate graph module after module instead of node after node.
- Parameters
-
| ignore_anchor | Choice to skip anchor in iteration. |
◆ mutate()
Create a new graph encoding that is a mutation of itself.
- Returns
- The mutated graph encoding.
The documentation for this class was generated from the following file: