pub struct Candidate<G>where
G: EvolutionaryGenome,{
pub id: CandidateId,
pub genome: G,
pub fitness_estimate: Option<f64>,
pub fitness_with_uncertainty: Option<FitnessEstimate>,
pub birth_generation: usize,
pub evaluation_count: usize,
}Expand description
A candidate presented for user evaluation
Wraps a genome with its unique identifier and current fitness estimate. The fitness estimate is updated as user feedback is received and aggregated.
Fields§
§id: CandidateIdUnique identifier for this candidate
genome: GThe genome of this candidate
fitness_estimate: Option<f64>Current fitness estimate (updated as feedback arrives)
fitness_with_uncertainty: Option<FitnessEstimate>Full fitness estimate with uncertainty quantification
birth_generation: usizeGeneration when this candidate was created
evaluation_count: usizeNumber of times this candidate has been evaluated
Implementations§
Source§impl<G> Candidate<G>where
G: EvolutionaryGenome,
impl<G> Candidate<G>where
G: EvolutionaryGenome,
Sourcepub fn new(id: CandidateId, genome: G) -> Self
pub fn new(id: CandidateId, genome: G) -> Self
Create a new candidate with the given ID and genome
Sourcepub fn with_generation(id: CandidateId, genome: G, generation: usize) -> Self
pub fn with_generation(id: CandidateId, genome: G, generation: usize) -> Self
Create a new candidate with birth generation
Sourcepub fn set_fitness(&mut self, fitness: f64)
pub fn set_fitness(&mut self, fitness: f64)
Set the fitness estimate (point estimate only)
Sourcepub fn set_fitness_with_uncertainty(&mut self, estimate: FitnessEstimate)
pub fn set_fitness_with_uncertainty(&mut self, estimate: FitnessEstimate)
Set the full fitness estimate with uncertainty
Sourcepub fn fitness_uncertainty(&self) -> Option<&FitnessEstimate>
pub fn fitness_uncertainty(&self) -> Option<&FitnessEstimate>
Get the full fitness estimate with uncertainty, if available
Sourcepub fn fitness_variance(&self) -> Option<f64>
pub fn fitness_variance(&self) -> Option<f64>
Get the variance of the fitness estimate, if available
Sourcepub fn is_evaluated(&self) -> bool
pub fn is_evaluated(&self) -> bool
Check if this candidate has been evaluated at least once
Sourcepub fn record_evaluation(&mut self)
pub fn record_evaluation(&mut self)
Increment the evaluation count
Sourcepub fn age(&self, current_generation: usize) -> usize
pub fn age(&self, current_generation: usize) -> usize
Get the age of this candidate (generations since birth)
Sourcepub fn is_uncertain(&self, min_observations: usize) -> bool
pub fn is_uncertain(&self, min_observations: usize) -> bool
Check if this candidate has high uncertainty (needs more evaluation)
Returns true if variance is infinite or observation count is below threshold.
Trait Implementations§
Source§impl<'de, G> Deserialize<'de> for Candidate<G>
impl<'de, G> Deserialize<'de> for Candidate<G>
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl<G> Hash for Candidate<G>where
G: EvolutionaryGenome,
impl<G> Hash for Candidate<G>where
G: EvolutionaryGenome,
Source§impl<G> PartialEq for Candidate<G>where
G: EvolutionaryGenome,
impl<G> PartialEq for Candidate<G>where
G: EvolutionaryGenome,
impl<G> Eq for Candidate<G>where
G: EvolutionaryGenome,
Auto Trait Implementations§
impl<G> Freeze for Candidate<G>where
G: Freeze,
impl<G> RefUnwindSafe for Candidate<G>where
G: RefUnwindSafe,
impl<G> Send for Candidate<G>
impl<G> Sync for Candidate<G>
impl<G> Unpin for Candidate<G>where
G: Unpin,
impl<G> UnsafeUnpin for Candidate<G>where
G: UnsafeUnpin,
impl<G> UnwindSafe for Candidate<G>where
G: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.