[][src]Struct radiate::engine::generation::Generation

pub struct Generation<T, E> where
    T: Genome<T, E> + Send + Sync,
    E: Send + Sync
{ pub members: Vec<Container<T, E>>, pub species: Vec<Family<T, E>>, pub survival_criteria: SurvivalCriteria, pub parental_criteria: ParentalCriteria, }

A generation is meant to facilitate the speciation, crossover, and reproduction of species and their types over the course of a single generation

Fields

members: Vec<Container<T, E>>species: Vec<Family<T, E>>survival_criteria: SurvivalCriteriaparental_criteria: ParentalCriteria

Implementations

impl<T, E> Generation<T, E> where
    T: Genome<T, E> + Send + Sync + Clone,
    E: Envionment + Sized + Send + Sync
[src]

implement the generation

pub fn new() -> Self[src]

Create a new generation

This creates a base default generation type with no members and no species. It is bland.

pub fn pass_down(&self, new_members: Vec<Member<T>>) -> Option<Self>[src]

pass down the previous generation's members and species to a new generation

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 optimize<P>(&mut self, prob: Arc<RwLock<P>>) where
    P: Problem<T> + Send + Sync
[src]

The optimization function

pub fn speciate(&mut self, distance: f32, settings: Arc<RwLock<E>>)[src]

Speciation is the process of going through the members in the generation and assigning them species in which they belong to determined by a specific distance between the member and the species mascot.

pub fn create_next_generation(
    &mut self,
    pop_size: i32,
    config: Config,
    env: Arc<RwLock<E>>
) -> Option<Self>
[src]

Create the next generation and return a new generation struct with new members, and reset species. This is how the generation moves from one to the next. This function also is the one which runs the crossover fn from the genome trait, the more efficient that function is, the faster this function will be.

pub fn best_member(&self) -> Option<(f32, Arc<T>)>[src]

get the top member of the generations

Trait Implementations

impl<T: Debug, E: Debug> Debug for Generation<T, E> where
    T: Genome<T, E> + Send + Sync,
    E: Send + Sync
[src]

Auto Trait Implementations

impl<T, E> RefUnwindSafe for Generation<T, E>

impl<T, E> Send for Generation<T, E>

impl<T, E> Sync for Generation<T, E>

impl<T, E> Unpin for Generation<T, E>

impl<T, E> UnwindSafe for Generation<T, E>

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> Pointable for T

type Init = T

The type for initializers.

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<V, T> VZip<V> for T where
    V: MultiLane<T>,