SimulationResult Class Reference

marmote: SimulationResult Class Reference
marmote
marmoteCore is a C++ API dedicated to modeling with Markov chains.
SimulationResult Class Reference

The class for transmitting (Monte Carlo) simulation results between objects. Simulation results may be diverse: this structure should be able to accomodate each of the results, even if they are not all present at the same time. Results include: trajectories, empirical frequencies. More...

#include <marmoteSimulationResult.h>

+ Inheritance diagram for SimulationResult:

Public Member Functions

 SimulationResult (MarmoteSet *state_space, timeType t, bool stats, bool traj, bool trace=false, bool increments=false)
 
 SimulationResult (std::string format, std::string modelName, bool stats)
 
 ~SimulationResult ()
 
MarmoteSetstate_space () const
 Read accessor to the state space (support set) of the samples.
 
simLenType trajectorySize () const
 The current size of the trajectory recorded in the sample.
 
simLenType lastDate () const
 The date of the last record in the simulation.
 
stateType lastState () const
 The last state of the simulation.
 
const std::vector< double > & CT_dates ()
 Accessor to the dates of the trajectory in continuous time.
 
const std::vector< simLenType > & DT_dates ()
 Accessor to the dates of the trajectory in discrete time.
 
const std::vector< cardinalType > & states ()
 Accessor to the states of the trajectory.
 
void recordDTSample (simLenType date, cardinalType state)
 record a sample in discrete time and performs tracing and stats as required.
 
void recordCTSample (double date, cardinalType state)
 record a sample in continuous time and performs tracing and stats as required
 
DiscreteDistributionDistribution ()
 Computes the empirical distribution of the sample.
 
void setOutput (std::ostream *out)
 Sets the output stream used for tracing.
 
void setFullState (bool full)
 Sets the fullstate flag for tracing.
 
void WriteTrajectory (std::ostream *fout, std::string format)
 Writes the trajectory to a file.
 
void Diagnose (std::ostream *fout) const
 Write a diagnostic on the state of the object.
 
- Public Member Functions inherited from marmote::Object
 Object (void)
 
virtual ~Object (void)
 
const std::string & className (void) const
 
void setClassName (const std::string &)
 
std::string toString (void) const
 
std::string content (void) const
 
std::string info (void) const
 

Protected Member Functions

std::string toString_impl (void) const override
 Implementation of toString method from marmote::Object.
 
- Protected Member Functions inherited from marmote::Object
virtual std::string content_impl (void) const
 
virtual std::string info_impl (void) const
 

Detailed Description

The class for transmitting (Monte Carlo) simulation results between objects. Simulation results may be diverse: this structure should be able to accomodate each of the results, even if they are not all present at the same time. Results include: trajectories, empirical frequencies.

Author
Alain Jean-Marie

Constructor & Destructor Documentation

◆ SimulationResult() [1/2]

SimulationResult::SimulationResult ( MarmoteSet * state_space,
timeType t,
bool stats,
bool traj,
bool trace = false,
bool increments = false )

Constructor for a simulation result object

Author
Alain Jean-Marie
Parameters
state_spacethe state space
ttype of time: CONTINUOUS or DISCRETE
statswhether the occupancy distribution is present or not
trajwhether a trajectory is stored
tracewhether the recording of samples should be traced
incrementswhether increments should be stored (continuous-time only)

◆ SimulationResult() [2/2]

SimulationResult::SimulationResult ( std::string format,
std::string modelName,
bool stats )

Constructor for a simulation result object from a file

Author
Alain Jean-Marie
Parameters
formatthe format of the file: options "PSI" and "PSI-sample" are supported
modelNamethe name of the model
statswhether to compute the occupancy distribution or not

◆ ~SimulationResult()

SimulationResult::~SimulationResult ( )

Member Function Documentation

◆ CT_dates()

const std::vector< double > & SimulationResult::CT_dates ( )
inline

Accessor to the dates of the trajectory in continuous time.

Returns
the size

◆ Diagnose()

void SimulationResult::Diagnose ( std::ostream * fout) const

Write a diagnostic on the state of the object.

Parameters
foutthe stream on which the diagnostic is written

◆ Distribution()

DiscreteDistribution * SimulationResult::Distribution ( )

Computes the empirical distribution of the sample.

Returns
the empirical distribution of the sample

◆ DT_dates()

const std::vector< simLenType > & SimulationResult::DT_dates ( )
inline

Accessor to the dates of the trajectory in discrete time.

Returns
the size

◆ lastDate()

simLenType SimulationResult::lastDate ( ) const

The date of the last record in the simulation.

Returns

◆ lastState()

stateType SimulationResult::lastState ( ) const

The last state of the simulation.

Returns

◆ recordCTSample()

void SimulationResult::recordCTSample ( double date,
cardinalType state )

record a sample in continuous time and performs tracing and stats as required

Parameters
datethe time of the sample
statethe state of the sample

◆ recordDTSample()

void SimulationResult::recordDTSample ( simLenType date,
cardinalType state )

record a sample in discrete time and performs tracing and stats as required.

Parameters
datethe time of the sample
statethe state of the sample

◆ setFullState()

void SimulationResult::setFullState ( bool full)
inline

Sets the fullstate flag for tracing.

Parameters
full

◆ setOutput()

void SimulationResult::setOutput ( std::ostream * out)
inline

Sets the output stream used for tracing.

Parameters
out

◆ state_space()

MarmoteSet * SimulationResult::state_space ( ) const
inline

Read accessor to the state space (support set) of the samples.

Author
Alain Jean-Marie
Returns
a pointer to the state space

◆ states()

const std::vector< cardinalType > & SimulationResult::states ( )
inline

Accessor to the states of the trajectory.

Returns
the size

◆ toString_impl()

std::string SimulationResult::toString_impl ( void ) const
overrideprotectedvirtual

Implementation of toString method from marmote::Object.

Implements marmote::Object.

◆ trajectorySize()

simLenType SimulationResult::trajectorySize ( ) const
inline

The current size of the trajectory recorded in the sample.

Returns

◆ WriteTrajectory()

void SimulationResult::WriteTrajectory ( std::ostream * fout,
std::string format )

Writes the trajectory to a file.

Parameters
foutpointer to the file descriptor to which the trajectory is written
formatthe format used for writing. Supported formats are "standard", "Ers" and "" which are all equivalent

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