Skip to content

Commit 543417e

Browse files
committed
Update CHANGELOG
1 parent 4088c6f commit 543417e

4 files changed

Lines changed: 54 additions & 6 deletions

File tree

CHANGELOG.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77
## [0.25.0] - 2025-11-12
88

99
### Changed
10-
* (naming only) Refactor `MutationType::ScaledSteps(Vec<T>)` to `MutationType::StepScaled(Vec<T>)` for naming consistency
11-
* (naming only) Refactor `MutationType::RelativeRange(T)` to `MutationType::Range(T)` as `MutationType::Step(T)` is also relative.
10+
* (naming only) Refactor `MutationType::ScaledSteps(Vec<T>)` to
11+
`MutationType::StepScaled(Vec<T>)` for naming consistency
12+
* (naming only) Refactor `MutationType::RelativeRange(T)` to
13+
`MutationType::Range(T)` as `MutationType::Step(T)` is also relative.
1214
* Refactor `MutationType::Transition(usize, usize, T)` to `MutationType::RangeScaled(Vec<T>)`:
1315
* Drop the generation based transition configuration params
1416
* Replace params with bandwidth per scale (just like step-size per scale StepScaled)
@@ -21,13 +23,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2123
* Ending condition for current scale, go to next scale and restart counting generations
2224
* Final ending condition if no scales left (or no scaling at all)
2325
* Support unsigned integers for `MutationType::Range` and `MutationType::Step` as well (and scaled versions)
24-
* Allow for zero bandwidth in `MutationType::Range` (and scaled), which lets the mutation die out
26+
* Allow for zero bandwidth/step in `MutationType::Range` and
27+
`MutationType::Step` (and scaled versions), which lets the mutation die out
2528
* Add `examples/visualize_evolve_mutation_types` and `examples/visualize_permutate_mutation_types`, which
2629
generate visualizations showing exploration patterns of different mutation strategies
2730

2831
### Remove
2932
* Remove `increment_generation()` and `reset_generation()` from `Genotype` and remove hook
30-
in Strategies, as all is not scale based.
33+
in Strategies, as all scaled MutationTypes now work in the same manner
3134
* Remove unused `Vec<Chromosome<T>>` into `Population<T>` implementation
3235

3336
## [0.24.0] - 2025-11-05

src/genotype/mutation_type.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,10 @@ use crate::allele::Allele;
109109
/// same bandwidth value. You could also alternate between exploration and exploitation several
110110
/// times (provide alternating high & low bandwidths in the scales)
111111
///
112+
/// It is a good idea to use a prolonged period of full Random sampling (exploration phase, so
113+
/// several 100% bandwidth scales), which then transitions quite fast to the smaller bandwidths
114+
/// (exploitation phase, a few smaller bandwidth scales).
115+
///
112116
/// ## `StepScaled(Vec<T>)`
113117
/// Multi-phase step mutation with strategy-controlled progression. Like `RangeScaled`
114118
/// but uses fixed step sizes instead of uniform ranges. Mutations apply the step
@@ -216,12 +220,13 @@ use crate::allele::Allele;
216220
///
217221
/// All bandwidth and step values use the same type `T` as the genotype's allele type.
218222
/// This ensures type safety and intuitive behavior:
223+
/// - For `RangeGenotype<u32>`: Use integer bandwidths like `Range(10)` or `Step(5)`
219224
/// - For `RangeGenotype<i32>`: Use integer bandwidths like `Range(10)` or `Step(5)`
220225
/// - For `RangeGenotype<f64>`: Use float bandwidths like `Range(10.0)` or `Step(0.5)`
221226
///
222227
/// # Compatibility
223228
///
224-
/// * [RangeGenotype](crate::genotype::RangeGenotype): All variants except Discrete
229+
/// * [RangeGenotype](crate::genotype::RangeGenotype): All variants
225230
/// * [MultiRangeGenotype](crate::genotype::MultiRangeGenotype): All variants
226231
/// * Other genotypes use fixed mutation strategies (always Random)
227232
///

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@
139139
//! - **StepScaled**: Grid-like exploration with progressively finer resolution
140140
//! - **Discrete**: ListGenotype behaviour, for categories in heterogeneous genotypes
141141
//!
142-
//! Run the example with `cargo run --example visualize_mutation_types --release` to generate the visualization.
142+
//! Run the example with `cargo run --example visualize_evolve_mutation_types --release` to generate the visualization.
143143
//!
144144
//! ### Permutate Strategy (and HillClimb)
145145
//!

tests/genotype/range_test.rs

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,46 @@ fn float_mutate_chromosome_single_range_scaled_on_edge_and_zero_bandwidth() {
162162
));
163163
}
164164

165+
#[test]
166+
fn float_mutate_chromosome_single_step_scaled_on_edge_and_zero_bandwidth() {
167+
let mut rng = SmallRng::seed_from_u64(1);
168+
let mut genotype = RangeGenotype::builder()
169+
.with_genes_size(3)
170+
.with_allele_range(0.0..=1.0)
171+
.with_mutation_type(MutationType::StepScaled(vec![1.0, 0.1, 0.0, 0.0]))
172+
.build()
173+
.unwrap();
174+
175+
let mut chromosome = build::chromosome(vec![1.0, 0.0, 1.0]);
176+
177+
assert!(genotype.increment_scale_index());
178+
assert_eq!(genotype.current_scale_index, 1);
179+
genotype.mutate_chromosome_genes(3, false, &mut chromosome, &mut rng);
180+
assert!(relative_chromosome_eq(
181+
inspect::chromosome(&chromosome),
182+
vec![0.9, 0.1, 0.9],
183+
0.001,
184+
));
185+
186+
assert!(genotype.increment_scale_index());
187+
assert_eq!(genotype.current_scale_index, 2);
188+
genotype.mutate_chromosome_genes(3, false, &mut chromosome, &mut rng);
189+
assert!(relative_chromosome_eq(
190+
inspect::chromosome(&chromosome),
191+
vec![0.9, 0.1, 0.9],
192+
0.001,
193+
));
194+
195+
assert!(genotype.increment_scale_index());
196+
assert_eq!(genotype.current_scale_index, 3);
197+
genotype.mutate_chromosome_genes(3, false, &mut chromosome, &mut rng);
198+
assert!(relative_chromosome_eq(
199+
inspect::chromosome(&chromosome),
200+
vec![0.9, 0.1, 0.9],
201+
0.001,
202+
));
203+
}
204+
165205
#[test]
166206
fn float_mutate_chromosome_single_step() {
167207
let mut rng = SmallRng::seed_from_u64(0);

0 commit comments

Comments
 (0)