The M_E_Engine

What is the M_E_Engine?

The M_E_Engine is the core component that brings “Mutable Encoding” to the MEGA (Mutable Encoding Genetic Algorithm) framework. In traditional genetic algorithms, genes and their representations are fixed, limiting the algorithm’s flexibility in exploring complex solutions. The M_E_Engine changes this by allowing genes and their encodings to evolve over time. This dynamic approach enables the creation of new genes and genetic structures, enhancing the algorithm’s ability to find optimal solutions in complex problem spaces.

For a Technical Breakdown of the M_E_Engine


Understanding the M_E_Engine and Its EncodingManager

At the heart of the M_E_Engine lies the EncodingManager, a crucial system responsible for managing how genes are represented, combined, and interpreted within the algorithm. Let’s explore how the EncodingManager works and how it contributes to the flexibility and power of the M_E_Engine.

Key Responsibilities of the EncodingManager:

  1. Gene Management
    • Adding Genes: Introducing new genes into the system and assigning them unique identifiers.
    • Gene Encodings: Creating a mapping between genes and their numerical representations (hash keys).
  2. Encoding and Decoding
    • Encoding Genes: Converting readable genes into numerical codes for processing.
    • Decoding Sequences: Translating numerical codes back into readable genes.
  3. Segment Capture and Nesting
    • Capturing Segments: Grouping sequences of genes into single units called meta genes.
    • Nesting Meta Genes: Allowing meta genes to contain other meta genes, creating hierarchical genetic structures.
  4. Opening Segments
    • Unpacking Meta Genes: Breaking down captured meta genes back into their original gene sequences for modification or analysis.
    • No Duplicates Rule: An opened Meta Gene cant be recaptured unless it has been modified. Capture enforces a strict no duplicate rule to avoid pointless redundancy.
  5. Integration
    • Integration of Uploaded Encodings: Rebuilds the encodings and Meta Genome from raw encoding data. Allows for knowledge transfer from previous run or inclusion of manual or artificially created encoding structures to be integrated and used in a naïve MEGA run.

How Does the EncodingManager Work?

Let’s delve into each responsibility to understand the EncodingManager’s role in the M_E_Engine.

Note: Hash keys in the examples aren’t the actual hash keys used.

1. Gene Management

Adding Genes:

  • Purpose: Introduce new genes (basic units of information) into the system.
  • Process:
    • When a new gene is added, the EncodingManager assigns it a unique numerical identifier, known as a hash key.
    • This hash key serves as the encoded representation of the gene within genetic sequences.
  • Example:
    • Adding gene 'A' results in it being assigned hash key 101.
    • The gene 'A' is now represented by 101 in encoded sequences.

2. Encoding and Decoding

Encoding Genes:

  • Purpose: Transform readable genes into numerical codes that the algorithm can process efficiently.
  • Process:
    • The EncodingManager replaces each gene in a sequence with its corresponding hash key.
  • Example:
    • Encoding the sequence ['A', 'B', 'C'] results in [101, 102, 103], where each gene is replaced by its hash key.

Decoding Sequences:

  • Purpose: Convert numerical codes back into readable gene sequences for interpretation or output.
  • Process:
    • The EncodingManager looks up each hash key and retrieves the associated gene.
  • Example:
    • Decoding [101, 102, 103] results in ['A', 'B', 'C'].

3. Segment Capture and Nesting

Capturing Segments (Creating Meta Genes):

  • Purpose: Group a sequence of genes into a single, reusable unit called a meta gene.
  • Process:
    • A specific sequence of encoded genes is captured and assigned a new unique hash key.
    • This meta gene can be used in genetic sequences just like any other gene.
  • No Duplicate Rule:
    • Before capturing, the EncodingManager checks if an identical sequence has already been captured.
    • If so, it reuses the existing hash key, preventing redundant meta genes.
  • Example:
    • Capturing the sequence [101, 102] (which represents ['A', 'B']) assigns it hash key 201.
    • The meta gene 201 now represents the sequence ['A', 'B'].

Nesting Meta Genes:

  • Purpose: Build complex genetic structures by allowing meta genes to contain other meta genes.
  • Process:
    • Meta genes can be included in new sequences and captured again to form higher-level meta genes.
  • Example:
    • Using meta gene 201 (['A', 'B']) in a new sequence with gene 'C' (hash key 103), we get [201, 103].
    • Capturing [201, 103] assigns it hash key 301, representing [['A', 'B'], 'C'].

4. Opening Segments

Unpacking Meta Genes:

  • Purpose: Access the individual genes within a meta gene for modification or detailed processing.
  • Process:
    • The EncodingManager replaces a meta gene’s hash key with its original sequence of hash keys.
    • Optionally, Start (hash key 500) and End (hash key 501) Delimiters can be added to define the boundaries of segments. More on these in the details of the GA_Base details.
  • Example:
    • Opening meta gene 201 yields [500, 101, 102, 501].
    • If meta gene 301 is opened, it yields [500, 201, 103, 501], and opening 201 further reveals [500, 101, 102, 103 501].

5. Integration

Integration of External Encodings:

  • Purpose: Merge genetic data from different sources or previous runs without conflicts.
  • Process:
    • External encoding data is parsed and aligned with existing genes.
    • The EncodingManager updates its records to include new genes and meta genes.
    • Unique identifiers are maintained to prevent clashes.

Conclusion

The M_E_Engine, through its EncodingManager, provides the encoding management and manipulation for MEGA. By allowing genes and their encodings to be mutable, it provides the flexibility needed to tackle complex problems. The mechanisms of capturing, nesting, and opening meta genes create a dynamic and efficient system that promotes modularity and reusability.

Understanding the EncodingManager’s role helps in appreciating how the MEGA framework evolves solutions over time, adapting and refining its approach to find optimal or near-optimal results. This innovative framework moves beyond traditional genetic algorithms by offering a more flexible and powerful tool for solving intricate problems across various domains.