Runs the user-specified number of chains in parallel using the user-specified Monte Carlo algorithm (mca).
|
Global variables |
| enum | Control { parallel,
serial
} |
| | Parallelization type. More...
|
|
static Control | cntrl |
| | Current control.
|
|
static unsigned | nfifo |
| | Number of states for acceptance rate queue.
|
|
static int | state_iter |
| | Number of iterations allowed for finding a good initial state.
|
| unsigned | ncount |
| | Convergence check.
|
|
unsigned | totalnum |
| | Number of accepted states.
|
|
unsigned | totaltry |
| | Number of attempted states.
|
| void | SampleNewState (int k) |
| | Attempt to find a good state from the prior distribution for chain k.
|
|
void | SampleNewStateParallel (int k) |
| | Sample new state (parallel implementation, called by generic member).
|
|
void | SampleNewStateSerial (int k) |
| | Sample new state (serial implementation, called by generic member).
|
Public Member Functions |
|
| MultipleChains (int max, int ndim, int number, MHWidth *width, BaseDataTree *d, Model *m, Integration *i, Converge *c, MixturePrior *mp, LikelihoodComputation *l, MCAlgorithm *mca) |
| | Constructor for top level invocation.
|
|
| MultipleChains (int max, int ndim, int number, MHWidth *width, BaseDataTree *d, Model *m, Integration *i, Converge *c, MixturePrior *mp, LikelihoodComputation *l, MCAlgorithm *mca, Simulation *last) |
| | Constructor for invocation at higher levels of resolution.
|
|
virtual | ~MultipleChains () |
| | Destructor.
|
|
virtual void | Initialize () |
| | Initialize all the chains.
|
|
virtual void | Reinitialize (MHWidth *width, MixturePrior *mp) |
| | Reinitialize with new class instances.
|
|
void | EnableLogging () |
| | Enable caching per chain.
|
|
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 > | GetStat (void) |
| | Return vector with fraction of acceptances for each chain.
|
|
void | AdditionalInfo () |
| | Print out simulation specific diagnostics.
|
|
| void | NewState (int Mcur, vector< double > &w, vector< vector< double > > &p) |
| | Initialize new state (override from Simulation).
|
|
void | NewState (Chain &ch) |
| | Compute from a current Chain state.
|
|
void | NewState (State &s) |
| | Compute from a supplied State vector.
|
|
| void | SetControl (int) |
| | Set global parameters.
|
|
|
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).
|
| virtual void | LogState (string &logfile) |
| | Add state to log file.
|
|
virtual void | LogState (int level, int iterno, string &outfile) |
| | WITH level and iteration values.
|
Protected Member Functions |
|
virtual void | MCMethod () |
| | Compute one step in the Markov Chain.
|
|
void | CreateChains () |
| | Create the chain structures.
|
|
void | ResetChainStats () |
| | For gathering diagnostic data.
|
|
void | getChainCounts () |
Protected Attributes |
|
MHWidth * | width |
| | The Metropolis-Hastings width instance.
|
|
bool | caching |
| | True if chain data is to be invidually logged.
|
|
vector< int > | stat0 |
|
vector< int > | stat1 |
|
bool | chains_initialized |
| | True if state values have been computed for at least the first time.
|
|
| vector< unsigned char > | update_flag |
| | State variables.
|
|
vector< unsigned char > | update_flag1 |
| | Chain values from this node need to be communicated.
|
|
vector< unsigned long > | nstat0 |
| | Swaps proposed tallied for each chain.
|
|
vector< unsigned long > | nstat1 |
| | Swaps accepted tallied for each chain.
|
|
deque< vector< unsigned char > > | arate |
| | Acceptence rates for each chain.
|
Friends |
|
class | boost::serialization::access |
Runs the user-specified number of chains in parallel using the user-specified Monte Carlo algorithm (mca).
Each state will be written into the output log. Per chain statistics are computed and printed to stdout if the global variable mstat=1, as usual. This class will probably be used with a parallel chain convergence class such as GelmanRubinConverge.