[][src]Struct argmin::prelude::ArgminBase

pub struct ArgminBase<O> where
    O: ArgminOp
{ /* fields omitted */ }

Storage for data needed by most solvers

TODO: cur_cost, best_cost and target_cost should be U, but then initialization is difficult as it cannot be expected that each U has something like INFINITY and NEG_INFINITY...

Methods

impl<O> ArgminBase<O> where
    O: ArgminOp
[src]

pub fn new(operator: O, param: <O as ArgminOp>::Param) -> ArgminBase<O>[src]

Constructor

pub fn kv_for_logs(&self) -> ArgminKV[src]

Return the KV for the initial logging

pub fn kv_for_iter(&self) -> ArgminKV[src]

Return the KV for logging of the iterations

pub fn reset(&mut self)[src]

Reset self to its initial state.

This is dangerous the way it is implemented right now. This has to be done better. For instance, all old data needs to be kept in order to be able to actually go back to the initial state. Also, this method definitely needs to be kept up to date otherwise nasty bugs may happen.

pub fn apply(
    &mut self,
    param: &<O as ArgminOp>::Param
) -> Result<<O as ArgminOp>::Output, Error>
[src]

Apply the operator to param

pub fn gradient(
    &mut self,
    param: &<O as ArgminOp>::Param
) -> Result<<O as ArgminOp>::Param, Error>
[src]

Compute the gradient at param

pub fn hessian(
    &mut self,
    param: &<O as ArgminOp>::Param
) -> Result<<O as ArgminOp>::Hessian, Error>
[src]

Compute the hessian at param

pub fn modify(
    &self,
    param: &<O as ArgminOp>::Param,
    factor: f64
) -> Result<<O as ArgminOp>::Param, Error>
[src]

Modify a param with the modify method of operator.

pub fn set_cur_param(
    &mut self,
    param: <O as ArgminOp>::Param
) -> &mut ArgminBase<O>
[src]

Set the current parameter vector

pub fn cur_param(&self) -> <O as ArgminOp>::Param[src]

Return the current parameter vector

pub fn set_best_param(
    &mut self,
    param: <O as ArgminOp>::Param
) -> &mut ArgminBase<O>
[src]

Set the new best parameter vector

pub fn best_param(&self) -> <O as ArgminOp>::Param[src]

Return the current best parameter vector

pub fn set_cur_cost(&mut self, cost: f64) -> &mut ArgminBase<O>[src]

Set the current cost function value

pub fn cur_cost(&self) -> f64[src]

Return the current cost function value

pub fn set_best_cost(&mut self, cost: f64) -> &mut ArgminBase<O>[src]

Set the cost function value of the current best parameter vector

pub fn best_cost(&self) -> f64[src]

Return the cost function value of the current best parameter vector

pub fn set_cur_grad(
    &mut self,
    grad: <O as ArgminOp>::Param
) -> &mut ArgminBase<O>
[src]

Set the current gradient

pub fn cur_grad(&self) -> <O as ArgminOp>::Param[src]

Return the current gradient

pub fn set_cur_hessian(
    &mut self,
    hessian: <O as ArgminOp>::Hessian
) -> &mut ArgminBase<O>
[src]

Set the current hessian

pub fn cur_hessian(&self) -> <O as ArgminOp>::Hessian[src]

Return the current hessian

pub fn set_target_cost(&mut self, cost: f64) -> &mut ArgminBase<O>[src]

Set the target cost function value

pub fn target_cost(&self) -> f64[src]

Return the target cost function value

pub fn increment_iter(&mut self) -> &mut ArgminBase<O>[src]

Increment the number of iterations.

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

Return the current number of iterations

pub fn increment_cost_func_count(&mut self) -> &mut ArgminBase<O>[src]

Increment the cost function evaluation count

pub fn increase_cost_func_count(&mut self, count: u64) -> &mut ArgminBase<O>[src]

Increaese the cost function evaluation count by a given value

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

Return the cost function evaluation count

pub fn increment_grad_func_count(&mut self) -> &mut ArgminBase<O>[src]

Increment the gradient evaluation count

pub fn increase_grad_func_count(&mut self, count: u64) -> &mut ArgminBase<O>[src]

Increase the gradient evaluation count by a given value

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

Return the gradient evaluation count

pub fn increment_hessian_func_count(&mut self) -> &mut ArgminBase<O>[src]

Increment the hessian evaluation count

pub fn increase_hessian_func_count(&mut self, count: u64) -> &mut ArgminBase<O>[src]

Increase the hessian evaluation count by a given value

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

Return the gradient evaluation count

pub fn set_max_iters(&mut self, iters: u64) -> &mut ArgminBase<O>[src]

Set the maximum number of iterations.

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

Return the maximum number of iterations

pub fn set_termination_reason(
    &mut self,
    reason: TerminationReason
) -> &mut ArgminBase<O>
[src]

Set the TerminationReason

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

Return the TerminationReason

pub fn termination_reason_text(&self) -> &str[src]

Return the textual representation of the TerminationReason

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

Return whether the algorithm has terminated or not

pub fn result(&self) -> ArgminResult<<O as ArgminOp>::Param>[src]

Return the result.

pub fn set_total_time(&mut self, time: Duration) -> &mut ArgminBase<O>[src]

Set the total time needed by the solver

pub fn total_time(&self) -> Duration[src]

Return the total time

pub fn add_logger(
    &mut self,
    logger: Arc<dyn ArgminLog + 'static>
) -> &mut ArgminBase<O>
[src]

Add a logger to the list of loggers

pub fn add_writer(
    &mut self,
    writer: Arc<dyn ArgminWrite<Param = <O as ArgminOp>::Param> + 'static>
) -> &mut ArgminBase<O>
[src]

Add a writer to the list of writers

pub fn log_iter(&self, kv: &ArgminKV) -> Result<(), Error>[src]

Log a kv

pub fn log_info(&self, msg: &str, kv: &ArgminKV) -> Result<(), Error>[src]

Log a message and a kv

pub fn write(&self, param: &<O as ArgminOp>::Param) -> Result<(), Error>[src]

Write

pub fn set_checkpoint_dir(&mut self, dir: &str)[src]

Set checkpoint directory

pub fn set_checkpoint_name(&mut self, dir: &str)[src]

Set checkpoint name

pub fn set_checkpoint_mode(&mut self, mode: CheckpointMode)[src]

pub fn store_checkpoint<T>(&self, solver: &T) -> Result<(), Error> where
    T: Serialize
[src]

Trait Implementations

impl<O> Serialize for ArgminBase<O> where
    O: ArgminOp + Serialize,
    <O as ArgminOp>::Param: Serialize,
    <O as ArgminOp>::Hessian: Serialize
[src]

impl<O> Clone for ArgminBase<O> where
    O: ArgminOp + Clone,
    <O as ArgminOp>::Param: Clone,
    <O as ArgminOp>::Hessian: Clone
[src]

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

Performs copy-assignment from source. Read more

impl<O> Debug for ArgminBase<O> where
    O: ArgminOp
[src]

impl<'de, O> Deserialize<'de> for ArgminBase<O> where
    O: ArgminOp + Deserialize<'de>,
    <O as ArgminOp>::Param: Deserialize<'de>,
    <O as ArgminOp>::Hessian: Deserialize<'de>, 
[src]

Auto Trait Implementations

impl<O> Send for ArgminBase<O> where
    <O as ArgminOp>::Hessian: Send,
    <O as ArgminOp>::Param: Send

impl<O> Sync for ArgminBase<O> where
    <O as ArgminOp>::Hessian: Sync,
    <O as ArgminOp>::Param: Sync

Blanket Implementations

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

type Owned = T

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

impl<T> From for T[src]

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

type Error = !

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

The type returned in the event of a conversion error.

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

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

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

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

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

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

The type returned in the event of a conversion error.

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