Skip to main content

EpsilonArchive

Struct EpsilonArchive 

Source
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>

Source

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.

Source

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.

Source

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.

Source

pub fn len(&self) -> usize

Number of points in the archive.

Source

pub fn is_empty(&self) -> bool

Is the archive empty?

Source

pub fn points(&self) -> &[Point<V>]

Get all points in the archive.

Source

pub fn grid_eps(&self) -> &[f64]

Get the grid epsilon values.

Source

pub fn directions(&self) -> &[Direction]

Get the optimization directions.

Source

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>

Source§

fn clone(&self) -> EpsilonArchive<V>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<V: Debug> Debug for EpsilonArchive<V>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<V> Freeze for EpsilonArchive<V>

§

impl<V> RefUnwindSafe for EpsilonArchive<V>
where V: RefUnwindSafe,

§

impl<V> Send for EpsilonArchive<V>
where V: Send,

§

impl<V> Sync for EpsilonArchive<V>
where V: Sync,

§

impl<V> Unpin for EpsilonArchive<V>
where V: Unpin,

§

impl<V> UnsafeUnpin for EpsilonArchive<V>

§

impl<V> UnwindSafe for EpsilonArchive<V>
where V: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.