1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
//! # `operators` – Building Blocks for Evolution
//!
//! Every evolutionary algorithm in **moors** is assembled from a *pipeline* of
//! interchangeable **operators**. Each operator focuses on a single stage of
//! the evolutionary cycle—sampling an initial population, creating offspring,
//! selecting parents, evaluating diversity, and so on.
//!
//! | Trait | Purpose | Typical Implementations |
//! |-------|---------|-------------------------|
//! | [`SamplingOperator`] | Generate an initial population of genomes. | `RandomSamplingBinary`, `RandomSamplingFloat`, … |
//! | [`CrossoverOperator`] | Combine two (or more) parents to create offspring. | `SinglePointBinaryCrossover`, `SimulatedBinaryCrossover`, ... |
//! | [`MutationOperator`] | Apply random variation to a single genome *in‑place*. | `BitFlipMutation`, `GaussianMutation`, `ScrambleMutation`, ... |
//! | [`SelectionOperator`] | Choose parents via tournaments, fitness‑proportionate schemes, etc. | `RankAndScoringSelection`, `RandomSelection`, ... |
//! | [`SurvivalOperator`] | Decide which individuals survive to the next generation. | `FrontsAndRankingBasedSurvival`, `Nsga3ReferencePointsSurvival`, ... |
//!
//! ```rust
//! use ndarray::ArrayViewMut1;
//!
//! use moors::{
//! operators::MutationOperator,
//! random::RandomGenerator,
//! };
//!
//! /// Flips each binary gene with probability `gene_mutation_rate`.
//! #[derive(Debug, Clone)]
//! pub struct MyMutation {
//! pub gene_mutation_rate: f64,
//! }
//!
//! impl MyMutation {
//! pub fn new(rate: f64) -> Self {
//! Self { gene_mutation_rate: rate }
//! }
//! }
//!
//! impl MutationOperator for MyMutation {
//! fn mutate<'a>(
//! &self,
//! mut individual:ArrayViewMut1<'a, f64>,
//! rng: &mut impl RandomGenerator,
//! ) {
//! for gene in individual.iter_mut() {
//! if rng.gen_bool(self.gene_mutation_rate) {
//! *gene = if *gene == 0.0 { 1.0 } else { 0.0 };
//! }
//! }
//! }
//! }
//! ```
//!
//! Once compiled, you can pass `MyMutation` into any `*Builder` just like the
//! built‑in operators.
//!
//! ## Module layout
//!
//! * [`crossover`] – crossover operators
//! * [`mutation`] – mutation operators
//! * [`sampling`] – initial population generators
//! * [`selection`] – parent‑selection strategies
//! * [`survival`] – survival / environmental‑selection strategies
//! * [`evolve`] – glue code to run *selection → crossover → mutation*
//!
//! ---
//!
//! **Tip:** Because every operator is trait‑based, you can unit‑test them in
//! isolation or swap them at runtime to benchmark different evolutionary
//! dynamics without touching your problem‑specific code or algorithm builder.
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;