[][src]Struct radiate::engine::niche::Niche

pub struct Niche<T, E> {
    pub mascot: Member<T>,
    pub members: Vec<NicheMember<T>>,
    pub age: i32,
    pub total_adjusted_fitness: Option<f32>,
    // some fields omitted
}

A species is meant to keep track of fitness scores of eachof it's members, and a mascot. The mascot is the representation of the species by a Type member in the population. It also holds the number of age it's been alive

Fields

mascot: Member<T>members: Vec<NicheMember<T>>age: i32total_adjusted_fitness: Option<f32>

Methods

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

Implement the species

pub fn new(mascot: &Member<T>, mascot_fitness: f32) -> Self[src]

pub fn fittest(&self) -> (f32, Member<T>)[src]

Get the top performing member from the species by their associated fitness score. If None is returned meaning there is no members in the species, panic!

pub fn reset(&mut self)[src]

Reset the species by getting a new random mascot and incrememnting the age by one, then setting the total adjusted species back to None, and clearing the members vec. Basically starting from scratch again but need to incremement a few small things to keep track of the species

pub fn calculate_total_adjusted_fitness(&mut self)[src]

pub fn get_total_adjusted_fitness(&self) -> f32[src]

Get the total adjusted fitness score of the species by summing up all the fitness scores of each member

pub fn display_info(&self)[src]

Trait Implementations

impl<T: Clone, E: Clone> Clone for Niche<T, E>[src]

impl<T: Debug, E: Debug> Debug for Niche<T, E>[src]

Auto Trait Implementations

impl<T, E> RefUnwindSafe for Niche<T, E> where
    E: RefUnwindSafe

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

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

impl<T, E> Unpin for Niche<T, E> where
    E: Unpin

impl<T, E> UnwindSafe for Niche<T, E> where
    E: UnwindSafe

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> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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 where
    T: ?Sized
[src]

impl<T> Type for T[src]

type Meta = Concrete

Type of metadata for type.

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