Skip to main content

Zdt

Enum Zdt 

Source
#[non_exhaustive]
pub enum Zdt { One, Two, Three, }
Expand description

One of the three problems.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

One

ZDT1: a convex front.

§

Two

ZDT2: a concave front.

§

Three

ZDT3: a front in five pieces.

Implementations§

Source§

impl Zdt

Source

pub fn evaluate(self, x: &[f64]) -> Vec<f64>

The problem’s two goals at x, [f₁, f₂]; x₀ is taken as 0 if x is empty.

Source

pub fn front_f2(self, f1: f64) -> f64

The curve the front lies on, f₂ = h(f₁, 1), at f₁.

Source

pub fn pieces(self) -> &'static [(f64, f64)]

The f₁ ranges of the front’s pieces: one for ZDT1 and ZDT2, five for ZDT3.

Source

pub fn reference(self, points: usize) -> Vec<Vec<f64>>

points points of the front, f₁ evenly spaced from 0 to 1, those outside ZDT3’s pieces left out: a reference for inverted_generational_distance.

Source

pub fn distance_to_front(self, f: &[f64]) -> f64

The Euclidean distance from goals f = [f₁, f₂] to the front, the curve itself rather than points along it.

Any point of the front bounds it, so the nearest point lies within f₁ ± d₀ of f₁, where d₀ is the distance to the front at f₁ itself (or a piece’s nearer end): that window of each piece is searched on a grid of 400 steps in s (f₁ = s² for ZDT1 and ZDT3, whose slope is infinite at 0; f₁ = s for ZDT2), and the best step refined by golden-section search over its two neighbours.

Trait Implementations§

Source§

impl Clone for Zdt

Source§

fn clone(&self) -> Zdt

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for Zdt

Source§

impl Debug for Zdt

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Zdt

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for Zdt

Source§

impl PartialEq for Zdt

Source§

fn eq(&self, other: &Zdt) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Zdt

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Zdt

Auto Trait Implementations§

§

impl Freeze for Zdt

§

impl RefUnwindSafe for Zdt

§

impl Send for Zdt

§

impl Sync for Zdt

§

impl Unpin for Zdt

§

impl UnsafeUnpin for Zdt

§

impl UnwindSafe for Zdt

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

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

Source§

fn __clone_box(&self, _: Private) -> *mut ()

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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.