Skip to content

Commit

Permalink
Drop assertion on even population size in GeneticSolver::new
Browse files Browse the repository at this point in the history
Closes #479
  • Loading branch information
kkafar committed May 1, 2024
1 parent a380320 commit a2abda5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 0 additions & 2 deletions src/ga.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,6 @@ where
pub fn new(
config: GAConfig<IndividualT, MutOpT, CrossOpT, SelOpT, ReplOpT, PopGenT, FitnessT, ProbeT>,
) -> Self {
assert_eq!(config.params.population_size % 2, 0); // Required for most of operators right
// now
GeneticSolver {
config,
metadata: Metrics::new(None, None, 0),
Expand Down
4 changes: 2 additions & 2 deletions src/ga/operators/selection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ pub trait SelectionOperator<IndividualT: IndividualTrait> {
///
/// ### Arguments
///
/// * `metadata` - [crate::ga::GAMetadata] information on current stage of the algorithm (iteration, elapsed time, etc.)
/// * `metrics` - [crate::ga::Metrics] information on current stage of the algorithm (iteration, elapsed time, etc.)
/// * `population` - individuals to choose mating pool from
/// * `count` - target number of individuals in mating pool
fn apply<'a>(
&mut self,
metadata: &Metrics,
metrics: &Metrics,
population: &'a [IndividualT],
count: usize,
) -> Vec<&'a IndividualT>;
Expand Down

0 comments on commit a2abda5

Please sign in to comment.