|
panga
|
#include <Genome.h>
Classes | |
| struct | Gene |
Public Member Functions | |
| Genome (const Genome &rhs)=delete | |
| Genome (Genome &&rhs)=default | |
| Genome & | operator= (const Genome &rhs)=delete |
| size_t | AddGene (size_t bit_width, bool byte_align=false) |
| void | SetBooleanGeneCount (size_t boolean_gene_count) |
| void | AddBooleanGenes (size_t count) |
| size_t | GetBooleanGeneCount () const |
| size_t | GetGeneStartBitIndex (size_t gene_index) const |
| size_t | GetGeneBitWitdh (size_t gene_index) const |
| size_t | GetFirstBooleanGeneBitIndex () const |
| size_t | GetFirstBooleanGeneIndex () const |
| size_t | GetGeneCount () const |
| size_t | BitsRequired () const |
Provides a representation of the genes which, taken together, represent a genome for members of a species.
Using the Genome, we may decode a block of binary data and extract the bits representing each gene from the data. (This is what Chromosome does).
The Genome data may be constructed by adding genes one-at-a-time via AddGene along with an optional number of boolean genes.
The genome is structured into two pieces:
| void panga::Genome::AddBooleanGenes | ( | size_t | count | ) |
| size_t panga::Genome::AddGene | ( | size_t | bit_width, |
| bool | byte_align = false |
||
| ) |
Add a gene to the Genome.
The new gene will be added to the end of the Genome.
This can be very useful if you want to access the memory backing this gene later directly (via something like Chromosome::GetRawGene).
| bit_width | The width of the gene we want to add. |
| byte_align | If true, we will shift the starting offset and bit width such that this gene begins and ends on a byte-boundary. |
| size_t panga::Genome::BitsRequired | ( | ) | const |
Get the number of bits needed to encode this Genome.
| size_t panga::Genome::GetBooleanGeneCount | ( | ) | const |
Get the number of boolean Genes in the Genome.
| size_t panga::Genome::GetFirstBooleanGeneBitIndex | ( | ) | const |
Get the bit index of the first boolean gene in the Genome.
| size_t panga::Genome::GetFirstBooleanGeneIndex | ( | ) | const |
Get the gene index of the first boolean gene in the Genome.
| size_t panga::Genome::GetGeneBitWitdh | ( | size_t | gene_index | ) | const |
Get the bit width for a gene.
| gene_index | Index of the gene we should return the width for. |
| size_t panga::Genome::GetGeneCount | ( | ) | const |
Get the count of genes in the Genome.
Note: Includes the count of boolean genes.
| size_t panga::Genome::GetGeneStartBitIndex | ( | size_t | gene_index | ) | const |
Get the bit offset where a gene starts.
| void panga::Genome::SetBooleanGeneCount | ( | size_t | boolean_gene_count | ) |
Set the number of boolean genes in this Genome.
This overwrites any value currently in the boolean gene count.
1.8.17