Skip to main content

EvolutionEngine

Struct EvolutionEngine 

Source
pub struct EvolutionEngine {
Show 13 fields pub gene_pool: GenePool, pub rng: StdRng, pub cache: LruCache<String, OracleVerdict>, pub budget: Budget, pub in_flight: HashMap<u64, (Chromosome, Instant)>, pub stats: SearchStats, pub target_health: TargetHealthMonitor, pub checkpoint_path: Option<PathBuf>, pub request_count: usize, pub gene_stats: Vec<(String, String, u32, u32)>, pub fitness_history: Vec<f64>, pub stagnation_counter: u32, pub corpus: BypassCorpus, /* private fields */
}
Expand description

The evolutionary engine that maintains a population and evolves it.

Fields§

§gene_pool: GenePool

Gene pool for creating/mutating chromosomes.

§rng: StdRng

Seeded random number generator.

§cache: LruCache<String, OracleVerdict>

Payload→verdict LRU cache.

§budget: Budget

Hard budget limits.

§in_flight: HashMap<u64, (Chromosome, Instant)>

Candidates currently being evaluated: ID → (Chromosome, sent_at).

§stats: SearchStats

Search statistics.

§target_health: TargetHealthMonitor

Target health monitor.

§checkpoint_path: Option<PathBuf>

Optional path for automatic checkpointing.

§request_count: usize

Total oracle requests issued.

§gene_stats: Vec<(String, String, u32, u32)>

Per-gene success tracking: (gene_name, gene_value, successes, attempts).

§fitness_history: Vec<f64>

Fitness history: average fitness per generation (sliding window).

§stagnation_counter: u32

Number of consecutive generations with no improvement.

§corpus: BypassCorpus

Saved bypass corpus.

Implementations§

Source§

impl EvolutionEngine

Source

pub fn new(population_size: usize) -> Self

Create a new engine with the given algorithm and population size.

Source

pub fn new_seeded(population_size: usize, seed: u64) -> Self

Create a new engine with a seeded RNG.

Source

pub fn with_algorithm( algorithm_name: &str, gene_pool: GenePool, rng: StdRng, budget: Budget, ) -> Result<Self, EvolutionError>

Create an engine with a specific algorithm by name.

Source

pub fn next_candidate(&mut self) -> Option<(usize, &Chromosome)>

Get the next candidate to try (legacy sequential API).

Returns a synthetic index and a reference to the stored candidate.

Source

pub fn batch_candidates(&mut self, n: usize) -> Vec<(usize, Chromosome)>

Request a batch of up to n candidates for parallel evaluation.

Checks cache, budget, and target health before returning candidates.

Source

pub fn submit_batch( &mut self, results: Vec<(usize, OracleVerdict)>, ) -> Result<(), EvolutionError>

Submit a batch of evaluation results.

§Errors

Returns an error if an evaluation ID is not in the in-flight set.

Source

pub fn record_feedback( &mut self, chromosome_index: usize, passed: bool, ) -> Result<(), EvolutionError>

Record legacy boolean feedback for a candidate.

Source

pub fn record_verdict( &mut self, chromosome_index: usize, verdict: &OracleVerdict, ) -> Result<(), EvolutionError>

Record rich oracle verdict feedback.

Source

pub fn record_target_error( &mut self, error: String, ) -> Result<(), EvolutionError>

Record target-error feedback.

Source

pub fn evolve(&mut self)

Evolve the population to the next generation.

Source

pub fn should_terminate(&self) -> bool

Check if evolution should terminate.

Source

pub fn best(&self) -> Option<&Chromosome>

Get the best-performing chromosome.

Source

pub fn save_checkpoint(&self, path: &Path) -> Result<(), EvolutionError>

Save engine state to disk.

Source

pub fn load_checkpoint(&mut self, path: &Path) -> Result<(), EvolutionError>

Load engine state from disk.

Source

pub fn gene_success_rates(&self) -> Vec<(&str, &str, f64)>

Get per-gene success rates.

Source

pub fn learned_summary(&self) -> String

Get a human-readable summary.

Source

pub fn diversity_score(&self) -> f64

Compute diversity score using algorithm population if available.

Trait Implementations§

Source§

impl Clone for EvolutionEngine

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for EvolutionEngine

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more