pub fn rate_in_parallel<E, F>(self,
                                  evaluator: &E,
                                  pool: &mut Pool,
                                  chunk_size: usize)
                                  -> RatedPopulation<I, F>
        where E: Evaluator<I, F>,
              F: PartialOrd + Send + Default
    {
        let len = self.population.len();
        let mut rated_population: Vec<(I, F)> = self.population
                                                    .into_iter()
                                                    .map(|ind| {
                                                        let fitness = F::default();
                                                        (ind, fitness)
                                                    })
                                                    .collect();

        pool.for_(rated_population.chunks_mut(chunk_size), |chunk| {
            for &mut (ref ind, ref mut fitness) in chunk.iter_mut() {
                *fitness = evaluator.fitness(ind);
            }
        });

        debug_assert!(rated_population.len() == len);
        RatedPopulation { rated_population: rated_population }
    }
/// Evaluate the population in parallel using the threadpool `pool`.
Evaluate the population in parallel using the threadpool `pool`.
Evaluate the population in parallel using the threadpool ` pool ` .
pub fn rate_in_parallel<E, F>(self,
                                  evaluator: &E,
                                  pool: &mut Pool,
                                  chunk_size: usize)
                                  -> RatedPopulation<I, F>
        where E: Evaluator<I, F>,
              F: PartialOrd + Send + Default
    {
        let len = self.population.len();
        let mut rated_population: Vec<(I, F)> = self.population
                                                    .into_iter()
                                                    .map(|ind| {
                                                        let fitness = F::default();
                                                        (ind, fitness)
                                                    })
                                                    .collect();
        pool.for_(rated_population.chunks_mut(chunk_size), |chunk| {
            for &mut (ref ind, ref mut fitness) in chunk.iter_mut() {
                *fitness = evaluator.fitness(ind);
            }
        });
        debug_assert!(rated_population.len() == len);
        RatedPopulation { rated_population: rated_population }
    }
pub fn rate_in_parallel < E , F > ( self , evaluator : & E , pool : & mut Pool , chunk_size : usize ) -> RatedPopulation < I , F > where E : Evaluator < I , F > , F : PartialOrd + Send + Default { let len = self . population . len ( ) ; let mut rated_population : Vec < ( I , F ) > = self . population . into_iter ( ) . map ( | ind | { let fitness = F :: default ( ) ; ( ind , fitness ) } ) . collect ( ) ; pool . for_ ( rated_population . chunks_mut ( chunk_size ) , | chunk | { for & mut ( ref ind , ref mut fitness ) in chunk . iter_mut ( ) { * fitness = evaluator . fitness ( ind ) ; } } ) ; debug_assert ! ( rated_population len ( ) len ) ; RatedPopulation { rated_population : rated_population } }
Evaluate the population in parallel using the threadpool `pool`.
Evaluate the population in parallel using the threadpool ` pool ` .
self
evaluator
&E
pool
&mut Pool
chunk_size
usize