Skip to content

Commit

Permalink
create perform_generations method
Browse files Browse the repository at this point in the history
  • Loading branch information
HyperCodec committed Oct 1, 2024
1 parent bb324bc commit 92bcce1
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions genetic-rs-common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,13 @@ where
self.next_gen.next_gen(rewards)
});
}

/// Calls [`next_generation`][GeneticSim::next_generation] `count` number of times.
pub fn perform_generations(&mut self, count: usize) {
for _ in 0..count {
self.next_generation();
}
}
}

#[cfg(feature = "rayon")]
Expand Down Expand Up @@ -191,6 +198,13 @@ where
self.next_gen.next_gen(rewards)
});
}

/// Calls [`next_generation`][GeneticSim::next_generation] `count` number of times.
pub fn perform_generations(&mut self, count: usize) {
for _ in 0..count {
self.next_generation();
}
}
}

#[cfg(feature = "genrand")]
Expand Down

0 comments on commit 92bcce1

Please sign in to comment.