Helios++
Helios software for LiDAR simulations
|
Base implementation of an iterative method. More...
#include <IterativeMethodHandler.h>
Public Types | |
enum | IterativeMethodStatus { PATIENCE_EARLY_STOPPING , MAX_ITERATIONS , CONVERGENCE , CONTINUE } |
Enumeration with different iterative method status. More... | |
Public Member Functions | |
IterativeMethodHandler (size_t maxIters, bool enableConvergenceCriterion=false, ET convergenceEps=0.000000001, size_t patience=0, ET patienceEps=0.000000001, bool patiencePreserveBest=true) | |
Iterative method constructor. More... | |
virtual IterativeMethodStatus | handleEndOfIteration (IT const &input, ET const &error) |
Handle end of iteration. More... | |
virtual size_t | getMaxIters () const |
Obtain the maximum number of iterations. More... | |
virtual void | setMaxIters (size_t const maxIters) |
Set the maximum number of iterations. More... | |
virtual size_t | getCurrentIter () const |
Obtain the number of current iteration. More... | |
virtual void | setCurrentIter (size_t const iter) |
Set the number of current iteration. More... | |
virtual size_t | getPatience () const |
Obtain the patience of the iterative method. More... | |
virtual void | setPatience (size_t const patience) |
Set the patience of the iterative method. More... | |
virtual size_t | getPatienceCount () const |
Obtain number of consecutive iterations without improvement. More... | |
virtual void | setPatienceCount (size_t const count) |
Set the number of consecutive iterations without improvement. More... | |
virtual ET | getPatienceEps () const |
Obtain the tolerance criterion for patience based early stopping. More... | |
virtual void | setPatienceEps (ET const eps) |
Set the tolerance criterion for patience based early stopping. More... | |
virtual bool | isPatiencePreservingBest () const |
Check whether the patience based early stopping mechanism is preserving best (true) or not (false) More... | |
virtual void | setPatiencePreserveBest (bool const preserveBest) |
Set the patience based early stopping mechanism preserve best mode. More... | |
virtual ET | getPatienceBestError () const |
Get the patience based early stopping mechanism best known error. More... | |
virtual void | setPatienceBestError (ET bestError) |
Set the patience based early stopping mechanism best known error. More... | |
virtual IT | getPatienceBestInput () const |
Obtain the input of best known case for patience based early stopping mechanism. More... | |
virtual void | setPatienceBestInput (IT bestInput) |
Set the input of best known case for patience based early stopping mechanism. More... | |
Protected Attributes | |
size_t | maxIters |
Maximum number of iterations for the iterative method. More... | |
size_t | currentIter |
The current iteration of the iterative method. | |
bool | enableConvergenceCriterion |
True to enable the usage of convergence criterion. | |
ET | convergenceEps |
The convergence threshold \(\epsilon\). More... | |
size_t | patience |
How many consecutive iterations with no improvement will be tolerated until aborting. More... | |
size_t | patienceCount |
Count of how many consecutive iterations without improvement have elapsed. | |
ET | patienceEps |
The tolerance criterion \(\epsilon\) to determine whether there have been an improvement or not. More... | |
bool | patiencePreserveBest |
True to enable preserving best known input when early stopping because of patience, false to disable it. | |
ET | patienceBestError |
Error of best known case for patience based early stopping mechanism. | |
IT | patienceBestInput |
Input of best known case for patience based early stopping mechanism. | |
Private Member Functions | |
template<typename Archive > | |
void | serialize (Archive &ar, unsigned int const version) |
Serialize the iterative method handler to a stream of bytes. More... | |
Friends | |
class | boost::serialization::access |
Base implementation of an iterative method.
It supports control by maximum number of iterations, a good enough convergence criterion and a patience based early stopping mechanism.
IT | Input type |
ET | Error type |
enum fluxionum::IterativeMethodHandler::IterativeMethodStatus |
Enumeration with different iterative method status.
|
inline |
|
inlinevirtual |
Obtain the number of current iteration.
|
inlinevirtual |
Obtain the maximum number of iterations.
|
inlinevirtual |
Obtain the patience of the iterative method.
|
inlinevirtual |
Get the patience based early stopping mechanism best known error.
|
inlinevirtual |
Obtain the input of best known case for patience based early stopping mechanism.
|
inlinevirtual |
Obtain number of consecutive iterations without improvement.
|
inlinevirtual |
Obtain the tolerance criterion for patience based early stopping.
|
virtual |
Handle end of iteration.
error | Error at given iteration |
|
inlinevirtual |
Check whether the patience based early stopping mechanism is preserving best (true) or not (false)
|
inlineprivate |
Serialize the iterative method handler to a stream of bytes.
Archive | Type of rendering |
ar | Specific rendering for the stream of bytes |
version | Version number for the iterative method handler |
|
inlinevirtual |
Set the number of current iteration.
iter | New number of current iteration |
|
inlinevirtual |
Set the maximum number of iterations.
maxIters | New maximum number of iterations |
|
inlinevirtual |
Set the patience of the iterative method.
patience | New patience of the iterative method |
|
inlinevirtual |
Set the patience based early stopping mechanism best known error.
bestError | New best known error |
|
inlinevirtual |
Set the input of best known case for patience based early stopping mechanism.
bestInput | New best input for patience based early stopping mechanism |
|
inlinevirtual |
Set the number of consecutive iterations without improvement.
count | New number of consecutive iterations without improvement |
|
inlinevirtual |
Set the tolerance criterion for patience based early stopping.
eps | New tolerance criterion for patience based early stopping |
|
inlinevirtual |
Set the patience based early stopping mechanism preserve best mode.
preserveBest | True to enabled preserve best mode, false to disable it |
|
protected |
The convergence threshold \(\epsilon\).
The iterative method will stop, even if the maximum number of iterations has not been reached, when \(\xi \leq \epsilon \) where \(\xi\) is the convergence error.
|
protected |
Maximum number of iterations for the iterative method.
While usage of this attribute may vary depending on the class which extends the implementation, the default behavior expects that \(0\) means no maximum number of iterations while \(>0\) sets a concrete maximum number of iterations for the iterative method
|
protected |
How many consecutive iterations with no improvement will be tolerated until aborting.
While usage of this attribute may vary depending on the class which extends the implementation, the default behavior expects that \(0\) means no patience mechanism will be used while \(>0\) sets a concrete maximum number of iterations without improvement for the patience based early stopping mechanism
|
protected |
The tolerance criterion \(\epsilon\) to determine whether there have been an improvement or not.
Let \(\xi_*\) be the lowest (best) patience error and \(\xi\) the error at current iteration. Thus, there is an improvement if and only if \(\xi - \xi_* \leq \epsilon\).