liveBook · Manning

Meta-algorithm

As explained in Advanced Algorithms and Data Structures

A meta-algorithm is a general algorithmic template whose problem-specific components are supplied to solve different instances.

A meta-algorithm is a reusable algorithmic template: generic structural code defines the technique, while problem-specific components complete it for each instance. section 18.1.2

Design a meta-algorithm by separating the stable framework from components supplied for the target problem:

  • Keep the optimization structure generic, including the main genetic-algorithm flow. section 18.1.2
  • Supply problem-specific chromosome representations and methods, such as those for a 0–1 knapsack instance. section 18.1.2
  • Pass varying behavior through composition, runtime arguments using the strategy pattern, or compile-time inheritance using the template pattern. section 18.1.2

Genetic optimization for knapsack

A genetic-algorithm template can model each organism with an Individual class containing a chromosome and fitness operation. For a knapsack instance, chromosome encodings distinguish selections such as wheat flour and tomatoes from wheat flour, rice, and beans. section 18.1.2

Figure 18.4 Examples of encoding chromosomes for the knapsack problem (the specific instance described in section 1.4). Two figures are shown: the differences in the genotypes (the two strings) are reflected in the phenotypes (the goods taken to Mars: wheat flour and tomatoes versus wheat flour, rice, and beans). The latter chromosome encodes the best solution for the instance of the problem summed up in table 18.1.

Compare chromosome genotypes with their decoded knapsack selections, including the encoding for the best stated solution. section 18.1.2

How Advanced Algorithms and Data Structures covers it

How deep it goes
Defines the template and implementation boundaries, then sketches chromosome and Individual components without analyzing complexity.
Examples
Uses knapsack chromosome encodings, selected goods, an Individual class, and a fitness operation.
What you can do after
Implement a reusable genetic-algorithm framework by supplying problem-specific representations and operations.
How it connects
Connects genetic algorithms with chromosomes, 0–1 knapsack, composition, the strategy pattern, and the template pattern.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Advanced Algorithms and Data Structures. The section links point to the parts of the book it draws on.