Trait metaheuristics_nature::Bounded

source ·
pub trait Bounded: MaybeParallel {
    // Required method
    fn bound(&self) -> &[[f64; 2]];

    // Provided methods
    fn dim(&self) -> usize { ... }
    fn bound_of(&self, s: usize) -> [f64; 2] { ... }
    fn bound_width(&self, s: usize) -> f64 { ... }
    fn bound_range(&self, s: usize) -> RangeInclusive<f64> { ... }
    fn lb(&self, s: usize) -> f64 { ... }
    fn ub(&self, s: usize) -> f64 { ... }
    fn clamp(&self, s: usize, v: f64) -> f64 { ... }
}
Expand description

A problem is well bounded.

Provide constant array reference or dynamic slice for the variables.

Required Methods§

source

fn bound(&self) -> &[[f64; 2]]

The upper bound and lower bound in [[lower, upper]; number_of_vars] form.

This function should be cheap.

Provided Methods§

source

fn dim(&self) -> usize

Get the number of variables (dimension) of the problem.

source

fn bound_of(&self, s: usize) -> [f64; 2]

Get the upper bound and the lower bound values.

source

fn bound_width(&self, s: usize) -> f64

Get the width of the upper bound and the lower bound.

source

fn bound_range(&self, s: usize) -> RangeInclusive<f64>

Get the upper bound and the lower bound as a range.

The variable is constrain with lower <= x <= upper.

source

fn lb(&self, s: usize) -> f64

Get the lower bound.

source

fn ub(&self, s: usize) -> f64

Get the upper bound.

source

fn clamp(&self, s: usize, v: f64) -> f64

Check the bounds of the index s with the value v, and set the value to max and min if out of bound.

Implementors§

source§

impl<Y: Fitness, const DIM: usize> Bounded for Fx<'_, '_, Y, DIM>