pub struct Candidate<const N: usize, const NSYMS: usize> {
pub chromosone: [Gene; N],
pub scores: Vec<f64>,
pub violations: usize,
}
Fields
chromosone: [Gene; N]
scores: Vec<f64>
violations: usize
Implementations
sourceimpl<const N: usize, const NSYMS: usize> Candidate<N, NSYMS>
impl<const N: usize, const NSYMS: usize> Candidate<N, NSYMS>
pub fn from_chromosone(
gas: &Gas<N, NSYMS>,
chromosone: [Gene; N]
) -> Candidate<N, NSYMS>
pub fn new(gas: &Gas<N, NSYMS>, rng: &mut Rando) -> Candidate<N, NSYMS>
sourcepub fn total_score(&self, weights: &Vec<f64>) -> f64
pub fn total_score(&self, weights: &Vec<f64>) -> f64
calculate an aggregate score. The system doesn’t use this internally, but it can be used for a very rough comparison between candidates.
sourcepub fn similarity(population: &[Candidate<N, NSYMS>]) -> f64
pub fn similarity(population: &[Candidate<N, NSYMS>]) -> f64
give an estimate of a population’s diversity where 1 == all the same and 0 == completely different. Calculation is similar to a Hamming distance.
Trait Implementations
sourceimpl<const N: usize, const NSYMS: usize> PartialEq<Candidate<N, NSYMS>> for Candidate<N, NSYMS>
impl<const N: usize, const NSYMS: usize> PartialEq<Candidate<N, NSYMS>> for Candidate<N, NSYMS>
impl<const N: usize, const NSYMS: usize> StructuralPartialEq for Candidate<N, NSYMS>
Auto Trait Implementations
impl<const N: usize, const NSYMS: usize> RefUnwindSafe for Candidate<N, NSYMS>
impl<const N: usize, const NSYMS: usize> Send for Candidate<N, NSYMS>
impl<const N: usize, const NSYMS: usize> Sync for Candidate<N, NSYMS>
impl<const N: usize, const NSYMS: usize> Unpin for Candidate<N, NSYMS>
impl<const N: usize, const NSYMS: usize> UnwindSafe for Candidate<N, NSYMS>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more