Trait Metric

Source
pub trait Metric<T> {
    type Error: Error;

    // Required method
    fn distance(&self, value: &T) -> Result<f64, Self::Error>;
}

Required Associated Types§

Required Methods§

Source

fn distance(&self, value: &T) -> Result<f64, Self::Error>

Returns a floating-point value that represents the “goodness” of the input with respect to some criteria

In general, the sign of the value indicates whether the input is good or bad, and the magnitude of the value represents how good/bad the input is. Representation in this fashion allows for the use of optimization algorithms to find the best input.

Implementations on Foreign Types§

Source§

impl<T, M: Metric<T> + ?Sized> Metric<T> for &M

Source§

type Error = <M as Metric<T>>::Error

Source§

fn distance(&self, value: &T) -> Result<f64, Self::Error>

Source§

impl<T, M: Metric<T> + ?Sized> Metric<T> for Box<M>

Source§

type Error = <M as Metric<T>>::Error

Source§

fn distance(&self, value: &T) -> Result<f64, Self::Error>

Source§

impl<T, M: Metric<T> + ?Sized> Metric<T> for Rc<M>

Source§

type Error = <M as Metric<T>>::Error

Source§

fn distance(&self, value: &T) -> Result<f64, Self::Error>

Source§

impl<T, M: Metric<T> + ?Sized> Metric<T> for Arc<M>

Source§

type Error = <M as Metric<T>>::Error

Source§

fn distance(&self, value: &T) -> Result<f64, Self::Error>

Implementors§

Source§

impl Metric<HashMap<String, f64>> for Predicate

Source§

type Error = Error

Source§

impl Metric<Trace<HashMap<String, f64>>> for Predicate

Source§

type Error = TimedError

Source§

impl<T, A, C> Metric<T> for Implies<A, C>
where A: Metric<T>, C: Metric<T>,

Source§

type Error = BinaryError<<A as Metric<T>>::Error, <C as Metric<T>>::Error>

Source§

impl<T, L, R> Metric<T> for And<L, R>
where L: Metric<T>, R: Metric<T>,

Source§

type Error = BinaryError<<L as Metric<T>>::Error, <R as Metric<T>>::Error>

Source§

impl<T, L, R> Metric<T> for Or<L, R>
where L: Metric<T>, R: Metric<T>,

Source§

type Error = BinaryError<<L as Metric<T>>::Error, <R as Metric<T>>::Error>

Source§

impl<T, P> Metric<Trace<T>> for Always<P>
where P: Metric<Trace<T>>,

Source§

type Error = <P as Metric<Trace<T>>>::Error

Source§

impl<T, P> Metric<Trace<T>> for Eventually<P>
where P: Metric<Trace<T>>,

Source§

type Error = <P as Metric<Trace<T>>>::Error

Source§

impl<T, P> Metric<Trace<T>> for Next<P>
where P: Metric<Trace<T>>,

Source§

type Error = TimedOperatorError<<P as Metric<Trace<T>>>::Error>

Source§

impl<T, U> Metric<T> for Not<U>
where U: Metric<T>,

Source§

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