#[derive(Debug, Clone, Copy, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct ExtensionConfiguration {
pub method: crate::operations::Extension,
pub diversity_threshold: f64,
pub survival_rate: f64,
pub mutation_rounds: usize,
pub elite_count: usize,
}
impl Default for ExtensionConfiguration {
fn default() -> Self {
ExtensionConfiguration {
method: crate::operations::Extension::Noop,
diversity_threshold: 0.01,
survival_rate: 0.1,
mutation_rounds: 3,
elite_count: 1,
}
}
}
impl ExtensionConfiguration {
pub fn new() -> Self {
Self::default()
}
pub fn with_method(mut self, method: crate::operations::Extension) -> Self {
self.method = method;
self
}
pub fn with_diversity_threshold(mut self, threshold: f64) -> Self {
self.diversity_threshold = threshold;
self
}
pub fn with_survival_rate(mut self, rate: f64) -> Self {
self.survival_rate = rate;
self
}
pub fn with_mutation_rounds(mut self, rounds: usize) -> Self {
self.mutation_rounds = rounds;
self
}
pub fn with_elite_count(mut self, count: usize) -> Self {
self.elite_count = count;
self
}
}