use crate::chromosomes::ChromosomeLength;
use crate::configuration::LocalSearchConfiguration;
use crate::configuration::ProblemSolving;
use crate::operations::{Crossover, Extension, Mutation, Selection, Survivor};
pub trait SelectionConfig {
fn with_number_of_couples(self, number_of_couples: usize) -> Self;
fn with_selection_method(self, selection_method: Selection) -> Self;
fn with_niche_radius(self, niche_radius: f64) -> Self;
fn with_epsilon_lexicase(self, epsilon: f64) -> Self;
}
pub trait CrossoverConfig {
fn with_crossover_number_of_points(self, number_of_points: usize) -> Self;
fn with_crossover_probability_max(self, probability_max: f64) -> Self;
fn with_crossover_probability_min(self, probability_min: f64) -> Self;
fn with_crossover_method(self, method: Crossover) -> Self;
fn with_sbx_eta(self, eta: f64) -> Self;
fn with_blend_alpha(self, alpha: f64) -> Self;
fn with_undx_sigma_xi(self, value: f64) -> Self;
fn with_undx_sigma_eta(self, value: f64) -> Self;
fn with_pcx_sigma_eta(self, value: f64) -> Self;
fn with_pcx_sigma_zeta(self, value: f64) -> Self;
}
pub trait MutationConfig {
fn with_mutation_probability_max(self, probability_max: f64) -> Self;
fn with_mutation_probability_min(self, probability_min: f64) -> Self;
fn with_mutation_method(self, method: Mutation) -> Self;
fn with_dynamic_mutation(self, enabled: bool) -> Self;
fn with_mutation_target_cardinality(self, target: f64) -> Self;
fn with_mutation_probability_step(self, step: f64) -> Self;
}
pub trait SurvivorConfig {
fn with_length_penalty(self, penalty: f64) -> Self;
}
pub trait StoppingConfig {
fn with_max_generations(self, max_generations: usize) -> Self;
fn with_fitness_target(self, fitness_target: f64) -> Self;
fn with_stagnation_limit(self, n: usize) -> Self;
fn with_convergence_threshold(self, threshold: f64) -> Self;
fn with_max_duration_secs(self, secs: f64) -> Self;
}
pub trait NichingConfig {
fn with_niching_enabled(self, enabled: bool) -> Self;
fn with_niching_sigma_share(self, sigma_share: f64) -> Self;
fn with_niching_alpha(self, alpha: f64) -> Self;
}
pub trait ElitismConfig {
fn with_elitism(self, elitism_count: usize) -> Self;
}
pub trait ExtensionConfig {
fn with_extension_method(self, method: Extension) -> Self;
fn with_extension_diversity_threshold(self, threshold: f64) -> Self;
fn with_extension_survival_rate(self, rate: f64) -> Self;
fn with_extension_mutation_rounds(self, rounds: usize) -> Self;
fn with_extension_elite_count(self, count: usize) -> Self;
}
pub trait LocalSearchConfig {
fn with_local_search_configuration(self, config: LocalSearchConfiguration) -> Self;
}
pub trait ConfigurationT:
SelectionConfig
+ CrossoverConfig
+ MutationConfig
+ StoppingConfig
+ NichingConfig
+ ElitismConfig
+ ExtensionConfig
+ LocalSearchConfig
+ SurvivorConfig
{
fn new() -> Self;
fn with_adaptive_ga(self, adaptive_ga: bool) -> Self;
fn with_threads(self, number_of_threads: usize) -> Self;
fn with_survivor_method(self, method: Survivor) -> Self;
fn with_problem_solving(self, problem_solving: ProblemSolving) -> Self;
fn with_population_size(self, population_size: usize) -> Self;
fn with_chromosome_length(self, length: ChromosomeLength) -> Self;
fn with_save_progress(self, save_progress: bool) -> Self;
fn with_save_progress_interval(self, save_progress_interval: usize) -> Self;
fn with_save_progress_path(self, save_progress_path: String) -> Self;
fn with_rng_seed(self, seed: u64) -> Self;
fn with_crossover_portfolio(self, portfolio: Vec<Crossover>) -> Self;
fn with_mutation_portfolio(self, portfolio: Vec<Mutation>) -> Self;
fn with_aos_strategy(self, strategy: crate::aos::AosStrategy) -> Self;
fn with_reward_window(self, window: usize) -> Self;
}