Struct argmin::core::IterState[][src]

pub struct IterState<O: ArgminOp> {
Show fields pub param: O::Param, pub prev_param: O::Param, pub best_param: O::Param, pub prev_best_param: O::Param, pub cost: O::Float, pub prev_cost: O::Float, pub best_cost: O::Float, pub prev_best_cost: O::Float, pub target_cost: O::Float, pub grad: Option<O::Param>, pub prev_grad: Option<O::Param>, pub hessian: Option<O::Hessian>, pub prev_hessian: Option<O::Hessian>, pub jacobian: Option<O::Jacobian>, pub prev_jacobian: Option<O::Jacobian>, pub population: Option<Vec<(O::Param, O::Float)>>, pub iter: u64, pub last_best_iter: u64, pub max_iters: u64, pub cost_func_count: u64, pub grad_func_count: u64, pub hessian_func_count: u64, pub jacobian_func_count: u64, pub modify_func_count: u64, pub time: Option<Duration>, pub termination_reason: TerminationReason,
}
Expand description

Maintains the state from iteration to iteration of a solver

Fields

param: O::Param

Current parameter vector

prev_param: O::Param

Previous parameter vector

best_param: O::Param

Current best parameter vector

prev_best_param: O::Param

Previous best parameter vector

cost: O::Float

Current cost function value

prev_cost: O::Float

Previous cost function value

best_cost: O::Float

Current best cost function value

prev_best_cost: O::Float

Previous best cost function value

target_cost: O::Float

Target cost function value

grad: Option<O::Param>

Current gradient

prev_grad: Option<O::Param>

Previous gradient

hessian: Option<O::Hessian>

Current Hessian

prev_hessian: Option<O::Hessian>

Previous Hessian

jacobian: Option<O::Jacobian>

Current Jacobian

prev_jacobian: Option<O::Jacobian>

Previous Jacobian

population: Option<Vec<(O::Param, O::Float)>>

All members for population-based algorithms as (param, cost) tuples

iter: u64

Current iteration

last_best_iter: u64

Iteration number of last best cost

max_iters: u64

Maximum number of iterations

cost_func_count: u64

Number of cost function evaluations so far

grad_func_count: u64

Number of gradient evaluations so far

hessian_func_count: u64

Number of Hessian evaluations so far

jacobian_func_count: u64

Number of Jacobian evaluations so far

modify_func_count: u64

Number of modify evaluations so far

time: Option<Duration>

Time required so far

termination_reason: TerminationReason

Reason of termination

Implementations

impl<O: ArgminOp> IterState<O>[src]

pub fn new(param: O::Param) -> Self[src]

Create new IterState from param

pub fn param(&mut self, param: O::Param) -> &mut Self[src]

Set parameter vector. This shifts the stored parameter vector to the previous parameter vector.

pub fn best_param(&mut self, param: O::Param) -> &mut Self[src]

Set best paramater vector. This shifts the stored best parameter vector to the previous best parameter vector.

pub fn cost(&mut self, cost: O::Float) -> &mut Self[src]

Set the current cost function value. This shifts the stored cost function value to the previous cost function value.

pub fn best_cost(&mut self, cost: O::Float) -> &mut Self[src]

Set the current best cost function value. This shifts the stored best cost function value to the previous cost function value.

pub fn grad(&mut self, grad: O::Param) -> &mut Self[src]

Set gradient. This shifts the stored gradient to the previous gradient.

pub fn hessian(&mut self, hessian: O::Hessian) -> &mut Self[src]

Set Hessian. This shifts the stored Hessian to the previous Hessian.

pub fn jacobian(&mut self, jacobian: O::Jacobian) -> &mut Self[src]

Set Jacobian. This shifts the stored Jacobian to the previous Jacobian.

pub fn population(&mut self, population: Vec<(O::Param, O::Float)>) -> &mut Self[src]

Set population

pub fn target_cost(&mut self, target_cost: O::Float) -> &mut Self[src]

Set target cost value

pub fn max_iters(&mut self, max_iters: u64) -> &mut Self[src]

Set maximum number of iterations

pub fn last_best_iter(&mut self, last_best_iter: u64) -> &mut Self[src]

Set iteration number where the previous best parameter vector was found

pub fn termination_reason(
    &mut self,
    termination_reason: TerminationReason
) -> &mut Self
[src]

Set termination_reason

pub fn time(&mut self, time: Option<Duration>) -> &mut Self[src]

Set time required so far

pub fn get_param(&self) -> O::Param[src]

Returns current parameter vector

pub fn get_prev_param(&self) -> O::Param[src]

Returns previous parameter vector

pub fn get_best_param(&self) -> O::Param[src]

Returns best parameter vector

pub fn get_prev_best_param(&self) -> O::Param[src]

Returns previous best parameter vector

pub fn get_cost(&self) -> O::Float[src]

Returns current cost function value

pub fn get_prev_cost(&self) -> O::Float[src]

Returns previous cost function value

pub fn get_best_cost(&self) -> O::Float[src]

Returns current best cost function value

pub fn get_prev_best_cost(&self) -> O::Float[src]

Returns previous best cost function value

pub fn get_target_cost(&self) -> O::Float[src]

Returns target cost

pub fn get_cost_func_count(&self) -> u64[src]

Returns current cost function evaluation count

pub fn get_grad_func_count(&self) -> u64[src]

Returns current gradient function evaluation count

pub fn get_hessian_func_count(&self) -> u64[src]

Returns current Hessian function evaluation count

pub fn get_jacobian_func_count(&self) -> u64[src]

Returns current Jacobian function evaluation count

pub fn get_modify_func_count(&self) -> u64[src]

Returns current Modify function evaluation count

pub fn get_last_best_iter(&self) -> u64[src]

Returns iteration number where the last best parameter vector was found

pub fn get_termination_reason(&self) -> TerminationReason[src]

Get termination_reason

pub fn get_time(&self) -> Option<Duration>[src]

Get time required so far

pub fn get_grad(&self) -> Option<O::Param>[src]

Returns gradient

pub fn get_prev_grad(&self) -> Option<O::Param>[src]

Returns previous gradient

pub fn get_hessian(&self) -> Option<O::Hessian>[src]

Returns current Hessian

pub fn get_prev_hessian(&self) -> Option<O::Hessian>[src]

Returns previous Hessian

pub fn get_jacobian(&self) -> Option<O::Jacobian>[src]

Returns current Jacobian

pub fn get_prev_jacobian(&self) -> Option<O::Jacobian>[src]

Returns previous Jacobian

pub fn get_iter(&self) -> u64[src]

Returns current number of iterations

pub fn get_max_iters(&self) -> u64[src]

Returns maximum number of iterations

pub fn get_population(&self) -> Option<&Vec<(O::Param, O::Float)>>[src]

Returns population

pub fn increment_iter(&mut self)[src]

Increment the number of iterations by one

pub fn increment_func_counts(&mut self, op: &OpWrapper<O>)[src]

Increment all function evaluation counts by the evaluation counts of another operator wrapped in OpWrapper.

pub fn set_func_counts(&mut self, op: &OpWrapper<O>)[src]

Set all function evaluation counts to the evaluation counts of another operator wrapped in OpWrapper.

pub fn increment_cost_func_count(&mut self, num: u64)[src]

Increment cost function evaluation count by num

pub fn increment_grad_func_count(&mut self, num: u64)[src]

Increment gradient function evaluation count by num

pub fn increment_hessian_func_count(&mut self, num: u64)[src]

Increment Hessian function evaluation count by num

pub fn increment_jacobian_func_count(&mut self, num: u64)[src]

Increment Jacobian function evaluation count by num

pub fn increment_modify_func_count(&mut self, num: u64)[src]

Increment modify function evaluation count by num

pub fn new_best(&mut self)[src]

Indicate that a new best parameter vector was found

pub fn is_best(&self) -> bool[src]

Returns whether the current parameter vector is also the best parameter vector found so far.

pub fn terminated(&self) -> bool[src]

Return whether the algorithm has terminated or not

Trait Implementations

impl<O: Clone + ArgminOp> Clone for IterState<O> where
    O::Param: Clone,
    O::Param: Clone,
    O::Param: Clone,
    O::Param: Clone,
    O::Float: Clone,
    O::Float: Clone,
    O::Float: Clone,
    O::Float: Clone,
    O::Float: Clone,
    O::Param: Clone,
    O::Param: Clone,
    O::Hessian: Clone,
    O::Hessian: Clone,
    O::Jacobian: Clone,
    O::Jacobian: Clone,
    O::Param: Clone,
    O::Float: Clone
[src]

fn clone(&self) -> IterState<O>[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<O: Debug + ArgminOp> Debug for IterState<O> where
    O::Param: Debug,
    O::Param: Debug,
    O::Param: Debug,
    O::Param: Debug,
    O::Float: Debug,
    O::Float: Debug,
    O::Float: Debug,
    O::Float: Debug,
    O::Float: Debug,
    O::Param: Debug,
    O::Param: Debug,
    O::Hessian: Debug,
    O::Hessian: Debug,
    O::Jacobian: Debug,
    O::Jacobian: Debug,
    O::Param: Debug,
    O::Float: Debug
[src]

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

Formats the value using the given formatter. Read more

impl<O: ArgminOp> Default for IterState<O> where
    O::Param: Default
[src]

fn default() -> Self[src]

Returns the “default value” for a type. Read more

impl<'de, O: ArgminOp> Deserialize<'de> for IterState<O> where
    O::Param: Deserialize<'de>,
    O::Param: Deserialize<'de>,
    O::Param: Deserialize<'de>,
    O::Param: Deserialize<'de>,
    O::Float: Deserialize<'de>,
    O::Float: Deserialize<'de>,
    O::Float: Deserialize<'de>,
    O::Float: Deserialize<'de>,
    O::Float: Deserialize<'de>, 
[src]

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

Deserialize this value from the given Serde deserializer. Read more

impl<O: ArgminOp> KV for IterState<O>[src]

fn serialize(
    &self,
    _record: &Record<'_>,
    serializer: &mut dyn Serializer
) -> Result
[src]

Serialize self into Serializer Read more

impl<O: ArgminOp> Serialize for IterState<O> where
    O::Param: Serialize,
    O::Param: Serialize,
    O::Param: Serialize,
    O::Param: Serialize,
    O::Float: Serialize,
    O::Float: Serialize,
    O::Float: Serialize,
    O::Float: Serialize,
    O::Float: Serialize
[src]

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

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

impl<O> RefUnwindSafe for IterState<O> where
    <O as ArgminOp>::Float: RefUnwindSafe,
    <O as ArgminOp>::Hessian: RefUnwindSafe,
    <O as ArgminOp>::Jacobian: RefUnwindSafe,
    <O as ArgminOp>::Param: RefUnwindSafe

impl<O> Send for IterState<O> where
    <O as ArgminOp>::Float: Send,
    <O as ArgminOp>::Hessian: Send,
    <O as ArgminOp>::Jacobian: Send,
    <O as ArgminOp>::Param: Send

impl<O> Sync for IterState<O> where
    <O as ArgminOp>::Float: Sync,
    <O as ArgminOp>::Hessian: Sync,
    <O as ArgminOp>::Jacobian: Sync,
    <O as ArgminOp>::Param: Sync

impl<O> Unpin for IterState<O> where
    <O as ArgminOp>::Float: Unpin,
    <O as ArgminOp>::Hessian: Unpin,
    <O as ArgminOp>::Jacobian: Unpin,
    <O as ArgminOp>::Param: Unpin

impl<O> UnwindSafe for IterState<O> where
    <O as ArgminOp>::Float: UnwindSafe,
    <O as ArgminOp>::Hessian: UnwindSafe,
    <O as ArgminOp>::Jacobian: UnwindSafe,
    <O as ArgminOp>::Param: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

pub fn vzip(self) -> V

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> SendSyncRefUnwindSafeKV for T where
    T: KV + Send + Sync + RefUnwindSafe + ?Sized
[src]

impl<T> SendSyncUnwindSafe for T where
    T: Send + Sync + UnwindSafe + ?Sized
[src]