Skip to content

Commit 9d194b4

Browse files
committed
Some more review of docs
1 parent 8b07313 commit 9d194b4

5 files changed

Lines changed: 18 additions & 13 deletions

File tree

AGENTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ for diversity) or `CrossoverRejuvenate` (like Clone but optimized for less memor
108108
| `MutateMultiGene` | When faster exploration is needed. Multiple genes. |
109109
| `MutateMultiGeneRange` | When you want random variation in mutation count. |
110110
| `MutateSingleGeneDynamic` | Auto-adjusts probability based on population cardinality. |
111-
| `MutateMultiGeneDynamic` | Auto-adjusts count+probability based on cardinality. |
111+
| `MutateMultiGeneDynamic` | Auto-adjusts probability based on cardinality. Multiple genes. |
112112

113113
## Constructor Parameter Reference
114114

src/mutate/multi_gene_dynamic.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ impl<G: EvolveGenotype> Mutate for MultiGeneDynamic<G> {
8888
}
8989

9090
impl<G: EvolveGenotype> MultiGeneDynamic<G> {
91-
/// Create a new MultiGeneDynamic mutation strategy. Auto-adjusts mutation count and
92-
/// probability to maintain target population diversity (cardinality).
91+
/// Create a new MultiGeneDynamic mutation strategy. Auto-adjusts mutation probability
92+
/// to maintain target population diversity (cardinality).
9393
/// * `number_of_mutations` - max genes mutated per chromosome (sampled uniformly from 1..=n)
9494
/// * `mutation_probability_step` - step size for probability adjustment each generation
9595
/// * `target_cardinality` - target number of unique chromosomes in the population

src/select/elite.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@ use std::cmp::Reverse;
1010
use std::marker::PhantomData;
1111
use std::time::Instant;
1212

13-
/// Simply sort the chromosomes with fittest first. Then take the target_population_size (or full
14-
/// population when in shortage) of the populations best and drop excess chromosomes. This approach
15-
/// has the risk of locking in to a local optimum.
13+
/// Sort chromosomes by fitness in a multi-pass process: extract elite, partition into parents and
14+
/// offspring, select from each group separately based on replacement_rate, then do a final
15+
/// selection pass on the combined pool to reach target_population_size. Deterministic, but has the
16+
/// risk of locking in to a local optimum.
1617
#[derive(Clone, Debug)]
1718
pub struct Elite<G: EvolveGenotype> {
1819
_phantom: PhantomData<G>,

src/select/tournament.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@ use rand::prelude::*;
99
use std::marker::PhantomData;
1010
use std::time::Instant;
1111

12-
/// Run tournaments with randomly chosen chromosomes and pick a single winner. Do this untill the
13-
/// target_population_size (or full population when in shortage) of the population is reached and
14-
/// drop excess chromosomes. This approach kind of sorts the fitness first, but not very strictly.
15-
/// This preserves a level of diversity, which avoids local optimum lock-in.
12+
/// Run tournaments with randomly chosen chromosomes and pick a single winner. Uses the same
13+
/// multi-pass process as Elite (extract elite, partition parents/offspring, select separately,
14+
/// final pass), but uses tournament selection instead of sorting. This approach kind of sorts the
15+
/// fitness first, but not very strictly. This preserves a level of diversity, which avoids local
16+
/// optimum lock-in.
1617
#[derive(Clone, Debug)]
1718
pub struct Tournament<G: EvolveGenotype> {
1819
_phantom: PhantomData<G>,

src/strategy/evolve.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,12 @@ pub enum EvolveVariant {
5252
/// * max_stale_generations: when the ultimate goal in terms of fitness score is unknown and one depends on some convergion
5353
/// threshold, or one wants a duration limitation next to the target_fitness_score
5454
/// * max_generations: when the ultimate goal in terms of fitness score is unknown and there is a effort constraint
55-
/// * With a scaled [crate::genotype::MutationType]:
56-
/// * Scale down after max_generations or max_stale_generations is reached and reset scale_generations and stale_generations to zero
57-
/// * Only trigger max_generations or max_stale_generations ending condition when already reached the smallest scale
55+
/// * With a scaled [crate::genotype::MutationType] (e.g. RangeScaled, StepScaled):
56+
/// * When max_generations or max_stale_generations is reached, the current scale ends.
57+
/// If more scales remain, advance to the next scale and reset scale_generation and
58+
/// stale_generations to zero, then continue. If already at the smallest scale, the
59+
/// ending condition terminates the run.
60+
/// * Without scaled mutation types, ending conditions simply terminate the run.
5861
///
5962
/// General Hyper-parameters:
6063
/// * `replacement_rate` (selection): the target fraction of the population which exists of

0 commit comments

Comments
 (0)