Struct ModifyOptimizer

Source
pub struct ModifyOptimizer<M, U> {
    pub modifier: M,
    pub utility: U,
    pub tries: usize,
    pub depth: usize,
}
Expand description

Modifies an object using a modifier by maximizing utility.

Fields§

§modifier: M

The modifier to modify the object.

§utility: U

The measured utility.

§tries: usize

The number of tries before giving up.

§depth: usize

The number of repeated modifications before backtracking.

Trait Implementations§

Source§

impl<T, M, U> Modifier<T> for ModifyOptimizer<M, U>
where M: Modifier<T>, U: Utility<T>, M::Change: Clone,

Source§

type Change = Vec<<M as Modifier<T>>::Change>

The change applied to an object.
Source§

fn modify(&mut self, obj: &mut T) -> Self::Change

Modify an object and return the change. Read more
Source§

fn undo(&mut self, change: &Self::Change, obj: &mut T)

Undo change made to an object. Read more
Source§

fn redo(&mut self, change: &Self::Change, obj: &mut T)

Redo change made to an object. Read more
Source§

fn undo_meaning(&mut self, _change: &Self::Change)

Undo meaning change in the modifier introduced by a change. Read more
Source§

fn redo_meaning(&mut self, _change: &Self::Change)

Redo meaning change in the modifier. Read more

Auto Trait Implementations§

§

impl<M, U> Freeze for ModifyOptimizer<M, U>
where M: Freeze, U: Freeze,

§

impl<M, U> RefUnwindSafe for ModifyOptimizer<M, U>

§

impl<M, U> Send for ModifyOptimizer<M, U>
where M: Send, U: Send,

§

impl<M, U> Sync for ModifyOptimizer<M, U>
where M: Sync, U: Sync,

§

impl<M, U> Unpin for ModifyOptimizer<M, U>
where M: Unpin, U: Unpin,

§

impl<M, U> UnwindSafe for ModifyOptimizer<M, U>
where M: UnwindSafe, U: 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.