A genetic algorithm implementation in Rust.
Genetic
interface for your search problem:
rust
pub trait Genetic<G> {
fn initialize(&mut self) -> G;
fn evaluate(&mut self, genome: &G) -> f64;
fn crossover(&mut self, lhs: &G, rhs: &G) -> G;
fn mutate(&mut self, original: &G) -> G;
fn random(&mut self) -> &mut Random;
}
rust
let result = solve(
Box::new(MySearchProblem::new(make_random())),
None,
0.00,
32,
100,
0.0,
1_000,
Duration::from_secs(5),
);
println!("{:?}", result);
cargo test
or cargo build
See the examples folder.
Genetic Algorithm is a very well known technique: https://en.wikipedia.org/wiki/Genetic_algorithm There are many alternatives for Rust available through cargo: https://crates.io/search?q=genetic%20algorithm
MIT permissive license. See LICENSE for full license details.