Trial

class Trial

A trial contains a number of TrialStages. The Acceptance is computed as the stages are enacted, and then sent to Criteria to decide if the trial is accepted or rejected.

Subclassed by feasst::TrialFactory, feasst::TrialGrowLinear, feasst::TrialGrowthExpanded, feasst::TrialMorphExpanded

Public Functions

Trial(const argtype &args = argtype())

args:

  • weight: unnormalized relative probability of selection of this trial with respect to all trials (default: 1).

double weight() const

Return the unnormalized relative probability of selection of this trial with respect to all trials.

void add_stage(std::shared_ptr<TrialSelect> select, std::shared_ptr<Perturb> perturb, const argtype &args = argtype())

Add a stage which includes selection and perturbation with arguments.

void set(const int index, std::shared_ptr<TrialStage> stage)

Set a stage, as can be done just before each attempt.

int num_stages() const

Number of stages.

const TrialStage &stage(const int index) const

Return a stage.

int64_t num_success() const

Number of successful attempts.

int64_t num_attempts() const

Number of attempts.

int64_t num_auto_reject() const

Number of automatic rejections.

void increment_num_attempts()

Increment the number of attempts for acceptance.

double acceptance() const

Return the ratio of the number of successful attempts and total attempts.

virtual void reset_stats()

Reset trial statistics.

virtual std::string status_header() const

Return the header description for the status of the trial (e.g., acceptance, etc).

virtual std::string status() const

Return the status of the trial (e.g., acceptance, etc).

virtual void tune()

Tune parameters.

virtual void precompute(Criteria *criteria, System *system)

Precompute quantities before simulation for optimization.

void set(std::shared_ptr<TrialCompute> compute)

Set the computation of the trial and acceptance.

const TrialCompute &compute() const

Return TrialCompute.

void revert(System *system)

Revert all stages in reverse order.

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

Attempt a trial. Return true if accepted.

const std::string &description() const

Return the description, as used in Log.

void set_description(const std::string &description)

Set the description.