pub struct GepConfig {
pub head_len: usize,
pub tail_len: usize,
pub pop_size: usize,
pub n_vars: usize,
pub mutation_rate: Probability,
pub is_transpose_rate: Probability,
pub ris_transpose_rate: Probability,
pub crossover_1p_rate: Probability,
pub crossover_2p_rate: Probability,
}Expand description
Static parameters for a GepStrategy run.
GEP chromosomes are fixed-length: a head of head_len loci (which may
hold any symbol) followed by a tail of tail_len loci (terminals only).
The tail length is not a free parameter — it is derived from the head
length and the function set’s maximum arity so that every chromosome
decodes to a complete expression tree without repair (see
GepConfig::new).
Unlike the const-generic experiments considered during design, the genome
dimensions are ordinary runtime fields (matching the shipped
CgpConfig precedent); no
generic_const_exprs is required.
Fields§
§head_len: usizeHead length: number of leading loci that may hold any symbol.
tail_len: usizeTail length: number of trailing loci that may hold terminals only.
Derived in GepConfig::new as head_len * (max_arity - 1) + 1.
pop_size: usizeNumber of individuals in the population.
n_vars: usizeNumber of input variables the program sees.
mutation_rate: ProbabilityPer-gene point-mutation probability. Valid by construction ([0, 1]).
is_transpose_rate: ProbabilityPer-individual probability of applying one IS transposition. Valid by
construction ([0, 1]).
ris_transpose_rate: ProbabilityPer-individual probability of applying one RIS transposition. Valid by
construction ([0, 1]).
crossover_1p_rate: ProbabilityPer-pair probability of one-point crossover. Valid by construction
([0, 1]).
crossover_2p_rate: ProbabilityPer-pair probability of two-point crossover. Valid by construction
([0, 1]).
Implementations§
Source§impl GepConfig
impl GepConfig
Sourcepub fn new(
head_len: usize,
max_arity: usize,
n_vars: usize,
pop_size: usize,
) -> Result<Self, ConfigError>
pub fn new( head_len: usize, max_arity: usize, n_vars: usize, pop_size: usize, ) -> Result<Self, ConfigError>
Builds a config, deriving and validating the tail length.
The tail length is set to head_len * (max_arity - 1) + 1, the minimum
that guarantees any head/tail-respecting chromosome decodes to a
complete tree. max_arity is the function set’s largest
arity (FunctionSet::max_arity).
Operator rates default to canonical Ferreira (2001) values; assign a
validated Probability to the public fields afterwards to override.
The point-mutation rate defaults to 2 / genome_len (≈ two genes per
chromosome). Because the rates are Probability, a NaN/Inf/
out-of-[0, 1] rate is unrepresentable — the silent operator
degeneracy of a bare f32 rate cannot occur.
§Errors
Returns a ConfigError if max_arity, head_len, n_vars, or
pop_size is zero — each would make the genome layout or the tree
decode degenerate. max_arity is checked here (it is consumed to derive
tail_len rather than stored); the remaining field invariants are
checked via Validate.
Sourcepub fn genome_len(&self) -> usize
pub fn genome_len(&self) -> usize
Total chromosome length (head_len + tail_len).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for GepConfig
impl RefUnwindSafe for GepConfig
impl Send for GepConfig
impl Sync for GepConfig
impl Unpin for GepConfig
impl UnsafeUnpin for GepConfig
impl UnwindSafe for GepConfig
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
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>
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>
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