use crate::configuration::ProblemSolving;
#[derive(Debug, Clone)]
pub struct ScatterConfiguration {
pub population_size: usize,
pub reference_set_size: usize,
pub max_iterations: usize,
pub local_search: bool,
pub local_search_steps: usize,
pub local_search_step_size: f64,
pub problem_solving: ProblemSolving,
pub fitness_target: Option<f64>,
}
impl Default for ScatterConfiguration {
fn default() -> Self {
Self {
population_size: 50,
reference_set_size: 10,
max_iterations: 100,
local_search: false,
local_search_steps: 20,
local_search_step_size: 0.1,
problem_solving: ProblemSolving::Minimization,
fitness_target: None,
}
}
}
impl ScatterConfiguration {
pub fn with_population_size(mut self, n: usize) -> Self {
self.population_size = n;
self
}
pub fn with_reference_set_size(mut self, b: usize) -> Self {
self.reference_set_size = b;
self
}
pub fn with_max_iterations(mut self, n: usize) -> Self {
self.max_iterations = n;
self
}
pub fn with_local_search(mut self, enabled: bool) -> Self {
self.local_search = enabled;
self
}
pub fn with_local_search_steps(mut self, steps: usize) -> Self {
self.local_search_steps = steps;
self
}
pub fn with_local_search_step_size(mut self, s: f64) -> Self {
self.local_search_step_size = s;
self
}
pub fn with_problem_solving(mut self, ps: ProblemSolving) -> Self {
self.problem_solving = ps;
self
}
pub fn with_fitness_target(mut self, t: f64) -> Self {
self.fitness_target = Some(t);
self
}
}