Skip to content

Commit 60481b5

Browse files
committed
remove remaining MutationType::Transition usage in examples
1 parent 2033117 commit 60481b5

2 files changed

Lines changed: 20 additions & 11 deletions

File tree

examples/evolve_large_genotype.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ fn main() {
3232
.with_allele_range(ALLELE_RANGE)
3333
// .with_mutation_type(MutationType::Random) // not needed, is default
3434
// .with_mutation_type(MutationType::Range(0.1))
35-
// .with_mutation_type(MutationType::Transition(100, 400, 0.1))
3635
.with_genes_hashing(true)
3736
.with_chromosome_recycling(true)
3837
.build()

examples/evolve_range_float.rs

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,23 +27,33 @@ fn main() {
2727

2828
let genotype = RangeGenotype::<f32>::builder()
2929
.with_genes_size(GENES_SIZE)
30-
.with_allele_range(0.0..=1.0) // won't converge with low max_stale_generations, converges just fine with higher max_stale_generations, but very ineffecient
30+
.with_allele_range(0.0..=1.0)
31+
// won't converge with low max_stale_generations, converges just fine with higher max_stale_generations, but very ineffecient
3132
// .with_mutation_type(MutationType::Random) // not needed, is default
32-
// .with_mutation_type(MutationType::Range(0.1)) // converges slowly
33-
// .with_mutation_type(MutationType::Transition(1000, 1000, 0.1)) // converges slowly
34-
.with_mutation_type(MutationType::StepScaled(vec![
35-
0.1, 0.01, 0.001, 0.0001, 0.00001,
36-
])) // converges fast, but needs low max_stale_generations to trigger next scale
33+
//
34+
// converges slowly, needs high max_stale_generations
35+
// .with_mutation_type(MutationType::Range(0.1))
36+
//
37+
// converges slowly, needs high max_stale_generations, which is also the trigger to scale
38+
// down, so problematic approach here.
39+
// .with_mutation_type(MutationType::RangeScaled(vec![1.0, 1.0, 0.1, 0.01, 0.001]))
40+
//
41+
// converges slowly, needs high max_stale_generations
42+
// .with_mutation_type(MutationType::Step(0.001))
43+
//
44+
// best approach for this problem
45+
// converges fast, but needs low max_stale_generations to trigger next scale
46+
.with_mutation_type(MutationType::StepScaled(vec![0.1, 0.01, 0.001, 0.0001]))
3747
.build()
3848
.unwrap();
3949

4050
println!("{}", genotype);
4151

42-
let evolve = Evolve::builder()
52+
let _evolve = Evolve::builder()
4353
.with_genotype(genotype)
4454
.with_target_population_size(POPULATION_SIZE)
45-
.with_max_stale_generations(100)
46-
// .with_max_stale_generations(100_000)
55+
// .with_max_stale_generations(100)
56+
.with_max_stale_generations(100_000)
4757
.with_target_fitness_score(POPULATION_SIZE as isize * 100)
4858
.with_fitness(DistanceTo(0.55555, 1e-5))
4959
.with_fitness_ordering(FitnessOrdering::Minimize)
@@ -54,5 +64,5 @@ fn main() {
5464
.call()
5565
.unwrap();
5666

57-
println!("{}", evolve);
67+
// println!("{}", evolve);
5868
}

0 commit comments

Comments
 (0)