use crate::error::GaError;
use crate::traits::LinearChromosome;
pub trait RealValuedMutation: LinearChromosome {
fn polynomial_mutation(&mut self, _eta_m: f64) -> Result<(), GaError> {
Err(GaError::MutationError(
"Polynomial mutation requires Range<T> chromosomes where T is f64, f32, i32, or i64."
.to_string(),
))
}
fn cauchy_mutation(&mut self, _scale: f64) -> Result<(), GaError> {
Err(GaError::MutationError(
"Cauchy mutation requires Range<T> chromosomes where T is f64, f32, i32, or i64."
.to_string(),
))
}
fn levy_flight_mutation(&mut self, _alpha: f64) -> Result<(), GaError> {
Err(GaError::MutationError(
"Lévy Flight mutation requires Range<T> chromosomes where T is f64, f32, i32, or i64."
.to_string(),
))
}
fn uniform_mutation(&mut self) -> Result<(), GaError> {
Err(GaError::MutationError(
"Uniform mutation requires Range<T> chromosomes where T is f64, f32, i32, or i64."
.to_string(),
))
}
fn self_adaptive_gaussian_mutation(
&mut self,
_tau: f64,
_tau_prime: f64,
_sigma_min: f64,
_sigma_max: Option<f64>,
) -> Result<(), GaError> {
Err(GaError::MutationError(
"SelfAdaptiveGaussian requires a chromosome implementing SelfAdaptive (RangeChromosome<T>)."
.to_string(),
))
}
}