style: apply rustfmt drift across the crate
This commit is contained in:
@@ -43,6 +43,7 @@ impl Problem for SchafferN1 {
|
||||
}
|
||||
|
||||
struct OneMax {
|
||||
#[allow(dead_code)]
|
||||
bits: usize,
|
||||
}
|
||||
impl Problem for OneMax {
|
||||
@@ -69,8 +70,7 @@ fn mo_bounds() -> Vec<(f64, f64)> {
|
||||
vec![(-3.0, 3.0)]
|
||||
}
|
||||
|
||||
fn mo_variation()
|
||||
-> CompositeVariation<SimulatedBinaryCrossover, PolynomialMutation> {
|
||||
fn mo_variation() -> CompositeVariation<SimulatedBinaryCrossover, PolynomialMutation> {
|
||||
let bounds = mo_bounds();
|
||||
CompositeVariation {
|
||||
crossover: SimulatedBinaryCrossover::new(bounds.clone(), 15.0, 0.5),
|
||||
|
||||
@@ -9,8 +9,12 @@ use heuropt::prelude::*;
|
||||
/// Generate per-axis bounds whose width is at least 0.001 (avoid the
|
||||
/// degenerate `lo == hi` case for properties that need a proper interval).
|
||||
fn bounds(dim: usize) -> impl Strategy<Value = Vec<(f64, f64)>> {
|
||||
prop::collection::vec((-50.0_f64..50.0, 0.001_f64..50.0), dim..=dim)
|
||||
.prop_map(|pairs| pairs.into_iter().map(|(lo, span)| (lo, lo + span)).collect())
|
||||
prop::collection::vec((-50.0_f64..50.0, 0.001_f64..50.0), dim..=dim).prop_map(|pairs| {
|
||||
pairs
|
||||
.into_iter()
|
||||
.map(|(lo, span)| (lo, lo + span))
|
||||
.collect()
|
||||
})
|
||||
}
|
||||
|
||||
/// Generate a parent vector inside the given bounds.
|
||||
|
||||
+8
-9
@@ -20,17 +20,12 @@ use heuropt::prelude::*;
|
||||
|
||||
/// Generate a 2-objective minimize ObjectiveSpace.
|
||||
fn space_2d() -> ObjectiveSpace {
|
||||
ObjectiveSpace::new(vec![
|
||||
Objective::minimize("f1"),
|
||||
Objective::minimize("f2"),
|
||||
])
|
||||
ObjectiveSpace::new(vec![Objective::minimize("f1"), Objective::minimize("f2")])
|
||||
}
|
||||
|
||||
/// Generate a candidate with a 2-D objective vector in `[lo, hi]`.
|
||||
fn candidate_2d(lo: f64, hi: f64) -> impl Strategy<Value = Candidate<()>> {
|
||||
(lo..hi, lo..hi).prop_map(|(a, b)| {
|
||||
Candidate::new((), Evaluation::new(vec![a, b]))
|
||||
})
|
||||
(lo..hi, lo..hi).prop_map(|(a, b)| Candidate::new((), Evaluation::new(vec![a, b])))
|
||||
}
|
||||
|
||||
/// Generate a small 2-D population.
|
||||
@@ -40,8 +35,12 @@ fn population_2d() -> impl Strategy<Value = Vec<Candidate<()>>> {
|
||||
|
||||
/// Generate per-axis bounds.
|
||||
fn bounds(dim: usize) -> impl Strategy<Value = Vec<(f64, f64)>> {
|
||||
prop::collection::vec((-50.0_f64..50.0, 0.001_f64..50.0), dim..=dim)
|
||||
.prop_map(|pairs| pairs.into_iter().map(|(lo, span)| (lo, lo + span)).collect())
|
||||
prop::collection::vec((-50.0_f64..50.0, 0.001_f64..50.0), dim..=dim).prop_map(|pairs| {
|
||||
pairs
|
||||
.into_iter()
|
||||
.map(|(lo, span)| (lo, lo + span))
|
||||
.collect()
|
||||
})
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user