bpp-phyl  2.2.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 const AlphabetIndex1 * getAlphabetIndex () const =0
 
virtual AlphabetIndex1 * getAlphabetIndex ()=0
 
virtual void setAlphabetIndex (AlphabetIndex1 *alphind)=0
 
virtual const Alphabet * getAlphabet () 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 setSubstitutionModel (const SubstitutionModel *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 70 of file Reward.h.

Constructor & Destructor Documentation

◆ Reward()

bpp::Reward::Reward ( )
inline

Definition at line 74 of file Reward.h.

◆ ~Reward()

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

Definition at line 75 of file Reward.h.

Member Function Documentation

◆ clone()

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

Implemented in bpp::DecompositionReward.

◆ 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 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 108 of file Reward.h.

References getAlphabetIndex().

Referenced by getNumberOfStates().

◆ getAlphabetIndex() [1/2]

virtual 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().

◆ getAlphabetIndex() [2/2]

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

Implemented in bpp::AbstractReward.

◆ 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 115 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 ( 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 ( const SubstitutionModel 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.


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