#[cfg(test)] mod lib_tests { use genetic_algorithm::fitness::placeholders::CountTrue; use genetic_algorithm::strategy::evolve::prelude::*; use genetic_algorithm_meta::prelude::*; #[test] fn general() { let rounds = 5; let target_population_sizes = vec![1, 2, 3, 4, 5]; let max_stale_generations_options = vec![Some(10)]; let mutates = vec![ MutateOnce::new(0.1).into(), MutateOnce::new(0.2).into(), MutateOnce::new(0.3).into(), ]; let crossovers = vec![ CrossoverSingleGene::new(true).into(), CrossoverSingleGene::new(false).into(), CrossoverSinglePoint::new(true).into(), ]; let competes = vec![CompeteElite::new().into(), CompeteTournament::new(4).into()]; let extensions = vec![ ExtensionNoop::new().into(), ExtensionMassDegeneration::new(0.9, 10).into(), ExtensionMassExtinction::new(0.9, 0.1).into(), ExtensionMassGenesis::new(0.9).into(), ExtensionMassInvasion::new(0.9, 0.1).into(), ]; let genotype = BinaryGenotype::builder() .with_genes_size(10) .build() .unwrap(); let fitness = CountTrue; let evolve_builder = EvolveBuilder::new() .with_genotype(genotype) .with_fitness(fitness); let evolve_fitness_to_micro_second_factor = 1_000_000; let config = MetaConfig::builder() .with_evolve_builder(evolve_builder) .with_evolve_fitness_to_micro_second_factor(evolve_fitness_to_micro_second_factor) .with_rounds(rounds) .with_target_population_sizes(target_population_sizes) .with_max_stale_generations_options(max_stale_generations_options) .with_mutates(mutates) .with_crossovers(crossovers) .with_competes(competes) .with_extensions(extensions) .build() .unwrap(); let permutate = MetaPermutate::new(&config).call(); println!(); println!("{}", permutate); assert!(permutate.inner_permutate.is_some()); assert!(permutate .inner_permutate .unwrap() .best_chromosome() .is_some()); } }