Implements parallel temperering or the parallel hierarchical sampler.
|
Global variables |
| enum | Algorithm { standard,
hierarchical
} |
| | Algorithm types. More...
|
| enum | Control { parallel,
serial
} |
| | Parallelization type. More...
|
| enum | Initial { user_supplied,
prior_sampled
} |
| | Initialization type. More...
|
|
static Algorithm | algo |
| | Current algorithm.
|
|
static Control | cntrl |
| | Current control.
|
|
static Initial | initial |
| | Initialization method.
|
|
static double | swapprob |
| | Swap probability.
|
|
static double | apow |
| | Change temperature spacing (apow=1 is geometric spacing).
|
|
static double | tpow |
| | Scale factor $T^{tpow}$ for proposal function.
|
|
static int | minmc |
| | Minimum number of temperature states.
|
|
static int | state_iter |
| | Number of iterations allowed for finding a good initial state.
|
|
vector< unsigned short > | fail |
| | Status vector for sampling new states.
|
| void | SampleNewState (int k) |
| | Attempt to find a good state from the prior distribution for chain k.
|
|
void | SampleNewStateParallel (int k) |
| | Sample a new state for the kth chain (parallel version).
|
|
void | SampleNewStateSerial (int k) |
| | Sample a new state for the kth chain (serial version).
|
|
void | NewStateSerialInit () |
| | Prepare for chain initialization.
|
|
void | NewStateSerialStatus () |
| | Check the status of the initialization.
|
Public Member Functions |
|
virtual | ~ParallelChains () |
| | Destructor.
|
|
virtual void | Initialize () |
| | Initialize all the chains.
|
|
virtual void | Reinitialize (MHWidth *width, MixturePrior *mp) |
| | Reinitialize with new class instances.
|
|
|
| ParallelChains (int max, int ndim, int minmc_p, double maxT, MHWidth *width, BaseDataTree *d, Model *m, Integration *i, Converge *c, MixturePrior *mp, LikelihoodComputation *l, MCAlgorithm *mca) |
| | Constructor.
|
|
| ParallelChains (int max, int ndim, int minmc_p, double maxT, MHWidth *width, BaseDataTree *d, Model *m, Integration *i, Converge *c, MixturePrior *mp, LikelihoodComputation *l, MCAlgorithm *mca, Simulation *last) |
|
|
void | NewState (int Mcur, vector< double > &w, vector< vector< double > > &p) |
| | Initialize new state (override from Simulation).
|
|
void | NewState (Chain &ch) |
|
void | NewState (State &s) |
|
| void | SetAlgorithm (int) |
| | Set global parameters.
|
|
void | SetControl (int) |
| | Choose parallelization control (parallel=0, serial=1).
|
|
void | SetInitial (int) |
| | Choose initialization type (user_supplied=0, prior_sampled=1).
|
|
void | SetTempExp (double a, double t) |
| | Choose temperature scaling parameters.
|
|
| void | SetNewWidths (vector< double > *wid) |
| | Set chains widths to new values.
|
|
void | SetNewWidths (string wid) |
| | Set chains widths to new values (file name input).
|
|
|
double | GetValue () |
| | Return current posterior probability value (override).
|
|
double | GetPrior () |
| | Return current prior value (override).
|
|
double | GetLikelihood () |
| | Return current likelihood probability value.
|
|
State | GetState () |
| | Return current state (override).
|
|
virtual void | ReportState () |
| | Print passed state in ascii with labels (override).
|
|
void | PrintState () |
| | Print current state (override).
|
|
virtual void | PrintStepDiagnostic () |
| | override of Simulation method to provide diagnostics specific to temperedsimulation
|
| virtual void | PrintStateDiagnostic () |
| | override of Simulation method to provide state specific diagnostics.
|
|
vector< double > | GetMixstat (void) |
| | Return vector with fraction of swaps for each chain.
|
|
vector< double > | GetSweepstat (void) |
| | Return vector with fraction of acceptences for each chain.
|
|
void | NewNumber (int) |
| | Specify the number of desired chains.
|
|
void | NewSwapProb (double p) |
| | Change the swap probabability.
|
|
void | EnableLogging () |
| | Enable caching per chain.
|
|
void | AdditionalInfo () |
| | Print out simulation specific diagnostics.
|
Protected Member Functions |
|
virtual void | MCMethod () |
| | Execute a Markov Chain step.
|
|
void | CreateChains () |
| | Create the chain structures.
|
|
| void | ResetChainStats () |
| | For gathering diagnostic data.
|
|
void | getChainCounts () |
| | Gathers in-chain rates across all processes.
|
Protected Attributes |
|
bool | caching |
| | True if chains states are logged to files.
|
|
unsigned | ncount |
| | Number of attempts so far.
|
|
Uniform * | unit |
| | Unit interval variates.
|
|
bool | chains_initialized |
| | True if state values have been computed for at least the first time.
|
|
vector< double > | user_widths |
| | User-defined widths for MH sampling.
|
|
| double | MaxT |
| | Config parameters.
|
|
| vector< unsigned char > | update_flag |
| | State variables.
|
|
vector< unsigned char > | update_flag1 |
| | List of chains on an individual node that must sychronized.
|
|
vector< unsigned long > | stat0 |
| | Number of in-chain update attempts.
|
|
vector< unsigned long > | stat1 |
| | Number of in-chain acceptances per chain.
|
|
vector< unsigned long > | nstat0 |
| | Number of swap attempts per chain.
|
|
vector< unsigned long > | nstat1 |
| | Number of swap acceptances per chain.
|
|
vector< unsigned long > | mstat0 |
| | Number of standard MCMC updates attempted per chain.
|
|
vector< unsigned long > | mstat1 |
| | Number of standard MCMC updates accepted per chain.
|
|
int | Ntot |
| | Maximum dimension of state vector.
|
|
| int | swapnum |
| | Convergence check.
|
|
int | swaptry |
| | The number of attempted swaps.
|
Friends |
|
class | boost::serialization::access |
Implements parallel temperering or the parallel hierarchical sampler.
, one proposes to swap the states of two adjecent temperature chains. With probability 1 -
, all chains are updated at their assigned tempratures.