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: GenePoolGene pool for creating/mutating chromosomes.
rng: StdRngSeeded random number generator.
cache: LruCache<String, OracleVerdict>Payload→verdict LRU cache.
budget: BudgetHard budget limits.
in_flight: HashMap<u64, (Chromosome, Instant)>Candidates currently being evaluated: ID → (Chromosome, sent_at).
stats: SearchStatsSearch statistics.
target_health: TargetHealthMonitorTarget health monitor.
checkpoint_path: Option<PathBuf>Optional path for automatic checkpointing.
request_count: usizeTotal 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: u32Number of consecutive generations with no improvement.
corpus: BypassCorpusSaved bypass corpus.
Implementations§
Source§impl EvolutionEngine
impl EvolutionEngine
Sourcepub fn new(population_size: usize) -> Self
pub fn new(population_size: usize) -> Self
Create a new engine with the given algorithm and population size.
Sourcepub fn new_seeded(population_size: usize, seed: u64) -> Self
pub fn new_seeded(population_size: usize, seed: u64) -> Self
Create a new engine with a seeded RNG.
Sourcepub fn with_algorithm(
algorithm_name: &str,
gene_pool: GenePool,
rng: StdRng,
budget: Budget,
) -> Result<Self, EvolutionError>
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.
Sourcepub fn next_candidate(&mut self) -> Option<(usize, &Chromosome)>
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.
Sourcepub fn batch_candidates(&mut self, n: usize) -> Vec<(usize, Chromosome)>
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.
Sourcepub fn submit_batch(
&mut self,
results: Vec<(usize, OracleVerdict)>,
) -> Result<(), EvolutionError>
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.
Sourcepub fn record_feedback(
&mut self,
chromosome_index: usize,
passed: bool,
) -> Result<(), EvolutionError>
pub fn record_feedback( &mut self, chromosome_index: usize, passed: bool, ) -> Result<(), EvolutionError>
Record legacy boolean feedback for a candidate.
Sourcepub fn record_verdict(
&mut self,
chromosome_index: usize,
verdict: &OracleVerdict,
) -> Result<(), EvolutionError>
pub fn record_verdict( &mut self, chromosome_index: usize, verdict: &OracleVerdict, ) -> Result<(), EvolutionError>
Record rich oracle verdict feedback.
Sourcepub fn record_target_error(
&mut self,
error: String,
) -> Result<(), EvolutionError>
pub fn record_target_error( &mut self, error: String, ) -> Result<(), EvolutionError>
Record target-error feedback.
Sourcepub fn should_terminate(&self) -> bool
pub fn should_terminate(&self) -> bool
Check if evolution should terminate.
Sourcepub fn best(&self) -> Option<&Chromosome>
pub fn best(&self) -> Option<&Chromosome>
Get the best-performing chromosome.
Sourcepub fn save_checkpoint(&self, path: &Path) -> Result<(), EvolutionError>
pub fn save_checkpoint(&self, path: &Path) -> Result<(), EvolutionError>
Save engine state to disk.
Sourcepub fn load_checkpoint(&mut self, path: &Path) -> Result<(), EvolutionError>
pub fn load_checkpoint(&mut self, path: &Path) -> Result<(), EvolutionError>
Load engine state from disk.
Sourcepub fn learned_summary(&self) -> String
pub fn learned_summary(&self) -> String
Get a human-readable summary.
Sourcepub fn diversity_score(&self) -> f64
pub fn diversity_score(&self) -> f64
Compute diversity score using algorithm population if available.