LINE Solver (C++)
Templated C++ port of the LINE queueing solver
Loading...
Searching...
No Matches
line::ln::LnStochController< T > Class Template Reference

Convergence controller for an ensemble whose layers are solved by a NOISY method (simulation, or Monte Carlo normalizing constants). More...

#include <line/solvers/ln/lqn_analyzers.h>

Public Member Functions

 LnStochController (const LnStochConfig &cfg)
bool update (int it, const std::vector< LayerResult< T > > &latest, const std::vector< double > &layer_jobs, const std::vector< T > &servt, const std::vector< T > &residt)
 Fold iteration it in and say whether the iteration may stop.
double relax_omega () const
const std::vector< double > & iteration_error () const
 Per-iteration drift, 1-based; slot 0 is unused.
long averaging_count () const
long averaging_start () const
 Iteration at which averaging started, -1 while still in burn-in.
const std::vector< LayerResult< T > > & averaged_results () const
const std::vector< T > & averaged_servt () const
const std::vector< T > & averaged_residt () const

Detailed Description

template<class T>
class line::ln::LnStochController< T >

Convergence controller for an ensemble whose layers are solved by a NOISY method (simulation, or Monte Carlo normalizing constants).

The Robbins-Monro / Polyak-Ruppert controller, defined in lqn_analyzers.h.

Port of @SolverLN/convergedStoch.m. The deterministic test in SolverLN::converged cannot terminate against noise: the successive-difference error is bounded below by the standard error of the layer estimates, and the layer-reset confirmation step only resamples that noise. This replaces it with a stochastic approximation scheme:

  1. Burn-in. Plain Picard at the relaxation init chose, to get near the fixed point fast while the noise still does not matter.
  2. Robbins-Monro. relax_omega then decays as a0/k^alpha, so the iterate converges almost surely under the contraction assumption the deterministic iteration already makes plus zero-mean bounded-variance noise (Robbins and Monro, 1951). The caller must actually APPLY relax_omega to the fed-forward iterate for any of this to hold.
  3. Polyak-Ruppert. Running averages of the layer results and of the reported iterate, which give the optimal O(1/sqrt(k)) rate and make the answer insensitive to a0 (Polyak and Juditsky, 1992).
  4. Stopping on the DRIFT OF THE AVERAGE, not of the iterate. That drift decays like 1/k even under persistent noise, so the test terminates, and it self-calibrates: noisier layers hold the drift above tolerance longer and buy themselves more averaging.

The reference averages QN, UN, RN, TN, AN and WN; LayerResult carries no AN, so five fields are averaged here and the sixth is not silently invented.

DECLARED HERE, not included: same mutual dependence as above. iterate holds one through a shared_ptr rather than by value so that this class stays complete without it – a by-value member would need the definition at the point the class template is instantiated, and the definition arrives at the foot of this file.

ITS CONFIG CANNOT BE DEFERRED THE SAME WAY. iterate names LnStochConfig by value, and that name does not depend on T, so it is looked up and required COMPLETE when the template is parsed rather than when it is instantiated – the shared_ptr trick only defers the class template beside it.

Definition at line 368 of file lqn_analyzers.h.

Constructor & Destructor Documentation

◆ LnStochController()

template<class T>
line::ln::LnStochController< T >::LnStochController ( const LnStochConfig & cfg)
inlineexplicit

Definition at line 370 of file lqn_analyzers.h.

Member Function Documentation

◆ averaged_residt()

template<class T>
const std::vector< T > & line::ln::LnStochController< T >::averaged_residt ( ) const
inline

Definition at line 447 of file lqn_analyzers.h.

◆ averaged_results()

template<class T>
const std::vector< LayerResult< T > > & line::ln::LnStochController< T >::averaged_results ( ) const
inline

Definition at line 445 of file lqn_analyzers.h.

◆ averaged_servt()

template<class T>
const std::vector< T > & line::ln::LnStochController< T >::averaged_servt ( ) const
inline

Definition at line 446 of file lqn_analyzers.h.

◆ averaging_count()

template<class T>
long line::ln::LnStochController< T >::averaging_count ( ) const
inline

Definition at line 442 of file lqn_analyzers.h.

◆ averaging_start()

template<class T>
long line::ln::LnStochController< T >::averaging_start ( ) const
inline

Iteration at which averaging started, -1 while still in burn-in.

Definition at line 444 of file lqn_analyzers.h.

◆ iteration_error()

template<class T>
const std::vector< double > & line::ln::LnStochController< T >::iteration_error ( ) const
inline

Per-iteration drift, 1-based; slot 0 is unused.

Definition at line 441 of file lqn_analyzers.h.

◆ relax_omega()

template<class T>
double line::ln::LnStochController< T >::relax_omega ( ) const
inline

Definition at line 439 of file lqn_analyzers.h.

◆ update()

template<class T>
bool line::ln::LnStochController< T >::update ( int it,
const std::vector< LayerResult< T > > & latest,
const std::vector< double > & layer_jobs,
const std::vector< T > & servt,
const std::vector< T > & residt )
inline

Fold iteration it in and say whether the iteration may stop.

it counts from 1 and must advance by one per call. layer_jobs is the total closed population of each layer, which normalizes the drift so that layers of very different size contribute comparably.

Definition at line 379 of file lqn_analyzers.h.

References line::ln::LayerResult< T >::QN, line::ln::LayerResult< T >::RN, line::ln::LayerResult< T >::TN, line::ln::LayerResult< T >::UN, and line::ln::LayerResult< T >::WN.


The documentation for this class was generated from the following file: