use super::Evolver;

use crate::boolnet::Boolnet;

impl Evolver {
    /// Resets population.
    pub fn reset(&mut self) -> Result<(), String> {
        let bn = & self.population[0];
        let (n, height, size, rands, layers, cycles) = (self.population.len(), bn.height(), bn.size(), bn.rands(), bn.layers(), bn.cycles());

        self.population.clear();
        for _ in 0..n {
            self.population.push(Boolnet::new_rand(height, size, rands, layers, cycles));
        }

        self.counters.epoch = 0;
        // Don't evolve, because all boolnets are unscored (score = -inf) and thus "sorted" already

        Ok(())
    }

}
