Module codecs

Module codecs 

Source

Modules§

bit
char
float
function
int
permutation
subset

Structs§

BitCodec
A Codec for a Genotype of BitGenes. The encode function creates a Genotype with num_chromosomes chromosomes and num_genes genes per chromosome. The decode function creates a Vec<Vec<bool>> from the Genotype where the inner Vec contains the alleles of the BitGenes in the chromosome - the bool values.
CharCodec
A Codec for a Genotype of CharGenes. The encode function creates a Genotype with num_chromosomes chromosomes and num_genes genes per chromosome. The decode function creates a String from the Genotype where the String contains the alleles of the CharGenes in the chromosome.
FloatCodec
A Codec for a Genotype of FloatGenes. The encode function creates a Genotype with num_chromosomes chromosomes and num_genes genes per chromosome. The decode function creates a Vec<Vec<f32>> from the Genotype where the inner Vec contains the alleles of the FloatGenes in the chromosome - the f32 values.
FnCodec
A Codec that uses functions to encode and decode a Genotype to and from a type T. Most of the other codecs in this module are more specialized and are used to create Genotypes of specific types of Chromosomes. This one, however, is more general and can be used to create Genotypes of any type of Chromosome.
IntCodec
A Codec for a Genotype of IntGenes. The encode function creates a Genotype with num_chromosomes chromosomes and num_genes genes per chromosome. The decode function creates a Vec<Vec<T>> from the Genotype where the inner Vec contains the alleles of the IntGenes in the chromosome. T must implement the Integer trait, meaning it must be one of i8, i16, i32, i64, i128, u8, u16, u32, u64, or u128.
PermutationCodec
SubSetCodec
A Codec for a subset of items. This is useful for problems where the goal is to find the best subset of items from a larger set of items. The encode function creates a Genotype with a single chromosome of BitGenes where each gene represents an item in the items vector. The decode function creates a Vec<&T> from the Genotype where the Vec contains the items that are selected by the BitGenes - the true genes.

Traits§

Codec
The Codec is a core concept in Radiate, as it allows for the encoding and decoding from a Genotype to the type T (commonly called Phenotype in biology) that is being optimized.