[][src]Struct radiate::engine::population::Population

pub struct Population<T, E, P> where
    T: Genome<T, E> + Send + Sync,
    E: Envionment + Sized + Send + Sync,
    P: Problem<T>, 
{ /* fields omitted */ }

Population is what facilitates the evolution from a 5000 ft view keeping track of what the generation is doing, marking statistics down from each one, and holding resource sensitive things like datasets as well as making sure that the optimization is moving forward through the stats it keeps (stagnation)

Methods

impl<T, E, P> Population<T, E, P> where
    T: Genome<T, E> + Send + Sync + Clone,
    E: Envionment + Sized + Send + Sync + Default,
    P: Problem<T>, 
[src]

implmenet the population

pub fn new() -> Self[src]

base population

pub fn train(&mut self) -> Option<(f32, T)> where
    T: Genome<T, E> + Clone + Send + Sync + Debug + PartialEq,
    P: Send + Sync
[src]

Each generation will be trained by a call to this function resulting optimization of the current generation, up to a crossover into the next generation which will be set to the new current generation

pub fn run<F>(&mut self, runner: F) -> Result<(T, E), &'static str> where
    F: Fn(&T, f32, i32) -> bool + Sized,
    T: Genome<T, E> + Clone + Send + Sync + Debug + PartialEq,
    P: Send + Sync,
    E: Clone
[src]

Run the population according to a user defined function, the inputs of which are a borrowed member which is the top member of the current generation, the fitness of that member, and the current number of generations. This function will continue until this function returns a true value

pub fn populate_gen(self, gen: Generation<T, E>) -> Self[src]

configure all the settings for the population these all have default settings if they are not set /// customly, however you might find those default settings do not satisfy the needs of your problem /// Set the beginning generation of the population by a generion object this can be done in three ways all listed below.

1.) populate_gen - Create a generation object outsize of this scope and give it to the population, return the popuolation back to the caller 2.) populate_base - as long as the popualtion size has already been set and the type T has implemented the base trait fn, this will generate a new base generation 3.) populate_vec - Give the population a vec of type T and generate a new generation from it then return the population back to the caller 4.) populate_clone - Take a base type T and create a population that is made up completely of clones of this type - they will all be the same at least for the first generation, this is useful for algorithms like NEAT give the populate a direct generation object

pub fn populate_base(self) -> Self where
    P: Send + Sync
[src]

populate the populate with the base implementation of the genome

pub fn populate_vec(self, vals: Vec<T>) -> Self[src]

given a vec of type T which implements Genome, populate the population

pub fn populate_clone(self, original: T) -> Self where
    T: Genome<T, E> + Clone
[src]

Given one type T which is a genome, create a population with clones of the original

pub fn constrain(self, environment: E) -> Self[src]

Give solver settings to the population to evolve the strucutre defined

pub fn size(self, size: i32) -> Self[src]

Set the size of the population, the population size will default to 100 if this isn't set which could be enough depending on the problem being solved

pub fn dynamic_distance(self, opt: bool) -> Self[src]

set the dynamic distance bool

pub fn stagnation(self, stag: usize, cleaner: Vec<Genocide>) -> Self[src]

set the stagnation number of the population

pub fn configure(self, spec: Config) -> Self[src]

Set a config object to the population, these are arguments related to evolution through speciation, so these are all speciation arguments

pub fn impose(self, prob: P) -> Self[src]

Impose a problem on the population, in other words, give the population a problem to solve. This will default to an empty problem, meaning the population will not solve anything if this isn't set. This is really the most important arguemnt for the population

pub fn debug(self, d: bool) -> Self[src]

debug determines what to display to the screen during evolution

pub fn survivor_criteria(self, survive: SurvivalCriteria) -> Self[src]

give the population a survival cirteria, if none is supplied then it defaults to the fittest genome from each species

pub fn parental_criteria(self, parents: ParentalCriteria) -> Self[src]

give the population a way to pick the parents, if none is supplied then default to biasedrandom genomes

Auto Trait Implementations

impl<T, E, P> RefUnwindSafe for Population<T, E, P>

impl<T, E, P> Send for Population<T, E, P> where
    P: Send + Sync

impl<T, E, P> Sync for Population<T, E, P> where
    P: Send + Sync

impl<T, E, P> Unpin for Population<T, E, P>

impl<T, E, P> UnwindSafe for Population<T, E, P>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Type for T[src]

type Meta = Concrete

Type of metadata for type.

impl<T> Type for T where
    T: ?Sized
[src]

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,