// choose function for survival, crossover and local search
choose function for survival, crossover and local search
choose function for survival crossover and local search
pub fn choose_rand_byfitness(fitneseses: &Vec<f32>, n_batches: &usize, m_per_batch: &usize) -> Vec<Vec<usize>> {
    if *n_batches == 0 || *m_per_batch == 0 {
        panic!("Cannot choose zero members of population");
    }
    let mut sum_fit = 0.0;
    for x in fitneseses.iter() {
        sum_fit += *x;
    }
    let mut probs: Vec<f32> = Vec::with_capacity(fitneseses.len());
    for x in fitneseses.iter() {
        probs.push(*x / sum_fit);
    }
    choose_byprob(&probs, n_batches, m_per_batch)
}
pub fn choose_rand_byfitness ( fitneseses : & Vec < f32 > , n_batches : & usize , m_per_batch : & usize ) -> Vec < Vec < usize > > { if * n_batches == 0 || * m_per_batch == 0 { panic ! ( " " ) ; } let mut sum_fit = 0.0 ; for x in fitneseses . iter ( ) { sum_fit += * x ; } let mut probs : Vec < f32 > = Vec :: with_capacity ( fitneseses . len ( ) ) ; for x in fitneseses . iter ( ) { probs . push ( * x / sum_fit ) ; } choose_byprob ( & probs , n_batches , m_per_batch ) }
choose function for survival, crossover and local search
choose function for survival crossover and local search
fitneseses
&Vec<f32>
n_batches
&usize
m_per_batch
&usize