Struct xu::agent::Agent[][src]

pub struct Agent<Gene> { /* fields omitted */ }

Carries a set of genes.

Implementations

impl<Gene> Agent<Gene>[src]

pub fn new() -> Self where
    Standard: Distribution<Gene>,
    Gene: Hash
[src]

Creates an agents with no genes.

pub fn with_genes(number_of_genes: usize) -> Self where
    Standard: Distribution<Gene>,
    Gene: Hash
[src]

Creates a new Agent with random set of genes.

pub fn get_genes(&self) -> &Vec<Gene>[src]

pub fn crossover_some_genes(&mut self, other: &Self) where
    Gene: Clone + Hash
[src]

Chooses a random point on genes of self and uses that as its crossover point. Maintains the number of genes of self if the other has a different gene length.

pub fn mutate(&mut self) where
    Standard: Distribution<Gene>,
    Gene: Hash
[src]

pub fn has_same_genes(&self, other: &Self) -> bool[src]

pub fn get_hash(&self) -> u64[src]

Gets a hash representing this agents gene sequence.

Trait Implementations

impl<Gene: Clone> Clone for Agent<Gene>[src]

Auto Trait Implementations

impl<Gene> RefUnwindSafe for Agent<Gene> where
    Gene: RefUnwindSafe

impl<Gene> Send for Agent<Gene> where
    Gene: Send

impl<Gene> Sync for Agent<Gene> where
    Gene: Sync

impl<Gene> Unpin for Agent<Gene> where
    Gene: Unpin

impl<Gene> UnwindSafe for Agent<Gene> where
    Gene: 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> 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.