TrialFactory

class TrialFactory : public feasst::Trial

Contains multiple Trials.

Public Functions

void add(std::shared_ptr<Trial> trial)

Add a trial.

void remove(const int index)

Remove a trial by index.

int num() const

Return the number of trials.

const Trial &trial(const int index) const

Return a trial by index of the order trials were added.

int random_index(Random *random)

Return the index of a trial selected with probability proportional to its weight.

bool attempt(Criteria *criteria, System *system, int trial_index, Random *random)

Attempt one of the trials. Return true if accepted.

param trial_index:

attempt trial_index. If -1, choose randomly with probabilty determined from the weight.

bool attempt(Criteria *criteria, System *system, Random *random)

Attempt one of the trials with selection probability proportional to the weight.

int last_index() const

Return the index of the last trial attempted.

const std::vector<double> &cumulative_probability() const

Return the cumulative probability of each trial.

void revert(const int index, const bool accepted, const bool auto_rejected, System *system, Criteria *criteria)

Revert changes to system by trial index.

std::string status_header() const

Return the header description for the statuses of the trials (e.g., acceptance, etc).

std::string status() const

Return the statuses of the trials (e.g., acceptance, etc).

void reset_stats()

Reset trial statistics.

void tune()

Tune parameters.

void precompute(Criteria *criteria, System *system)

Precompute quantities before simulation for optimization.

class TrialFactoryNamed

Contains multiple Trials for use as input into MonteCarlo. As opposed to the above, these classes are named to enable factories. Serialization is not required.

Subclassed by feasst::TrialAVB2, feasst::TrialGibbsParticleTransfer, feasst::TrialGibbsVolumeTransfer, feasst::TrialGrow, feasst::TrialRigidCluster, feasst::TrialTransfer, feasst::TrialTransferAVB, feasst::TrialTransferAVBDivalent, feasst::TrialTransferMultiple