Crate algen

source ·
Expand description

Algen is a genetic algorithm runner. It provides a common set of traits and models that can be implemented to construct a genetic algorithm. Once these traits and models have been filled out, you can invoke the run_algorithm method in this crate which will do the following:

  • Create an initial population
  • Score each node
  • Reserve the best and worst solutions
  • Create the next generation through recombination and tournament selection
  • Begin the cycle again

This will happen until a winning condition is met, or until you have exhausted all generations.

Algen provides an abstraction on top of genetic algorithms. On its own, it does not provide a working implementation. That’s up to you! So here are the traits you need to implement in order to use Algen:

  • Algorithm to define how input data is manipulated to solve a particular problem.
  • Analyzer to score the result of the algorithm and produce a numeric value representing how well it did.

In addition to these traits, you need to provide TestParameters and some kind of Input Data which is fed to your algorithm.

See the example in the examples folder for more details.

    run_algorithm(
        &parameters,
        test_data,
        algo,
        analyzer,
        Some(after_generation),
    );

Modules

Functions

The primary algorithm runner. This method will accept the types: