TrialFactory

class TrialFactory : public feasst::Trial

Contains multiple Trials.

Public Functions

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

Add a trial.

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.

Parameters
  • 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.

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

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.