bpp-phyl3  3.0.0
bpp::Reward Class Referenceabstract

The Reward interface. More...

#include <Bpp/Phyl/Mapping/Reward.h>

+ Inheritance diagram for bpp::Reward:
+ Collaboration diagram for bpp::Reward:

Public Member Functions

 Reward ()
 
virtual ~Reward ()
 
virtual Rewardclone () const =0
 
virtual bool hasAlphabetIndex () const =0
 
virtual std::shared_ptr< const AlphabetIndex1getAlphabetIndex () const =0
 
virtual void setAlphabetIndex (std::shared_ptr< const AlphabetIndex1 > alphind)=0
 
virtual std::shared_ptr< const AlphabetgetAlphabet () const
 Short cut function, equivalent to getSubstitutionRegister()->getAlphabet(). More...
 
virtual size_t getNumberOfStates () const
 Short cut function, equivalent to getSubstitutionRegister()->getAlphabet()->getSize(). More...
 
virtual double getReward (size_t initialState, size_t finalState, double length) const =0
 Get the reward of susbstitutions on a branch, given the initial and final states, and the branch length. More...
 
virtual Matrix< double > * getAllRewards (double length) const =0
 Get the rewards on a branch, for each initial and final states, and given the branch length. More...
 
virtual void storeAllRewards (double length, Eigen::MatrixXd &mat) const =0
 Store the rewards on a branch, for each initial and final states, and given the branch length. More...
 
virtual void setSubstitutionModel (std::shared_ptr< const SubstitutionModelInterface > model)=0
 Set the substitution model associated with this reward, if relevant. More...
 

Detailed Description

The Reward interface.

Provide a method to compute the reward of a real-valued function $f$ of the states on a branch. Namely, on a branch of length $t$, with initial state $x$ and final state $y$, if $t_s$ is the time spent in each state $s$, the reward of $f$ is $\sum_{s} f(s).E(t_s) $.

Author
Laurent Guéguen

See: Minin, V.N. and Suchard, M.A., Fast, accurate and simulation-free stochastic mapping Philosophical Transactions of the Royal Society B 2008 363:3985-95.

Definition at line 34 of file Reward.h.

Constructor & Destructor Documentation

◆ Reward()

bpp::Reward::Reward ( )
inline

Definition at line 38 of file Reward.h.

◆ ~Reward()

virtual bpp::Reward::~Reward ( )
inlinevirtual

Definition at line 39 of file Reward.h.

Member Function Documentation

◆ clone()

virtual Reward* bpp::Reward::clone ( ) const
pure virtual

◆ getAllRewards()

virtual Matrix<double>* bpp::Reward::getAllRewards ( double  length) const
pure virtual

Get the rewards on a branch, for each initial and final states, and given the branch length.

Parameters
lengthThe length of the branch.
Returns
A matrix with all rewards for each initial and final states.

Implemented in bpp::DecompositionReward.

◆ getAlphabet()

virtual std::shared_ptr<const Alphabet> bpp::Reward::getAlphabet ( ) const
inlinevirtual

Short cut function, equivalent to getSubstitutionRegister()->getAlphabet().

Returns
The alphabet associated to this substitution count.

Definition at line 65 of file Reward.h.

References getAlphabetIndex().

Referenced by getNumberOfStates().

◆ getAlphabetIndex()

virtual std::shared_ptr<const AlphabetIndex1> bpp::Reward::getAlphabetIndex ( ) const
pure virtual
Returns
The AlphabetIndex1 object associated to this instance. The alphabet index contains the value associated to each state.

Implemented in bpp::AbstractReward.

Referenced by getAlphabet().

◆ getNumberOfStates()

virtual size_t bpp::Reward::getNumberOfStates ( ) const
inlinevirtual

Short cut function, equivalent to getSubstitutionRegister()->getAlphabet()->getSize().

Returns
The number of states in the model/alphabet.

Definition at line 75 of file Reward.h.

References getAlphabet().

◆ getReward()

virtual double bpp::Reward::getReward ( size_t  initialState,
size_t  finalState,
double  length 
) const
pure virtual

Get the reward of susbstitutions on a branch, given the initial and final states, and the branch length.

Parameters
initialStateThe initial state.
finalStateThe final state.
lengthThe length of the branch.
Returns
The reward of the function on a branch of specified length and according to initial and final states.

Implemented in bpp::DecompositionReward.

◆ hasAlphabetIndex()

virtual bool bpp::Reward::hasAlphabetIndex ( ) const
pure virtual
Returns
Tell if an alphabet index has been attached to this class.

Implemented in bpp::AbstractReward.

◆ setAlphabetIndex()

virtual void bpp::Reward::setAlphabetIndex ( std::shared_ptr< const AlphabetIndex1 alphind)
pure virtual
Parameters
alphindThe new AlphabetIndex1 object to be associated to this instance.

Implemented in bpp::AbstractReward.

◆ setSubstitutionModel()

virtual void bpp::Reward::setSubstitutionModel ( std::shared_ptr< const SubstitutionModelInterface model)
pure virtual

Set the substitution model associated with this reward, if relevant.

Parameters
modelThe substitution model to use with this reward.

Implemented in bpp::DecompositionReward.

◆ storeAllRewards()

virtual void bpp::Reward::storeAllRewards ( double  length,
Eigen::MatrixXd &  mat 
) const
pure virtual

Store the rewards on a branch, for each initial and final states, and given the branch length.

Parameters
lengthThe length of the branch.
matA matrix to store all rewards for each initial and final states.

Implemented in bpp::DecompositionReward.


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