Genome
As with any specialized library, the core components operate on their own domain language, Radiate is no exception. The domain language of Radiate can be called the Genome and includes the: Population
, Phenotype
, Genotype
, Chromosome
, Gene
, and Allele
. Each of these components is a building block of the genetic information that is used by the GeneticEngine.
Allele
- The
Allele
is the smallest unit of genetic information in Radiate. It is a single value that can be used to represent a trait or characteristic of an individual. For example, anAllele
could represent a single bit in a binary string, a single character in a string, or a single number in a list of numbers. At its most basic level, anAllele
is the "atom" of genetic information that is used to express the genetic makeup of an individual.
Gene
- The
Gene
is a wrapper around anAllele
that provides additional functionality for working with genetic information. AGene
can be thought of as a container for anAllele
that allows theAllele
to operate within the context of the Genome. For example, theFloatGene
struct is aGene
that contains a floating-point number as itsAllele
. Radiate provides a number of built-inGene
types that can be used to represent different types of genetic information. However, customGene
can also be defined to represent unique types of genetic information. -
Certain
Genes
have additional functionality that allows them to be manipulated in specific ways, such as theFloatGene
andIntGene<I>
which implement theArithmeticGene
. TheArithmeticGene
trait provides methods for performing arithmetic operations on theGene
.Gene
Implementations- Allele:
bool
- Description: Represents a single bit
true
/false
- Implements:
Gene
#[derive(Clone, PartialEq)] pub struct FloatGene { pub allele: f32, pub value_range: Range<f32> pub bounds: Range<f32>, }
- Allele:
f32
- Description: Represents a single floating-point number
- Implements:
Gene
,ArithmeticGene
#[derive(Clone, PartialEq)] pub struct IntGene<T: Integer<T>> { pub allele: T, pub value_range: Range<T>, pub bounds: Range<T>, }
- Allele:
I
whereI
implementsInteger<I>
.Integer
is a trait in Radiate and is implemented fori8
,i16
,i32
,i64
,i128
,u8
,u16
,u32
,u64
,u128
. - Description: Represents a single integer number
- Implements:
Gene
,ArithmeticGene
- Allele:
char
- Description: Represents a single character
- Implements:
Gene
User defined
Gene
types can be implemented by implementing theGene
trait. - Allele:
Chromosome
-
Each
Gene
is contained within aChromosome
and as such, eachGene
has its ownChromosome
. TheChromosome
is a collection ofGenes
that represent a part or the whole of the genetic information of an individual. AChromosome
can be thought of as a "chunk" or vector of genetic information. For example, aChromosome
could represent a sequence of numbers, a string of characters, or a set of binary values among other things. The decision to a definedChromosome
for eachGene
was made to allow for more flexibility in the genetic information that can be represented.Chromosome
implementations- Gene Type:
BitGene
- Description: Represents a sequence of binary values
- Gene Type:
FloatGene
- Description: Represents a sequence of floating-point numbers (f32)
- Gene Type:
IntGene<I>
whereI
implementsInteger<I>
.Integer
is a trait in Radiate and is implemented fori8
,i16
,i32
,i64
,i128
,u8
,u16
,u32
,u64
,u128
. - Description: Represents a sequence of integer numbers
- Gene Type:
CharGene
- Description: Represents a sequence of characters
For user defined
Chromosome
types, theChromosome
trait can be implemented. - Gene Type:
Genotype
- The
Genotype
is a collection ofChromosomes
that represent the complete genetic makeup of an individual. AGenotype
can be thought of as a "blueprint" for an individual that contains all of the genetic information necessary to fully express the traits and characteristics of that individual. Because theGenotype
is a collection ofChromosomes
, it can be used to represent complex genetic information that is composed of multiple parts. It can be thought of as a "matrix" ofGenes
where each row is aChromosome
. For example, aGenotype
ofFloatChromosome
s can be thought of as aVec<Vec<f32>>
or a matrix of floating-point numbers.
Phenotype
- In Radiate, the
Phenotype
is the primary interface between the GeneticEngine and the individuals that it is evolving. It is responsible for managing the genetic information of the individual, evaluating the fitness of the individual, and providing a way for theGeneticEngine
to interact with the individual. ThePhenotype
is the "body" of the individual that theGeneticEngine
is evolving, and it is the main data structure that theGeneticEngine
operates on.
Population
- The
Population
is a collection ofPhenotypes
that represents a group of individuals that are being evolved by theGeneticEngine
. ThePopulation
is the main data structure that theGeneticEngine
operates on, and it is responsible for managing the individuals in the population, evaluating their fitness, and evolving them over time. ThePopulation
is the "ecosystem" in which the genetic algorithm operates, and it is the primary interface between theGeneticEngine
and the individuals that it is evolving.