Fmt.
Clippy.
This commit is contained in:
@@ -44,9 +44,7 @@ impl Individual for Parabole {
|
||||
type Fitness = Fitness;
|
||||
|
||||
fn mate(&self, other: &Parabole) -> Parabole {
|
||||
Parabole {
|
||||
x: (self.x + other.x) / 2.0,
|
||||
}
|
||||
Parabole { x: (self.x + other.x) / 2.0 }
|
||||
}
|
||||
|
||||
fn mutate(&mut self) {
|
||||
@@ -93,13 +91,13 @@ fn main() {
|
||||
.take(5),
|
||||
)
|
||||
.map(|(a, b)| a.individual.mate(&b.individual))
|
||||
.map(|individual| Wrapper {
|
||||
individual: individual,
|
||||
fitness: None,
|
||||
.map(|individual| {
|
||||
Wrapper {
|
||||
individual: individual,
|
||||
fitness: None,
|
||||
}
|
||||
})
|
||||
.for_each(|wrapper| {
|
||||
population.push(wrapper);
|
||||
});
|
||||
.for_each(|wrapper| { population.push(wrapper); });
|
||||
|
||||
// Mutate all to get new children.
|
||||
parents
|
||||
@@ -124,7 +122,8 @@ fn main() {
|
||||
|
||||
println!(
|
||||
"{:#?}",
|
||||
simulation.population
|
||||
simulation
|
||||
.population
|
||||
.iter()
|
||||
.take(10)
|
||||
.map(|individual| &individual.individual)
|
||||
|
||||
Reference in New Issue
Block a user