Skip to main content

CandidateOrigin

Enum CandidateOrigin 

Source
pub enum CandidateOrigin {
    Random,
    Restart,
    Neighbor {
        parent_id: u64,
    },
    Mutation {
        parent_id: u64,
    },
    Crossover {
        first_parent_id: u64,
        second_parent_id: u64,
    },
    Reevaluation {
        candidate_id: u64,
    },
}
Expand description

Source of a candidate’s genome.

Variants§

§

Random

Drawn uniformly from the space.

§

Restart

Drawn uniformly from the space when a hill climb starts over.

§

Neighbor

A step away from hill climb incumbent parent_id.

Fields

§parent_id: u64

Id of the incumbent the step starts from.

§

Mutation

Candidate parent_id with some genes changed.

Fields

§parent_id: u64

Id of the candidate the genes come from.

§

Crossover

Genes taken from two parents, then mutated.

Fields

§first_parent_id: u64

Id of the parent that won the first tournament.

§second_parent_id: u64

Id of the parent that won the second tournament.

§

Reevaluation

More replicates of candidate candidate_id.

Fields

§candidate_id: u64

Id of the candidate evaluated again.

Implementations§

Source§

impl CandidateOrigin

Source

pub fn as_str(self) -> &'static str

Returns the origin’s name in evaluations.csv, as in crossover.

Source

pub fn parent_ids(self) -> [Option<u64>; 2]

Returns the ids of the parents the genome was bred from, the first parent first.

A re-evaluation has no parents. Self::reevaluated_id returns the id of the candidate it repeats.

Source

pub fn reevaluated_id(self) -> Option<u64>

Returns the candidate a re-evaluation adds replicates to, or None for any other origin.

Trait Implementations§

Source§

impl Clone for CandidateOrigin

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for CandidateOrigin

Source§

impl Debug for CandidateOrigin

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for CandidateOrigin

Source§

impl PartialEq for CandidateOrigin

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for CandidateOrigin

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSync for T
where T: Sync,