pub struct ArithmeticFunctionSet;Expand description
The canonical v1 arithmetic function set shared by CGP and GEP.
Eight opcodes, matching the historical inline CGP table exactly:
| id | op | arity | formula |
|---|---|---|---|
| 0 | add | 2 | a + b |
| 1 | sub | 2 | a - b |
| 2 | mul | 2 | a * b |
| 3 | protected_div | 2 | a / b, or a if ` |
| 4 | sin | 1 | sin(a) |
| 5 | cos | 1 | cos(a) |
| 6 | tanh | 1 | tanh(a) |
| 7 | const | 0 | 1.0 |
The single zero-arity opcode (const 1.0) is the last function id by
construction. GEP relies on this ordering so that all terminal-valued
symbols (zero-arity functions, then variables, then constants) form one
contiguous id range usable as a tail column mask — see
Alphabet::terminal_range.
Implementations§
Source§impl ArithmeticFunctionSet
impl ArithmeticFunctionSet
Sourcepub const ARITIES: [usize; 8]
pub const ARITIES: [usize; 8]
Arity of each opcode, indexed by id.
Mirrors crate::algorithms::gp_cgp::FUNCTION_ARITIES; kept as an
associated constant so FunctionSet::arity is a simple table lookup.
Trait Implementations§
Source§impl Clone for ArithmeticFunctionSet
impl Clone for ArithmeticFunctionSet
Source§fn clone(&self) -> ArithmeticFunctionSet
fn clone(&self) -> ArithmeticFunctionSet
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for ArithmeticFunctionSet
Source§impl Debug for ArithmeticFunctionSet
impl Debug for ArithmeticFunctionSet
Source§impl Default for ArithmeticFunctionSet
impl Default for ArithmeticFunctionSet
Source§fn default() -> ArithmeticFunctionSet
fn default() -> ArithmeticFunctionSet
Returns the “default value” for a type. Read more
Source§impl FunctionSet for ArithmeticFunctionSet
impl FunctionSet for ArithmeticFunctionSet
Auto Trait Implementations§
impl Freeze for ArithmeticFunctionSet
impl RefUnwindSafe for ArithmeticFunctionSet
impl Send for ArithmeticFunctionSet
impl Sync for ArithmeticFunctionSet
impl Unpin for ArithmeticFunctionSet
impl UnsafeUnpin for ArithmeticFunctionSet
impl UnwindSafe for ArithmeticFunctionSet
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