Crate roulette_wheel [−] [src]
A Little implementation of the roulette-wheel principle, RouletteWheel<T>
.
https://wikipedia.org/wiki/Fitness_proportionate_selection
Usage
Examples
You can explicitly create a RouletteWheel<T>
with new()
:
use roulette_wheel::RouletteWheel; let rw: RouletteWheel<u8> = RouletteWheel::new();
You can push
values in the roulette-wheel (which will grow the wheel as needed):
```
use roulette_wheel::RouletteWheel;
let mut rw = RouletteWheel::new();
rw.push(5., 'a'); rw.push(1., 'b');
// .iter() will not consume the roulette wheel for (fit, &ind) in rw.iter() { // do things with individuals here }
// .into_iter() consume the roulette wheel for (fit, ind) in rw.into_iter() { // do things with individuals here }
Structs
IntoSelectIter | |
RouletteWheel |
A roulette-wheel container |
SelectIter |