Skip to main content

FalliblePreference

Struct FalliblePreference 

Source
pub struct FalliblePreference<F, E>
where F: Fn(&[f64]) -> Result<f64, E>,
{ /* private fields */ }
Expand description

Consumer preference backed by a fallible utility function.

This variant is intended for frontends that need utility evaluation to return errors instead of assuming the utility function is infallible.

Implementations§

Source§

impl<F, E> FalliblePreference<F, E>
where F: Fn(&[f64]) -> Result<f64, E>,

Source

pub fn with_validation( utility_func: F, min_bounds: Vec<f64>, max_bounds: Vec<f64>, validate: bool, ) -> Result<Self, PreferenceError<E>>

Source

pub fn with_config( utility_func: F, min_bounds: Vec<f64>, max_bounds: Vec<f64>, config: ValidationConfig, calc_config: CalcConfig, ) -> Result<Self, PreferenceError<E>>

Source

pub fn get_utility(&self, bundle: &[f64]) -> Result<f64, PreferenceError<E>>

Source

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

Source

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

Source

pub fn get_mu( &self, bundle: &[f64], good: usize, ) -> Result<f64, PreferenceError<E>>

Source

pub fn get_mrs( &self, bundle: &[f64], good_i: usize, good_j: usize, ) -> Result<f64, PreferenceError<E>>

Auto Trait Implementations§

§

impl<F, E> Freeze for FalliblePreference<F, E>
where F: Freeze,

§

impl<F, E> RefUnwindSafe for FalliblePreference<F, E>
where F: RefUnwindSafe,

§

impl<F, E> Send for FalliblePreference<F, E>
where F: Send,

§

impl<F, E> Sync for FalliblePreference<F, E>
where F: Sync,

§

impl<F, E> Unpin for FalliblePreference<F, E>
where F: Unpin,

§

impl<F, E> UnsafeUnpin for FalliblePreference<F, E>
where F: UnsafeUnpin,

§

impl<F, E> UnwindSafe for FalliblePreference<F, E>
where F: 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> 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, 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.