Struct SimpleGeneticAlgorithm

Source
pub struct SimpleGeneticAlgorithm<T: GASolution> { /* private fields */ }
Expand description

Simple Genetic Algorithm

A basic implementation of a Genetic Algorithm.

This genetic algorithm is the ‘simple’ genetic algorithm that Goldberg describes in his book. It uses non-overlapping populations. When you create a simple genetic algorithm, you must specify either an individual or a population of individuals. The new genetic algorithm will clone the individual(s) that you specify to make its own population. You can change most of the genetic algorithm behaviors after creation and during the course of the evolution.

The simple genetic algorithm creates an initial population by cloning the individual or population you pass when you create it. Each generation the algorithm creates an entirely new population of individuals by selecting from the previous population then mating to produce the new offspring for the new population. This process continues until the stopping criteria are met (determined by the terminator).

Elitism is optional. By default, elitism is on, meaning that the best individual from each generation is carried over to the next generation.

Implementations§

Trait Implementations§

Source§

impl<T: GASolution> GeneticAlgorithm<T> for SimpleGeneticAlgorithm<T>

Source§

fn config(&mut self) -> &dyn GAConfig

Source§

fn population(&mut self) -> &mut GAPopulation<T>

Source§

fn initialize_internal(&mut self)

Source§

fn step_internal(&mut self) -> i32

Source§

fn done_internal(&mut self) -> bool

Source§

fn initialize(&mut self)

Source§

fn step(&mut self) -> i32

Source§

fn done(&mut self) -> bool

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, 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.