[−][src]Struct argmin::prelude::ArgminBase
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]
O: ArgminOp,
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]
&mut self,
param: &<O as ArgminOp>::Param
) -> Result<<O as ArgminOp>::Output, Error>
Apply the operator to param
pub fn gradient(
&mut self,
param: &<O as ArgminOp>::Param
) -> Result<<O as ArgminOp>::Param, Error>
[src]
&mut self,
param: &<O as ArgminOp>::Param
) -> Result<<O as ArgminOp>::Param, Error>
Compute the gradient at param
pub fn hessian(
&mut self,
param: &<O as ArgminOp>::Param
) -> Result<<O as ArgminOp>::Hessian, Error>
[src]
&mut self,
param: &<O as ArgminOp>::Param
) -> Result<<O as ArgminOp>::Hessian, Error>
Compute the hessian at param
pub fn modify(
&self,
param: &<O as ArgminOp>::Param,
factor: f64
) -> Result<<O as ArgminOp>::Param, Error>
[src]
&self,
param: &<O as ArgminOp>::Param,
factor: f64
) -> Result<<O as ArgminOp>::Param, Error>
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]
&mut self,
param: <O as ArgminOp>::Param
) -> &mut ArgminBase<O>
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]
&mut self,
param: <O as ArgminOp>::Param
) -> &mut ArgminBase<O>
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]
&mut self,
grad: <O as ArgminOp>::Param
) -> &mut ArgminBase<O>
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]
&mut self,
hessian: <O as ArgminOp>::Hessian
) -> &mut ArgminBase<O>
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]
&mut self,
reason: TerminationReason
) -> &mut ArgminBase<O>
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]
&mut self,
logger: Arc<dyn ArgminLog + 'static>
) -> &mut ArgminBase<O>
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]
&mut self,
writer: Arc<dyn ArgminWrite<Param = <O as ArgminOp>::Param> + 'static>
) -> &mut ArgminBase<O>
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]
T: Serialize,
Trait Implementations
impl<O> Serialize for ArgminBase<O> where
O: ArgminOp + Serialize,
<O as ArgminOp>::Param: Serialize,
<O as ArgminOp>::Hessian: Serialize,
[src]
O: ArgminOp + Serialize,
<O as ArgminOp>::Param: Serialize,
<O as ArgminOp>::Hessian: Serialize,
fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
[src]
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
impl<O> Clone for ArgminBase<O> where
O: ArgminOp + Clone,
<O as ArgminOp>::Param: Clone,
<O as ArgminOp>::Hessian: Clone,
[src]
O: ArgminOp + Clone,
<O as ArgminOp>::Param: Clone,
<O as ArgminOp>::Hessian: Clone,
fn clone(&self) -> ArgminBase<O>
[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]
O: ArgminOp,
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]
O: ArgminOp + Deserialize<'de>,
<O as ArgminOp>::Param: Deserialize<'de>,
<O as ArgminOp>::Hessian: Deserialize<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<ArgminBase<O>, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
[src]
__deserializer: __D
) -> Result<ArgminBase<O>, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
Auto Trait Implementations
impl<O> Send for ArgminBase<O> where
<O as ArgminOp>::Hessian: Send,
<O as ArgminOp>::Param: Send,
<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,
<O as ArgminOp>::Hessian: Sync,
<O as ArgminOp>::Param: Sync,
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,