[−][src]Struct radiate::engine::population::Population
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)
Implementations
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]
T: Genome<T, E> + Send + Sync + Clone,
E: Envionment + Sized + Send + Sync + Default,
P: Problem<T>,
implement the population
pub fn new() -> Self
[src]
base population
pub fn members_mut(&mut self) -> &mut [Container<T, E>]
[src]
Get mutable slice of current generation members.
pub fn member_mut(&mut self, idx: usize) -> Option<&mut Container<T, E>>
[src]
Get mutable member.
pub fn member(&self, idx: usize) -> Option<&Container<T, E>>
[src]
Get immutable member.
pub fn train(&mut self) -> Option<(f32, T)> where
T: Genome<T, E> + Clone + Send + Sync + Debug + PartialEq,
P: Send + Sync,
[src]
T: Genome<T, E> + Clone + Send + Sync + Debug + PartialEq,
P: Send + Sync,
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 end_generation(&mut self) -> Option<(f32, T)> where
T: Genome<T, E> + Clone + Send + Sync + Debug + PartialEq,
P: Send + Sync,
[src]
T: Genome<T, E> + Clone + Send + Sync + Debug + PartialEq,
P: Send + Sync,
Handle end of generation calculations and create a new generation. Returns the top member and their score.
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]
F: Fn(&T, f32, i32) -> bool + Sized,
T: Genome<T, E> + Clone + Send + Sync + Debug + PartialEq,
P: Send + Sync,
E: Clone,
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 /// by hand, however you might find those default settings do not satisfy the needs of your problem /// Set the beginning generation of the population by a generation 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 population back to the caller 2.) populate_base - as long as the population 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]
P: Send + Sync,
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]
T: Genome<T, E> + Clone,
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 structure 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 get_size(&self) -> i32
[src]
Get the size of the population.
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 argument 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 criteria, 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 biased random 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,
P: Send + Sync,
impl<T, E, P> Sync for Population<T, E, P> where
P: Send + Sync,
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
pub unsafe fn drop(ptr: usize)
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,