Marmote Core
The project aims at realizing the prototype of a software environment dedicated to modeling with Markov chains.
Public Member Functions | Protected Attributes | List of all members
felsenstein81 Class Reference

Ajout de fonctionalites sur les matrices F81 (Felsenstein 81) Ce sont des matrices 4x4 qui sont caracterisees par: un vecteur de 4 probabilites p[0], p[1], p[2], p[3] un parametre de vitesse mu > 0. More...

#include <felsenstein81.h>

Inheritance diagram for felsenstein81:
markovChain markovChain

Public Member Functions

 felsenstein81 (double p[4], double mu)
 
 felsenstein81 (discreteDistribution *d, double mu)
 
 ~felsenstein81 ()
 
void makeMarkovChain ()
 
discreteDistributiontransientDistribution (double)
 
discreteDistributionstationaryDistribution ()
 
simulationResultsimulateChain (double tMax, bool stats, bool traj, bool withIncrements, bool trace)
 
DistributionhittingTimeDistribution (int iState, bool *hittingSet)
 Computes the hitting time distribution. It is an exponential distribution with parameter equal to the speed times the sum of probabilities of the hitting set. It is therefore independent from the initial state. More...
 
double * averageHittingTime (bool *hittingSet)
 Computes the average hitting time from every state. It is either 0, or the inverse of the speed times the sum of probabilities of the hitting set. It is therefore independent from the initial state not in the hitting set. More...
 
 felsenstein81 (double p[4], double mu)
 
 felsenstein81 (discreteDistribution *d, double mu)
 
 ~felsenstein81 ()
 
void makeMarkovChain ()
 
discreteDistributiontransientDistribution (double)
 
discreteDistributionstationaryDistribution ()
 
simulationResultsimulateChain (double tMax, bool stats, bool traj, bool withIncrements, bool trace)
 
DistributionhittingTimeDistribution (int iState, bool *hittingSet)
 Computes the hitting time distribution. It is an exponential distribution with parameter equal to the speed times the sum of probabilities of the hitting set. It is therefore independent from the initial state. More...
 
double * averageHittingTime (bool *hittingSet)
 Computes the average hitting time from every state. It is either 0, or the inverse of the speed times the sum of probabilities of the hitting set. It is therefore independent from the initial state not in the hitting set. More...
 
- Public Member Functions inherited from markovChain
 markovChain (int sz, timeType t)
 Simple constructor for the Markov chain from the size. More...
 
 markovChain (transitionStructure *tr)
 Constructor for the Markov chain using a transition structure. More...
 
 markovChain (string format, string param[], int nbreParam, string modelName, bool isAbstract)
 Constructor for Markov chains from files in various formats. In the abstract form, the object just stores the name(s) of the files that define the mode. In the non-abstract (concrete) form, the chain is instantiated in the memory with a concrete transition structure. Only the ERS, PSI and Xborne formats are supported at this time for concrete chains. More...
 
virtual ~markovChain ()
 Standard destructor. The generator and the initial distrib are destroyed. More...
 
int stateSpaceSize ()
 Read accessor to get the number of states in the state space of the Markov chain. More...
 
transitionStructuregenerator ()
 Read accessor to get the value of _generator which is a transitionStructure. More...
 
void setInitDistribution (discreteDistribution *d)
 Write accessor to set the value of _initDistribution which is a discreteDistribution. More...
 
void setGenerator (transitionStructure *tr)
 Write accessor to set the value of _generator which is a transitionStructure. More...
 
Distributionread ()
 Method(s) for deserializing Distribution from Xborne file (.pi). More...
 
void setFormat (string format)
 Utility to set the value of _format. More...
 
void setModelName (string modelName)
 Utility to set the value of _modelName. More...
 
void setAbstractNbre (int abstractNbre)
 Utility to set the value of _abstractNbre. More...
 
void setAbstract (string abstract[])
 Utility to set the value of the table containing names related to the model: file names, extensions etc. More...
 
int abstractNbre ()
 Utility to get _abstractNbre. More...
 
string modelName ()
 Utility to get _modelName. More...
 
string format ()
 Utility to get _format. More...
 
void abstract ()
 Utility to display the value of the table _abstract[]. More...
 
virtual simulationResultsimulateChainDT (int tMax, bool stats, bool traj, bool trace)
 Simulates the evolution of a discrete-time Markov Chain. More...
 
virtual simulationResultsimulateChainCT (double tMax, bool stats, bool traj, bool withIncrements, bool trace)
 Simulates the evolution of a continuous-time Markov Chain. More...
 
simulationResultsimulatePSI (int tMax, bool stats, bool Traj, bool Print)
 Simulates the evolution of a Markov Chain. This is a front-end function to the discrete-time simulator. For continuous time, the PSI simulator does not allow to control the simulation horizon. The effect of "Print" is to be handled in the specific simulation function, not here. More...
 
virtual DistributionstationaryDistribution (bool progress)
 Entry point for methods Computing the stationary distribution of chains using the iterative method. More...
 
virtual DistributionstationaryDistributionCT (bool progress)
 Computing the stationary distribution of a CTMC using uniformization and the iterative method. More...
 
virtual DistributionstationaryDistributionDT (bool progress)
 Computing the stationary distribution of a DTMC using uniformization and the iterative method. More...
 
DistributionstationaryDistributionGthLD ()
 Entry point for methods computing stationary distributions using the GTH method for solving the linear system. More...
 
DistributionstationaryDistributionSOR ()
 Entry point for methods computing stationary distributions using the SOR method for solving the linear system. More...
 
simulationResultstationaryDistributionSample (int nbSamples)
 Methods to sample from the stationary distribution using backwards coupling. The result is returned in a simulationResult object, but the interpretation is different: it does not represent trajectories. Here, "state" entries are the measured states, and "time" entries are the measured coupling time. More...
 
DistributionhittingTimeDistribution (int iState, bool *hitSetIndicator)
 Entry point for methods computing the distribution of the hitting time (first entry times) from some state to some set of states. More...
 
int * simulateHittingTime (int iState, bool *hittingSet, int nbSamples, int tMax)
 Obtain samples of hitting times through Monte Carlo simulation. A trajectory is simulated until it hits the target set, or its length attains a maximum, whichever comes first. Samples with the maximum are returned although they do not represent a proper hitting time. It is the responsibility of the calling party to ignore these values. More...
 
double * averageHittingTime (bool *hitSetIndicator)
 Entry point for methods computing average hitting times (first entry times) from every state to some set of states. More...
 
double * averageHittingTimeDT (bool *hitSetIndicator)
 Computing the average hitting times in a discrete-time Markov chain. Uses a direct Gauss-Seidel matrix inversion. More...
 
double * averageHittingTimeDT_iterative (bool *hitSetIndicator)
 Computing the average hitting times in a discrete-time Markov chain. Uses an iterative approximate computation. More...
 
virtual markovChaincopy ()
 copy utility More...
 
virtual markovChainuniformize ()
 Uniformize Markov Chain, by uniformizing the generator. If the chain is already discrete time, a copy is returned. More...
 
void setSizeType (const string path)
 Function to find out the size and the type of a Markov chain described in the MARCA format. Both quantities are directly set in the method, which returns nothing. Adapted from the method HBF::read_marka of Psi/Unix/v1.0. More...
 
virtual void write (FILE *out, bool withReward)
 Method(s) for writing Markov chains in files with various formats. Only the ERS format is supported at this time. More...
 
virtual void write (string format, string modelName)
 
 markovChain (int sz, timeType t)
 Simple constructor for the Markov chain from the size. More...
 
 markovChain (transitionStructure *tr)
 Constructor for the Markov chain using a transition structure. More...
 
 markovChain (string format, string param[], int nbreParam, string modelName, bool isAbstract)
 Constructor for Markov chains from files in various formats. In the abstract form, the object just stores the name(s) of the files that define the mode. In the non-abstract (concrete) form, the chain is instantiated in the memory with a concrete transition structure. Only the ERS, PSI and Xborne formats are supported at this time for concrete chains. More...
 
virtual ~markovChain ()
 Standard destructor. The generator and the initial distrib are destroyed. More...
 
int stateSpaceSize ()
 Read accessor to get the number of states in the state space of the Markov chain. More...
 
transitionStructuregenerator ()
 Read accessor to get the value of _generator which is a transitionStructure. More...
 
void setInitDistribution (discreteDistribution *d)
 Write accessor to set the value of _initDistribution which is a discreteDistribution. More...
 
void setGenerator (transitionStructure *tr)
 Write accessor to set the value of _generator which is a transitionStructure. More...
 
Distributionread ()
 Method(s) for deserializing Distribution from Xborne file (.pi). More...
 
void setFormat (string format)
 Utility to set the value of _format. More...
 
void setModelName (string modelName)
 Utility to set the value of _modelName. More...
 
void setAbstractNbre (int abstractNbre)
 Utility to set the value of _abstractNbre. More...
 
void setAbstract (string abstract[])
 Utility to set the value of the table containing names related to the model: file names, extensions etc. More...
 
int abstractNbre ()
 Utility to get _abstractNbre. More...
 
string modelName ()
 Utility to get _modelName. More...
 
string format ()
 Utility to get _format. More...
 
void abstract ()
 Utility to display the value of the table _abstract[]. More...
 
virtual simulationResultsimulateChainDT (int tMax, bool stats, bool traj, bool trace)
 Simulates the evolution of a discrete-time Markov Chain. More...
 
virtual simulationResultsimulateChainCT (double tMax, bool stats, bool traj, bool withIncrements, bool trace)
 Simulates the evolution of a continuous-time Markov Chain. More...
 
simulationResultsimulatePSI (int tMax, bool stats, bool Traj, bool Print)
 Simulates the evolution of a Markov Chain. This is a front-end function to the discrete-time simulator. For continuous time, the PSI simulator does not allow to control the simulation horizon. The effect of "Print" is to be handled in the specific simulation function, not here. More...
 
virtual DistributionstationaryDistribution (bool progress)
 Entry point for methods Computing the stationary distribution of chains using the iterative method. More...
 
virtual DistributionstationaryDistributionCT (bool progress)
 Computing the stationary distribution of a CTMC using uniformization and the iterative method. More...
 
virtual DistributionstationaryDistributionDT (bool progress)
 Computing the stationary distribution of a DTMC using uniformization and the iterative method. More...
 
DistributionstationaryDistributionGthLD ()
 Entry point for methods computing stationary distributions using the GTH method for solving the linear system. More...
 
DistributionstationaryDistributionSOR ()
 Entry point for methods computing stationary distributions using the SOR method for solving the linear system. More...
 
simulationResultstationaryDistributionSample (int nbSamples)
 Methods to sample from the stationary distribution using backwards coupling. The result is returned in a simulationResult object, but the interpretation is different: it does not represent trajectories. Here, "state" entries are the measured states, and "time" entries are the measured coupling time. More...
 
DistributionhittingTimeDistribution (int iState, bool *hitSetIndicator)
 Entry point for methods computing the distribution of the hitting time (first entry times) from some state to some set of states. More...
 
int * simulateHittingTime (int iState, bool *hittingSet, int nbSamples, int tMax)
 Obtain samples of hitting times through Monte Carlo simulation. A trajectory is simulated until it hits the target set, or its length attains a maximum, whichever comes first. Samples with the maximum are returned although they do not represent a proper hitting time. It is the responsibility of the calling party to ignore these values. More...
 
double * averageHittingTime (bool *hitSetIndicator)
 Entry point for methods computing average hitting times (first entry times) from every state to some set of states. More...
 
double * averageHittingTimeDT (bool *hitSetIndicator)
 Computing the average hitting times in a discrete-time Markov chain. Uses a direct Gauss-Seidel matrix inversion. More...
 
double * averageHittingTimeDT_iterative (bool *hitSetIndicator)
 Computing the average hitting times in a discrete-time Markov chain. Uses an iterative approximate computation. More...
 
virtual markovChaincopy ()
 copy utility More...
 
virtual markovChainuniformize ()
 Uniformize Markov Chain, by uniformizing the generator. If the chain is already discrete time, a copy is returned. More...
 
void setSizeType (const string path)
 Function to find out the size and the type of a Markov chain described in the MARCA format. Both quantities are directly set in the method, which returns nothing. Adapted from the method HBF::read_marka of Psi/Unix/v1.0. More...
 
virtual void write (FILE *out, bool withReward)
 Method(s) for writing Markov chains in files with various formats. Only the ERS format is supported at this time. More...
 
virtual void write (string format, string modelName)
 

Protected Attributes

int _size
 the number of values; 4 at the moment More...
 
double * _stateSpace
 representation of the state space More...
 
discreteDistribution_transDistrib
 the distribution "p" More...
 
double _transSpeed
 the speed parameter "mu" More...
 
- Protected Attributes inherited from markovChain
timeType _type
 time type: discrete or continuous More...
 
int _stateSpaceSize
 size of the state space (should be a pointer on the state space itself) More...
 
transitionStructure_generator
 transition structure of the chain More...
 
discreteDistribution_initDistribution
 initial distribution of the process More...
 
bool _debug
 internal debugging indicator More...
 
bool _isAbstract
 true if the object is "abstract", i.e. a pointer to some files More...
 
int _abstractNbre
 number of abstraction parameters More...
 
string * _abstract
 table of abstraction parameters More...
 
string _format
 format/language of the model More...
 
string _modelName
 name of the model More...
 

Detailed Description

Ajout de fonctionalites sur les matrices F81 (Felsenstein 81) Ce sont des matrices 4x4 qui sont caracterisees par: un vecteur de 4 probabilites p[0], p[1], p[2], p[3] un parametre de vitesse mu > 0.

Constructor & Destructor Documentation

felsenstein81::felsenstein81 ( double  p[4],
double  mu 
)

Constructor for a F81 Markov Chain from a probability vector

Author
Alain Jean-Marie
Parameters
pprobability vector
muspeed parameter
Returns
an object of type Markov_Chain, with initial state set arbitrarily to 0.
felsenstein81::felsenstein81 ( discreteDistribution d,
double  mu 
)

Constructor for a F81 Markov Chain from a distribution and a speed parameter

Author
Alain Jean-Marie
Parameters
dthe distribution
muspeed parameter
Returns
an object of type Markov_Chain, with initial state set arbitrarily to 0.
felsenstein81::~felsenstein81 ( )

Standard destructor

Author
Alain Jean-Marie
felsenstein81::felsenstein81 ( double  p[4],
double  mu 
)

Constructor for a F81 Markov Chain from a probability vector

Author
Alain Jean-Marie
Parameters
pprobability vector
muspeed parameter
Returns
an object of type Markov_Chain, with initial state set arbitrarily to 0.
felsenstein81::felsenstein81 ( discreteDistribution d,
double  mu 
)

Constructor for a F81 Markov Chain from a distribution and a speed parameter

Author
Alain Jean-Marie
Parameters
dthe distribution
muspeed parameter
Returns
an object of type Markov_Chain, with initial state set arbitrarily to 0.
felsenstein81::~felsenstein81 ( )

Standard destructor

Author
Alain Jean-Marie

Member Function Documentation

double* felsenstein81::averageHittingTime ( bool *  hittingSet)

Computes the average hitting time from every state. It is either 0, or the inverse of the speed times the sum of probabilities of the hitting set. It is therefore independent from the initial state not in the hitting set.

Parameters
hittingSetan array describing the hitting set.
double * felsenstein81::averageHittingTime ( bool *  hittingSet)

Computes the average hitting time from every state. It is either 0, or the inverse of the speed times the sum of probabilities of the hitting set. It is therefore independent from the initial state not in the hitting set.

Parameters
hittingSetan array describing the hitting set.
Distribution* felsenstein81::hittingTimeDistribution ( int  iState,
bool *  hittingSet 
)

Computes the hitting time distribution. It is an exponential distribution with parameter equal to the speed times the sum of probabilities of the hitting set. It is therefore independent from the initial state.

Parameters
iStatethe initial state
hittingSetan array describing the hitting set.
Distribution * felsenstein81::hittingTimeDistribution ( int  iState,
bool *  hittingSet 
)

Computes the hitting time distribution. It is an exponential distribution with parameter equal to the speed times the sum of probabilities of the hitting set. It is therefore independent from the initial state.

Parameters
iStatethe initial state
hittingSetan array describing the hitting set.
void felsenstein81::makeMarkovChain ( )

Instantiation of the generator for the markovChain ancestor

Author
Alain Jean-Marie
void felsenstein81::makeMarkovChain ( )

Instantiation of the generator for the markovChain ancestor

Author
Alain Jean-Marie
simulationResult* felsenstein81::simulateChain ( double  tMax,
bool  stats,
bool  traj,
bool  withIncrements,
bool  trace 
)
virtual

Simulates the evolution of a F81 Markov Chain

Author
Alain Jean-Marie
Parameters
tMaxtime until which the Markov chain is simulated
statsindicates whether occupancy statistics are collected and returned
trajindicates whether a trajectory is returned
withIncrementsindicates whether time increments should be printed
traceindicates whether the trajectory should be printed along the way (on stdout)
Returns
a structure with the results of the simulation

Reimplemented from markovChain.

simulationResult * felsenstein81::simulateChain ( double  tMax,
bool  stats,
bool  traj,
bool  withIncrements,
bool  trace 
)
virtual

Simulates the evolution of a F81 Markov Chain

Author
Alain Jean-Marie
Parameters
tMaxtime until which the Markov chain is simulated
statsindicates whether occupancy statistics are collected and returned
trajindicates whether a trajectory is returned
withIncrementsindicates whether time increments should be printed
traceindicates whether the trajectory should be printed along the way (on stdout)
Returns
a structure with the results of the simulation

Reimplemented from markovChain.

discreteDistribution* felsenstein81::stationaryDistribution ( )

Computes the stationary distribution for a F81 Markov Chain

Author
Alain Jean-Marie
discreteDistribution * felsenstein81::stationaryDistribution ( )

Computes the stationary distribution for a F81 Markov Chain

Author
Alain Jean-Marie
discreteDistribution* felsenstein81::transientDistribution ( double  )

Computes the transient distribution for a F81 Markov Chain

Author
Alain Jean-Marie
Parameters
ttime at which the distribution is to be computed
discreteDistribution * felsenstein81::transientDistribution ( double  t)

Computes the transient distribution for a F81 Markov Chain

Author
Alain Jean-Marie
Parameters
ttime at which the distribution is to be computed

Member Data Documentation

int felsenstein81::_size
protected

the number of values; 4 at the moment

double * felsenstein81::_stateSpace
protected

representation of the state space

discreteDistribution * felsenstein81::_transDistrib
protected

the distribution "p"

double felsenstein81::_transSpeed
protected

the speed parameter "mu"


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