template<typename Rng_, typename MHWalker_, typename MHRWStatsCollector_, typename LoggerType_, typename CountIntType_ = int>
class Tomographer::MHRandomWalk< Rng_, MHWalker_, MHRWStatsCollector_, LoggerType_, CountIntType_ >
A Metropolis-Hastings Random Walk.
Implements a Metropolis-Hastings random walk. This takes care of accepting or rejecting a new point and taking samples.
This class takes care to update the state of a random walk for it to perform thermalizing sweeps, followed by "live" runs.
The random walk is composed of iterations. There are n_sweep
iterations per "sweep". This number should be approximately chosen such that step_size * n_sweep
is of order of the size of the state space. (This is in order to better decorrelate the samples.)
Initially, a number n_therm
of thermalizing sweeps are performed. No samples are taken during this period, and this is meant for a Metropolis random walk to find its "valley".
After the thermalizing runs, a number of run sweeps are performed, in which a live sample is taken at the last iteration of each sweep.
- Template Parameters
-
Rng | is a C++ random number generator (for example, std::mt19937) |
MHWalker | is responsible for dealing with the state space, providing a new proposal point and calculating the function value at different points. See MHWalker Interface. |
MHRWStatsCollector | takes care of collecting useful data during a random walk. It should be a type implementing a MHRWStatsCollector interface, see MHRWStatsCollector Interface. |
LoggerType | is a logger type to which log messages can be generated (see Logging and Loggers) |
CountIntType | is an integer type used to count the number of iterations. You'll want to use int here, unless you really want to pursue exceptionally long random walks. |
Definition at line 290 of file mhrw.h.
template<typename Rng_, typename MHWalker_, typename MHRWStatsCollector_, typename LoggerType_, typename CountIntType_ = int>
Run the random walk. (pun intended)
This will take care of the full random walk. The specified number of thermalizing sweeps will be run, followed by a number of "live" sweeps where one sample is taken per sweep.
Definition at line 569 of file mhrw.h.
template<typename Rng_, typename MHWalker_, typename MHRWStatsCollector_, typename LoggerType_, typename CountIntType_ = int>
Force manual state of random walk.
This may be called to force setting the current state of the random walk to the given point pt
.
Definition at line 451 of file mhrw.h.