style: apply rustfmt drift across the crate
This commit is contained in:
@@ -21,7 +21,10 @@ pub struct ParetoArchive<D> {
|
||||
impl<D: Clone> ParetoArchive<D> {
|
||||
/// Build an empty archive against the given objective space.
|
||||
pub fn new(objectives: ObjectiveSpace) -> Self {
|
||||
Self { members: Vec::new(), objectives }
|
||||
Self {
|
||||
members: Vec::new(),
|
||||
objectives,
|
||||
}
|
||||
}
|
||||
|
||||
/// Insert a candidate, preserving the non-domination property.
|
||||
@@ -85,10 +88,7 @@ mod tests {
|
||||
use crate::core::objective::Objective;
|
||||
|
||||
fn space_min2() -> ObjectiveSpace {
|
||||
ObjectiveSpace::new(vec![
|
||||
Objective::minimize("f1"),
|
||||
Objective::minimize("f2"),
|
||||
])
|
||||
ObjectiveSpace::new(vec![Objective::minimize("f1"), Objective::minimize("f2")])
|
||||
}
|
||||
|
||||
fn cand(decision: u32, obj: Vec<f64>) -> Candidate<u32> {
|
||||
|
||||
@@ -77,10 +77,7 @@ mod tests {
|
||||
}
|
||||
|
||||
fn space_min2() -> ObjectiveSpace {
|
||||
ObjectiveSpace::new(vec![
|
||||
Objective::minimize("f1"),
|
||||
Objective::minimize("f2"),
|
||||
])
|
||||
ObjectiveSpace::new(vec![Objective::minimize("f1"), Objective::minimize("f2")])
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -29,11 +29,7 @@ pub enum Dominance {
|
||||
/// `constraint_violation` dominates.
|
||||
/// 3. Otherwise compare objective values after converting both to
|
||||
/// minimization orientation via [`ObjectiveSpace::as_minimization`].
|
||||
pub fn pareto_compare(
|
||||
a: &Evaluation,
|
||||
b: &Evaluation,
|
||||
objectives: &ObjectiveSpace,
|
||||
) -> Dominance {
|
||||
pub fn pareto_compare(a: &Evaluation, b: &Evaluation, objectives: &ObjectiveSpace) -> Dominance {
|
||||
let a_feasible = a.is_feasible();
|
||||
let b_feasible = b.is_feasible();
|
||||
match (a_feasible, b_feasible) {
|
||||
@@ -78,10 +74,7 @@ mod tests {
|
||||
use crate::core::objective::Objective;
|
||||
|
||||
fn space_min2() -> ObjectiveSpace {
|
||||
ObjectiveSpace::new(vec![
|
||||
Objective::minimize("f1"),
|
||||
Objective::minimize("f2"),
|
||||
])
|
||||
ObjectiveSpace::new(vec![Objective::minimize("f1"), Objective::minimize("f2")])
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
+1
-4
@@ -69,10 +69,7 @@ mod tests {
|
||||
}
|
||||
|
||||
fn space_min2() -> ObjectiveSpace {
|
||||
ObjectiveSpace::new(vec![
|
||||
Objective::minimize("f1"),
|
||||
Objective::minimize("f2"),
|
||||
])
|
||||
ObjectiveSpace::new(vec![Objective::minimize("f1"), Objective::minimize("f2")])
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -11,7 +11,10 @@
|
||||
/// # Panics
|
||||
/// If `num_objectives == 0`.
|
||||
pub fn das_dennis(num_objectives: usize, divisions: usize) -> Vec<Vec<f64>> {
|
||||
assert!(num_objectives > 0, "das_dennis requires num_objectives >= 1");
|
||||
assert!(
|
||||
num_objectives > 0,
|
||||
"das_dennis requires num_objectives >= 1"
|
||||
);
|
||||
let mut out = Vec::new();
|
||||
let mut current = Vec::with_capacity(num_objectives);
|
||||
recurse(num_objectives, divisions, divisions, &mut current, &mut out);
|
||||
@@ -34,7 +37,13 @@ fn recurse(
|
||||
}
|
||||
for take in 0..=remaining_units {
|
||||
current.push(take);
|
||||
recurse(remaining_axes - 1, remaining_units - take, total, current, out);
|
||||
recurse(
|
||||
remaining_axes - 1,
|
||||
remaining_units - take,
|
||||
total,
|
||||
current,
|
||||
out,
|
||||
);
|
||||
current.pop();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user