Skip to content

Commit 5788b15

Browse files
committed
update exact strategy life cycles
1 parent 563df6d commit 5788b15

3 files changed

Lines changed: 60 additions & 28 deletions

File tree

src/strategy/evolve.rs

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -56,34 +56,6 @@ pub enum EvolveVariant {
5656
/// * Scale down after max_generations or max_stale_generations is reached and reset scale_generations and stale_generations to zero
5757
/// * Only trigger max_generations or max_stale_generations ending condition when already reached the smallest scale
5858
///
59-
/// Below is the exact order of actions and hooks
60-
/// * [reporter](crate::strategy::reporter) on_enter hook
61-
/// * setup
62-
/// * [reporter](crate::strategy::reporter) on_start hook
63-
/// * loop while not finished
64-
/// * increment generation
65-
/// * (before selection) filter by age
66-
/// * [select](crate::select)
67-
/// * (after selection) update population cardinality
68-
/// * [reporter](crate::strategy::reporter) on_selection_complete hook
69-
/// * [extension](crate::extension) after_selection_complete hook
70-
/// * (before crossover) increment age
71-
/// * [crossover](crate::crossover)
72-
/// * [reporter](crate::strategy::reporter) on_crossover_complete hook
73-
/// * [extension](crate::extension) after_crossover_complete hook
74-
/// * [mutate](crate::mutate)
75-
/// * [reporter](crate::strategy::reporter) on_mutation_complete hook
76-
/// * [extension](crate::extension) after_mutation_complete hook
77-
/// * [fitness](crate::fitness) calculation
78-
/// * store best chromosome
79-
/// * [reporter](crate::strategy::reporter) on_generation_complete hook
80-
/// * [extension](crate::extension) after_generation_complete hook
81-
/// * scale and reset ending conditions for new scale
82-
/// * check ending conditions
83-
/// * [reporter](crate::strategy::reporter) on_finish hook
84-
/// * cleanup
85-
/// * [reporter](crate::strategy::reporter) on_exit hook
86-
///
8759
/// General Hyper-parameters:
8860
/// * `replacement_rate` (selection): the target fraction of the population which exists of
8961
/// children. Generational Replacement and Steady-State Replacement can both be
@@ -129,6 +101,34 @@ pub enum EvolveVariant {
129101
/// be immediately selected out. This gives the false impression of good cardinality while there is
130102
/// actually little.
131103
///
104+
/// Below is the exact order of actions and hooks
105+
/// * [reporter](crate::strategy::reporter) on_enter hook
106+
/// * setup
107+
/// * [reporter](crate::strategy::reporter) on_start hook
108+
/// * loop while not finished
109+
/// * increment generation
110+
/// * (before selection) filter by age
111+
/// * [select](crate::select)
112+
/// * (after selection) update population cardinality
113+
/// * [reporter](crate::strategy::reporter) on_selection_complete hook
114+
/// * [extension](crate::extension) after_selection_complete hook
115+
/// * (before crossover) increment age
116+
/// * [crossover](crate::crossover)
117+
/// * [reporter](crate::strategy::reporter) on_crossover_complete hook
118+
/// * [extension](crate::extension) after_crossover_complete hook
119+
/// * [mutate](crate::mutate)
120+
/// * [reporter](crate::strategy::reporter) on_mutation_complete hook
121+
/// * [extension](crate::extension) after_mutation_complete hook
122+
/// * [fitness](crate::fitness) calculation
123+
/// * update best chromosome
124+
/// * [reporter](crate::strategy::reporter) on_generation_complete hook
125+
/// * [extension](crate::extension) after_generation_complete hook
126+
/// * scale and reset ending conditions for new scale
127+
/// * check ending conditions
128+
/// * [reporter](crate::strategy::reporter) on_finish hook
129+
/// * cleanup
130+
/// * [reporter](crate::strategy::reporter) on_exit hook
131+
///
132132
/// From the [EvolveBuilder] level, there are several calling mechanisms:
133133
/// * [call](EvolveBuilder::call): this runs a single evolve strategy
134134
/// * [call_repeatedly](EvolveBuilder::call_repeatedly): this runs multiple independent evolve

src/strategy/hill_climb.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,22 @@ pub enum HillClimbVariant {
9696
/// [StrategyReporter] (e.g. [HillClimbReporterDuration], [HillClimbReporterSimple]). But you are encouraged to
9797
/// roll your own, see [StrategyReporter].
9898
///
99+
/// Below is the exact order of actions and hooks
100+
/// * [reporter](crate::strategy::reporter) on_enter hook
101+
/// * setup
102+
/// * [reporter](crate::strategy::reporter) on_start hook
103+
/// * loop while not finished
104+
/// * increment generation
105+
/// * set new neighbouring working chromosome or population
106+
/// * [fitness](crate::fitness) calculation
107+
/// * update best chromosome
108+
/// * [reporter](crate::strategy::reporter) on_generation_complete hook
109+
/// * scale and reset ending conditions for new scale
110+
/// * check ending conditions
111+
/// * [reporter](crate::strategy::reporter) on_finish hook
112+
/// * cleanup
113+
/// * [reporter](crate::strategy::reporter) on_exit hook
114+
///
99115
/// From the [HillClimbBuilder] level, there are several calling mechanisms:
100116
/// * [call](HillClimbBuilder::call): this runs a single [HillClimb] strategy
101117
/// * [call_repeatedly](HillClimbBuilder::call_repeatedly): this runs multiple independent [HillClimb]

src/strategy/permutate.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,22 @@ pub enum PermutateVariant {
5959
/// [StrategyReporter] (e.g. [PermutateReporterDuration], [PermutateReporterSimple]). But you are encouraged to
6060
/// roll your own, see [StrategyReporter].
6161
///
62+
/// Below is the exact order of actions and hooks
63+
/// * [reporter](crate::strategy::reporter) on_enter hook
64+
/// * setup
65+
/// * [reporter](crate::strategy::reporter) on_start hook
66+
/// * loop while not finished
67+
/// * (parallel) iterate over chromosomes
68+
/// * increment generation
69+
/// * [fitness](crate::fitness) calculation
70+
/// * update best chromosome
71+
/// * [reporter](crate::strategy::reporter) on_generation_complete hook
72+
/// * scale and reset ending conditions for new scale
73+
/// * check ending conditions
74+
/// * [reporter](crate::strategy::reporter) on_finish hook
75+
/// * cleanup
76+
/// * [reporter](crate::strategy::reporter) on_exit hook
77+
///
6278
/// See [PermutateBuilder] for initialization options.
6379
///
6480
/// All multithreading mechanisms are implemented using [rayon::iter] and [std::sync::mpsc].

0 commit comments

Comments
 (0)