pub struct MutationSuite {
pub strategies: Vec<(Box<dyn MutationStrategy>, f32)>,
}
Expand description
A collection of weighted mutation strategies.
This struct allows for combining multiple mutation algorithms into a single operation. The probability of any given strategy being chosen is proportional to its assigned weight.
Fields§
§strategies: Vec<(Box<dyn MutationStrategy>, f32)>
A vector of tuples, each containing a boxed MutationStrategy
and its f32
weight.
Implementations§
Source§impl MutationSuite
impl MutationSuite
Sourcepub fn add_strategy<S: MutationStrategy + 'static>(
&mut self,
strategy: S,
weight: f32,
)
pub fn add_strategy<S: MutationStrategy + 'static>( &mut self, strategy: S, weight: f32, )
Adds a new mutation strategy to the suite with a specified weight.
§Type Parameters
S
: A type that implementsMutationStrategy
and has a static lifetime.
Sourcepub fn mutate(&self, field: &FractalField) -> FractalField
pub fn mutate(&self, field: &FractalField) -> FractalField
Mutates the given FractalField
by selecting and applying one of the strategies.
The selection is random, with the chance of each strategy being picked determined by its weight relative to the total weight of all strategies.
If no strategies are present, it returns a clone of the original field as a fallback.
Trait Implementations§
Source§impl Default for MutationSuite
impl Default for MutationSuite
Source§fn default() -> MutationSuite
fn default() -> MutationSuite
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for MutationSuite
impl !RefUnwindSafe for MutationSuite
impl !Send for MutationSuite
impl !Sync for MutationSuite
impl Unpin for MutationSuite
impl !UnwindSafe for MutationSuite
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Resonance for Twhere
T: Default + 'static,
impl<T> Resonance for Twhere
T: Default + 'static,
Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
A helper method to allow for runtime type checking (downcasting).
This is essential for methods like
resonance_similarity
that need to know
the concrete type of the other
object.Source§fn resonance_score(&self) -> f64
fn resonance_score(&self) -> f64
Returns a scalar score representing the object’s intrinsic resonance.
Higher scores typically mean more “resonant” or coherent states.
Source§fn resonance_similarity(&self, _other: &dyn Resonance) -> f64
fn resonance_similarity(&self, _other: &dyn Resonance) -> f64
Compares the resonance of this object with another. Read more
Source§fn resonance_law(&self) -> ResonanceLaw
fn resonance_law(&self) -> ResonanceLaw
Classifies the resonance pattern or law governing this object.
Source§fn is_resonant_with(&self, other: &dyn Resonance) -> bool
fn is_resonant_with(&self, other: &dyn Resonance) -> bool
Returns
true
if the resonance similarity with another object exceeds a threshold.