Struct xu::agent::Agent [−][src]
Carries a set of genes.
Implementations
impl<Gene> Agent<Gene>
[src]
pub fn new() -> Self where
Standard: Distribution<Gene>,
Gene: Hash,
[src]
Standard: Distribution<Gene>,
Gene: Hash,
Creates an agents with no genes.
pub fn with_genes(number_of_genes: usize) -> Self where
Standard: Distribution<Gene>,
Gene: Hash,
[src]
Standard: Distribution<Gene>,
Gene: Hash,
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]
Gene: Clone + Hash,
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]
Standard: Distribution<Gene>,
Gene: Hash,
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
Auto Trait Implementations
impl<Gene> RefUnwindSafe for Agent<Gene> where
Gene: RefUnwindSafe,
Gene: RefUnwindSafe,
impl<Gene> Send for Agent<Gene> where
Gene: Send,
Gene: Send,
impl<Gene> Sync for Agent<Gene> where
Gene: Sync,
Gene: Sync,
impl<Gene> Unpin for Agent<Gene> where
Gene: Unpin,
Gene: Unpin,
impl<Gene> UnwindSafe for Agent<Gene> where
Gene: UnwindSafe,
Gene: UnwindSafe,
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> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
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>,