pub struct Ga<I, S, X, M, P> {
pub config: Config,
pub operators: Operators<I, S, X, M, P>,
}Expand description
A genetic algorithm over any genome type.
Fields§
§config: ConfigThe run parameters.
operators: Operators<I, S, X, M, P>The breeding operators.
Implementations§
Source§impl<I, S, X, M, P> Ga<I, S, X, M, P>
impl<I, S, X, M, P> Ga<I, S, X, M, P>
Sourcepub fn run<G, O, B, Obs, R>(
&mut self,
objective: &mut O,
budget: &mut B,
observer: &mut Obs,
rng: &mut R,
) -> Outcome<G>
pub fn run<G, O, B, Obs, R>( &mut self, objective: &mut O, budget: &mut B, observer: &mut Obs, rng: &mut R, ) -> Outcome<G>
Runs the GA from a random initial population until the budget stops it.
The returned Outcome::best is the best genome ever evaluated; the population is the
last complete one.
§Panics
Panics if Config::population_size is below 2.
Sourcepub fn run_from<G, O, B, Obs, R>(
&mut self,
seeds: Vec<G>,
objective: &mut O,
budget: &mut B,
observer: &mut Obs,
rng: &mut R,
) -> Outcome<G>
pub fn run_from<G, O, B, Obs, R>( &mut self, seeds: Vec<G>, objective: &mut O, budget: &mut B, observer: &mut Obs, rng: &mut R, ) -> Outcome<G>
Like Ga::run, but the initial population starts with seeds (truncated to the
population size) and is filled up by the initialiser.
§Panics
Panics if Config::population_size is below 2.
Sourcepub fn run_memetic<G, L, O, B, Obs, R>(
&mut self,
memetic: &mut Memetic<L>,
objective: &mut O,
budget: &mut B,
observer: &mut Obs,
rng: &mut R,
) -> Outcome<G>
pub fn run_memetic<G, L, O, B, Obs, R>( &mut self, memetic: &mut Memetic<L>, objective: &mut O, budget: &mut B, observer: &mut Obs, rng: &mut R, ) -> Outcome<G>
Runs the GA as a memetic algorithm: every evaluated offspring (and initial member)
goes through memetic’s local search according to its schedule. Local search
evaluations count against the same budget.
§Panics
Panics if Config::population_size is below 2.
Trait Implementations§
Source§impl<I: PartialEq, S: PartialEq, X: PartialEq, M: PartialEq, P: PartialEq> PartialEq for Ga<I, S, X, M, P>
impl<I: PartialEq, S: PartialEq, X: PartialEq, M: PartialEq, P: PartialEq> PartialEq for Ga<I, S, X, M, P>
impl<I: PartialEq, S: PartialEq, X: PartialEq, M: PartialEq, P: PartialEq> StructuralPartialEq for Ga<I, S, X, M, P>
Auto Trait Implementations§
impl<I, S, X, M, P> Forget for Ga<I, S, X, M, P>
impl<I, S, X, M, P> Freeze for Ga<I, S, X, M, P>
impl<I, S, X, M, P> Move for Ga<I, S, X, M, P>
impl<I, S, X, M, P> RefUnwindSafe for Ga<I, S, X, M, P>where
Operators<I, S, X, M, P>: RefUnwindSafe,
impl<I, S, X, M, P> Send for Ga<I, S, X, M, P>
impl<I, S, X, M, P> Sync for Ga<I, S, X, M, P>
impl<I, S, X, M, P> Unpin for Ga<I, S, X, M, P>
impl<I, S, X, M, P> UnsafeUnpin for Ga<I, S, X, M, P>where
Operators<I, S, X, M, P>: UnsafeUnpin,
impl<I, S, X, M, P> UnwindSafe for Ga<I, S, X, M, P>where
Operators<I, S, X, M, P>: 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
Mutably borrows from an owned value. Read more