pub struct GeneticGraphOptimizer { /* private fields */ }Expand description
Genetic algorithm for optimizing graph structures
Implementations§
Source§impl GeneticGraphOptimizer
impl GeneticGraphOptimizer
Sourcepub fn best_fitness(&self) -> f64
pub fn best_fitness(&self) -> f64
Get the best fitness achieved so far
Sourcepub fn best_individual(&self) -> Option<&GraphStructure>
pub fn best_individual(&self) -> Option<&GraphStructure>
Get the best individual found so far
Sourcepub fn new(
population_size: usize,
fitness_function: Box<dyn Fn(&GraphStructure) -> f64 + Send + Sync>,
) -> Self
pub fn new( population_size: usize, fitness_function: Box<dyn Fn(&GraphStructure) -> f64 + Send + Sync>, ) -> Self
Create a new genetic optimizer
Sourcepub fn set_parameters(
&mut self,
mutation_rate: f64,
crossover_rate: f64,
generations: usize,
)
pub fn set_parameters( &mut self, mutation_rate: f64, crossover_rate: f64, generations: usize, )
Set evolution parameters
Sourcepub fn initialize_population(
&mut self,
base_triples: &[Triple],
) -> Result<(), OxirsError>
pub fn initialize_population( &mut self, base_triples: &[Triple], ) -> Result<(), OxirsError>
Initialize random population
Sourcepub fn evolve_generation(&mut self) -> Result<GenerationStats, OxirsError>
pub fn evolve_generation(&mut self) -> Result<GenerationStats, OxirsError>
Evolve the population for one generation
Sourcepub fn evolve(&mut self) -> Result<GraphStructure, OxirsError>
pub fn evolve(&mut self) -> Result<GraphStructure, OxirsError>
Run complete evolution process
Sourcepub fn get_best_structure(&self) -> Option<&GraphStructure>
pub fn get_best_structure(&self) -> Option<&GraphStructure>
Get the best structure from current population
Sourcepub fn get_evolution_history(&self) -> &[GenerationStats]
pub fn get_evolution_history(&self) -> &[GenerationStats]
Get evolution history
Auto Trait Implementations§
impl Freeze for GeneticGraphOptimizer
impl !RefUnwindSafe for GeneticGraphOptimizer
impl Send for GeneticGraphOptimizer
impl Sync for GeneticGraphOptimizer
impl Unpin for GeneticGraphOptimizer
impl UnsafeUnpin for GeneticGraphOptimizer
impl !UnwindSafe for GeneticGraphOptimizer
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
Converts
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>
Converts
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