watchmaker
A genetic algorithm implementation in Rust.
Features
- Developed as an investigation into capabilities and implementation characteristics
- Written in the Rust programming language
- The API aims to be minimal and complete
- Built-in crossover protection, to avoid the common bug where the first genome in a crossover operation is always used for the start of the resulting genome
- Some features are missing (see Roadmap section)
Usage
- Install Rust using
rustuphttps://rustup.rs/ - Add a reference to your
Cargo.tomlfile from: https://crates.io/crates/watchmaker - Implement the
Genetictrait for your search problem:
Example:
type MyGenome = String;
See WSGenome and WSGenetic for a fully implemented, working example that finds a target string.
- Call the
solvermethod:
Example:
let result = solve;
println!;
Development
- Clone the repository (see below)
- Run
cargo testorcargo build
Examples
See the examples folder.
Roadmap
Note major version increment with each major release. API changes will not be backwards compatible between major releases.
- v3.x.x
- Fourth published version
- Long Term Support
- Will take contributions, bug fixes from this point on.
- v2.x.x
- Third published version (beta quality)
- Multithreading
- Split out algorithm that produces new generations
- Better typing around Progress
- Simpler code example in README.md and crate documentation
- Link to examples, with description and sample output
- Update features section
- Unsupported
- v1.x.x
- Second published version (beta quality)
- Randomly swap genome to crossover, to prevent bias towards individual genome
- Builder pattern for search settings
- Rustdoc
- Fix license - does not appear as 'standard' on crates.io
- Unsupported
- v0.1.0
- First published version (beta quality)
- Unsupported
Alternatives
- The Genetic Algorithm is a very well known technique: https://en.wikipedia.org/wiki/Genetic_algorithm
- Rust Awesome has a list: https://github.com/awesome-rust-com/awesome-rust#genetic-algorithms
- Cargo: https://crates.io/search?q=genetic%20algorithm
Contributing
Not accepting pull requests yet :) See roadmap.
License
MIT permissive license. See LICENSE for full license details.