Skip to content

Commit

Permalink
Cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
kkafar committed Apr 24, 2024
1 parent 3de3a70 commit 40e09d6
Show file tree
Hide file tree
Showing 7 changed files with 4 additions and 19 deletions.
12 changes: 2 additions & 10 deletions examples/jssp/problem/crossover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,7 @@ impl JsspCrossover {
}

impl CrossoverOperator<JsspIndividual> for JsspCrossover {
fn apply(
&mut self,
metadata: &GAMetadata,
selected: &[&JsspIndividual],
) -> Vec<JsspIndividual> {
fn apply(&mut self, metadata: &GAMetadata, selected: &[&JsspIndividual]) -> Vec<JsspIndividual> {
assert!(selected.len() & 1 == 0);

let mut output = Vec::with_capacity(selected.len());
Expand Down Expand Up @@ -90,11 +86,7 @@ impl NoopCrossover {
}

impl CrossoverOperator<JsspIndividual> for NoopCrossover {
fn apply(
&mut self,
metadata: &GAMetadata,
selected: &[&JsspIndividual],
) -> Vec<JsspIndividual> {
fn apply(&mut self, metadata: &GAMetadata, selected: &[&JsspIndividual]) -> Vec<JsspIndividual> {
assert!(selected.len() & 1 == 0);

let mut output = Vec::with_capacity(selected.len());
Expand Down
4 changes: 1 addition & 3 deletions src/ga.rs
Original file line number Diff line number Diff line change
Expand Up @@ -319,9 +319,7 @@ where

// FIXME: Do not assume that population size is an even number.
self.timer.start();
let mut children = self.config
.crossover_operator
.apply(&self.metadata, &mating_pool);
let mut children = self.config.crossover_operator.apply(&self.metadata, &mating_pool);
self.metadata.crossover_dur = Some(self.timer.elapsed());

self.timer.start();
Expand Down
1 change: 0 additions & 1 deletion src/ga/operators/crossover/impls/fixed_point.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ impl FixedPoint {

(child_1, child_2)
}

}

impl<GeneT, IndividualT> CrossoverOperator<IndividualT> for FixedPoint
Expand Down
1 change: 0 additions & 1 deletion src/ga/operators/crossover/impls/multi_point.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ impl<R: Rng> MultiPoint<R> {

(IndividualT::from(child_1_ch), IndividualT::from(child_2_ch))
}

}

impl<GeneT, IndividualT, R> CrossoverOperator<IndividualT> for MultiPoint<R>
Expand Down
1 change: 0 additions & 1 deletion src/ga/operators/crossover/impls/ppx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ impl<R: Rng> Ppx<R> {

(child_1, child_2)
}

}

impl<GeneT, IndividualT, R> CrossoverOperator<IndividualT> for Ppx<R>
Expand Down
3 changes: 1 addition & 2 deletions src/ga/operators/crossover/impls/two_point.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ impl<R: Rng> TwoPoint<R> {
}
}

impl<R: Rng> TwoPoint<R>
{
impl<R: Rng> TwoPoint<R> {
/// Returns a tuple of children
///
/// It works by randomly selecting two cutpoints splitting parents chromosomes in three parts.
Expand Down
1 change: 0 additions & 1 deletion src/ga/operators/crossover/impls/uniform_parameterized.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,3 @@ where
output
}
}

0 comments on commit 40e09d6

Please sign in to comment.