pub struct EpsilonArchive<V> { /* private fields */ }Expand description
Grid-based epsilon-dominance archive with bounded size.
Unlike ParetoFrontier::with_eps (numerical tolerance for float comparison),
this type deliberately coarsens objective space into grid cells of width eps
per dimension. At most one point is kept per grid cell, guaranteeing an
archive size bounded by prod_i(range_i / eps_i).
Use this for streaming / online optimization where memory must be bounded while maintaining an approximate Pareto front.
use pare::{Direction, EpsilonArchive};
let mut archive = EpsilonArchive::new_uniform(
vec![Direction::Maximize, Direction::Maximize],
0.1,
);
archive.push(vec![0.91, 0.12], "a");
archive.push(vec![0.92, 0.11], "b"); // same grid cell as "a", replaces if better
archive.push(vec![0.50, 0.50], "c"); // different cell, kept
assert!(archive.len() <= 2);Implementations§
Source§impl<V> EpsilonArchive<V>
impl<V> EpsilonArchive<V>
Sourcepub fn new(directions: Vec<Direction>, grid_eps: Vec<f64>) -> Self
pub fn new(directions: Vec<Direction>, grid_eps: Vec<f64>) -> Self
Create an archive with per-dimension grid epsilon values.
§Panics
Panics if grid_eps.len() != directions.len() or any epsilon is not positive.
Sourcepub fn new_uniform(directions: Vec<Direction>, eps: f64) -> Self
pub fn new_uniform(directions: Vec<Direction>, eps: f64) -> Self
Create an archive with a uniform grid epsilon for all dimensions.
§Panics
Panics if eps is not positive.
Sourcepub fn push(&mut self, values: Vec<f64>, data: V) -> bool
pub fn push(&mut self, values: Vec<f64>, data: V) -> bool
Insert a point into the archive if it is not epsilon-dominated.
Returns true if the point was added (or replaced an existing point
in the same cell), false if it was rejected.
§Panics
Panics if values.len() != directions.len() or any value is non-finite.
Sourcepub fn directions(&self) -> &[Direction]
pub fn directions(&self) -> &[Direction]
Get the optimization directions.
Sourcepub fn into_frontier(self) -> ParetoFrontier<V>
pub fn into_frontier(self) -> ParetoFrontier<V>
Convert into a standard Pareto frontier for downstream analysis (crowding distance, hypervolume, scoring, etc.).
The resulting frontier uses the default numerical epsilon (1e-9),
not the grid epsilon. All archived points are inserted; since they
are mutually non-epsilon-dominated, most will survive standard
dominance filtering (though some edge cases near cell boundaries
may be filtered).
Trait Implementations§
Source§impl<V: Clone> Clone for EpsilonArchive<V>
impl<V: Clone> Clone for EpsilonArchive<V>
Source§fn clone(&self) -> EpsilonArchive<V>
fn clone(&self) -> EpsilonArchive<V>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more