Skip to main content

Encodeable

Trait Encodeable 

Source
pub trait Encodeable {
    type Phenotype;

    const NAME: &str;
    const HASH: i32 = _;

    // Required methods
    fn morphology() -> Vec<GeneBounds>;
    fn encode(&self) -> Vec<i64>;
    fn decode(genes: &[i64]) -> Self::Phenotype;
}
Expand description

Trait for types that can be encoded as genomes for genetic algorithm optimization. Provides the interface between domain-specific types and the GA engine.

Required Associated Constants§

Source

const NAME: &str

Unique name identifier for this type.

Provided Associated Constants§

Source

const HASH: i32 = _

Hash derived from the name for efficient type identification.

Required Associated Types§

Source

type Phenotype

The decoded phenotype that will be passed to evaluators.

Required Methods§

Source

fn morphology() -> Vec<GeneBounds>

Returns the gene bounds that define the search space structure.

Source

fn encode(&self) -> Vec<i64>

Encodes an instance of this type into a genome representation.

Source

fn decode(genes: &[i64]) -> Self::Phenotype

Decodes a genome into the phenotype for evaluation.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§