minimc 0.5.1
Loading...
Searching...
No Matches
Scorable Class Referenceabstract

Serves as base class for Estimator and Sensitivity. More...

#include <Scorable.hpp>

Inheritance diagram for Scorable:

Public Member Functions

 Scorable (const std::string &name, const pugi::xml_node &bins_node) noexcept
 Constructs a Scorable from a bins node of an XML document. More...
 
 Scorable (const Scorable &estimator, const Perturbation &perturbation) noexcept
 Constructs an Scorable from an existing estimator and perturbation. More...
 
virtual ~Scorable () noexcept
 Virtual destructor (C++ Core Guidelines C.127)
 
virtual Real GetScore (const Particle &p) const noexcept=0
 Returns what a Particle would score. More...
 
virtual std::string to_string (const Real total_weight) const noexcept=0
 Returns a string suitable for printing. More...
 
Real GetScore (const size_t index, const Real total_weight) const noexcept
 Returns all scores; primarily for unit testing.
 
Scorableoperator+= (const Scorable &other) noexcept
 Add scores of other to this.
 

Public Attributes

const std::string name
 Unique, user-defined identifier (C++ Core Guidelines C.131)
 

Protected Member Functions

std::string GetScoreAsString (const Real total_weight) const noexcept
 Returns a string suitable for printing. More...
 

Protected Attributes

const std::shared_ptr< const ParticleBinsbins
 Used to map a Particle to a unique index.
 
std::vector< Realscores
 Flattened array of scores.
 
std::vector< Realsquare_scores
 Flattened array of square of scores.
 

Detailed Description

Serves as base class for Estimator and Sensitivity.

Accumulates scores then produces mean and standard deviation estimates using sample statistics

Todo:
Memoize GetScore since sensitivites call it

Constructor & Destructor Documentation

◆ Scorable() [1/2]

Scorable::Scorable ( const std::string &  name,
const pugi::xml_node &  bins_node 
)
noexcept

Constructs a Scorable from a bins node of an XML document.

All scores are initialized to zero

◆ Scorable() [2/2]

Scorable::Scorable ( const Scorable estimator,
const Perturbation perturbation 
)
noexcept

Constructs an Scorable from an existing estimator and perturbation.

All scores are initialized to zero

Member Function Documentation

◆ GetScore()

virtual Real Scorable::GetScore ( const Particle p) const
pure virtualnoexcept

Returns what a Particle would score.

Implemented in CurrentEstimator, and CurrentTotalCrossSectionSensitivity.

◆ GetScoreAsString()

std::string Scorable::GetScoreAsString ( const Real  total_weight) const
protectednoexcept

Returns a string suitable for printing.

Does not return bins since the derived class will decide if bins should be printed. For instance, an Estimator may print the bins while the bins are omitted for associated Sensitivity objects.

◆ to_string()

virtual std::string Scorable::to_string ( const Real  total_weight) const
pure virtualnoexcept

Returns a string suitable for printing.

Implemented in Sensitivity, and Estimator.


The documentation for this class was generated from the following file: