pub struct CgpConfig {
pub lambda: usize,
pub n_inputs: usize,
pub rows: usize,
pub cols: usize,
pub mutation_rate: Probability,
pub levels_back: usize,
}Expand description
Static configuration for a CartesianGeneticProgramming run.
Fields§
§lambda: usizeNumber of offspring per generation (λ in (1 + λ)).
n_inputs: usizeNumber of inputs (independent variables) the program sees.
rows: usizeNumber of grid rows.
cols: usizeNumber of grid columns.
mutation_rate: ProbabilityMutation rate applied to each gene of the integer genome. Valid by
construction ([0, 1]).
levels_back: usizeLevels-back parameter: how many previous columns a node can
connect to. usize::MAX means “any previous column”.
Implementations§
Source§impl CgpConfig
impl CgpConfig
Sourcepub const GENES_PER_NODE: usize = 3
pub const GENES_PER_NODE: usize = 3
Genes per node in the genotype layout: (function_id, input_0, input_1).
Sourcepub const OUTPUT_GENES: usize = 1
pub const OUTPUT_GENES: usize = 1
Number of output genes per program (one index pointing to the node whose value is taken as the program output).
Sourcepub fn default_for(n_inputs: usize) -> Self
pub fn default_for(n_inputs: usize) -> Self
Sensible defaults: 1-output, 1-row, 30-column grid, mutation rate tuned to flip ~3 genes per genome.
Sourcepub fn genome_len(&self) -> usize
pub fn genome_len(&self) -> usize
Total genome length (nodes × 3 + outputs).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CgpConfig
impl RefUnwindSafe for CgpConfig
impl Send for CgpConfig
impl Sync for CgpConfig
impl Unpin for CgpConfig
impl UnsafeUnpin for CgpConfig
impl UnwindSafe for CgpConfig
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<C> CloneExpand for Cwhere
C: Clone,
impl<C> CloneExpand for Cwhere
C: Clone,
fn __expand_clone_method(&self, _scope: &mut Scope) -> C
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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