Microsimulation API
Classes | Typedefs | Enumerations | Functions | Variables
ssim Namespace Reference

name space for the Siena simulator. More...

Classes

struct  Action
 
class  cMessage
 cMessage class for OMNET++ API compatibility. This provides a heavier message class than Sim::Event, with short 'kind' and std::string 'name' attributes. The events by default are scheduled using cProcess::scheduleAt(), and handled using cProcess::handleMessage() (as per OMNET++). NB: cProcess::scheduleAt() uses simulation time rather than time in state (which is used by Sim::self_signal_event()). More...
 
class  CostReport
 CostReport class for collecting statistics on costs. More...
 
class  cProcess
 cProcess class for OMNET++ API compatibility. This provides a default for Process::process_event() that calls cProcess::handleMessage(). This class also provides scheduleAt() methods for insert cMessages into the process event queue. More...
 
class  Event
 basic event in the simulation. More...
 
class  EventReport
 EventReport class for collecting statistics on person-time, prevalence and numbers of events. More...
 
class  heap
 
class  Means
 Utility class to incrementally add values to calculate the mean, sum, variance and standard deviation. This could be replaced by boost::accumulator. More...
 
struct  PDescr
 
class  pqueue
 
struct  pqueueElement
 
struct  pqueueElementComparator
 
class  Process
 Virtual class (interface) representing processes running within the simulator. More...
 
class  ProcessWithPId
 utility Process class providing a utility interface with the simulator. More...
 
class  Rng
 
class  RngStream
 
class  Rpexp
 Rpexp is a random number generator class for piecewise constant hazards. Given time lower bounds t and piecewise constant hazards h, rand() returns a random time. The random number is calculated using the inversion formula. Constructors provided for arrays. More...
 
class  Sim
 a generic discrete-event sequential simulator More...
 
class  SimErrorHandler
 an error handler for simulation errors. More...
 
class  SimImpl
 
class  SimpleReport
 SimpleReport class for collecting data for homogeneous fields of type T with string names. More...
 
class  SummaryReport
 SummaryReport class for collecting statistics on person-time, prevalence, events and costs. More...
 

Typedefs

typedef heap< Actiona_table_t
 
typedef std::vector< PDescrPsTable
 
typedef a_table_t::iterator ForwardIterator
 
typedef Time simtime_t
 simtime_t typedef for OMNET++ API compatibility More...
 
typedef int ProcessId
 process identifier type More...
 
typedef double Time
 virtual time type More...
 
typedef boost::function< bool(const Event *)> EventPredicate
 

Enumerations

enum  ActionType { A_Event, A_Init, A_Stop, A_Ignore }
 

Functions

double rweibullHR (double shape, double scale, double hr)
 Random Weibull distribution for a given shape, scale and hazard ratio. More...
 
Time now ()
 now() function for compatibility with C++SIM More...
 
Time simTime ()
 simTime() function for OMNET++ API compatibility More...
 
void r_create_current_stream ()
 A utility function to create the current_stream. Used when initialising the microsimulation package in R. More...
 
void r_remove_current_stream ()
 A utility function to remove the current_stream. Used when finalising the microsimulation package in R. More...
 
void r_set_user_random_seed (double *seed)
 A utility function to set the user random seed for the simulation. More...
 
void r_get_user_random_seed (double *seed)
 A utility function to set the user random seed for the simulation. More...
 
void r_next_rng_substream ()
 A utility function to move to the next user random stream for the simulation. More...
 
void r_rng_advance_substream (double *seed, int *n)
 A utility function to advance the random sub-stream n steps for a specified seed. More...
 
double * user_unif_rand ()
 
void test_rstream2 (double *x)
 Simple test of the random streams (with a stupid name) More...
 
RcppExport SEXP pqueue__new (SEXP _lower)
 
RcppExport SEXP pqueue__push (SEXP _ptr, SEXP _priority, SEXP event)
 
RcppExport SEXP pqueue__pop (SEXP _ptr)
 
RcppExport SEXP pqueue__cancel (SEXP _ptr, SEXP _predicate)
 
RcppExport SEXP pqueue__empty (SEXP _ptr)
 
RcppExport SEXP pqueue__clear (SEXP _ptr)
 
void Rprint_actions ()
 
bool cMessagePred (const ssim::Event *e, boost::function< bool(const cMessage *msg)> pred)
 
bool cMessageNamePred (const ssim::Event *e, const string s)
 
bool cMessageKindPred (const ssim::Event *e, const short k)
 
void RemoveKind (short kind)
 RemoveKind is a function to remove messages with the given kind from the queue (NB: void) More...
 
void RemoveName (string name)
 RemoveName is a function to remove messages with the given name from the queue (NB: void) More...
 
double discountedInterval (double start, double end, double discountRate)
 Simple function to calculate the integral between the start and end times for (1+kappa)^(-u), where kappa is the discountRate (e.g. 0.03) More...
 
template<class T >
std::vector< std::vector< T > > transpose (const std::vector< std::vector< T > > data)
 Function to transpose a vector of vectors. This assumes that all inner vectors have the same size and allocates space for the complete result in advance. From http://stackoverflow.com/questions/6009782/how-to-pivot-a-vector-of-vectors. More...
 

Variables

static Rngdefault_stream
 
static Rngcurrent_stream
 
static double rn = 0.0
 
const char * Version = VERSION
 version identifier for this ssim library More...
 
static Time stop_time = INIT_TIME
 
static Time current_time = INIT_TIME
 
static ProcessId current_process = NULL_PROCESSID
 
static bool running = false
 
static SimErrorHandlererror_handler = 0
 
static a_table_t actions
 
static PsTable processes
 
static int counter_id = 0
 C++ wrapper class for the RngStream library. set() sets the current R random number stream to this stream. This is compliant with being a Boost random number generator. More...
 
const ProcessId NULL_PROCESSID = -1
 no process will be identified by NULL_PROCESSID More...
 
const Time INIT_TIME = 0
 beginning of time More...
 

Detailed Description

name space for the Siena simulator.

This namespace groups all the types and functionalities associated with the Siena simulator. These include:

  1. the simulator API

  2. the base classes for processes and events

  3. a few other utility classes

Typedef Documentation

◆ a_table_t

Definition at line 67 of file ssim.cc.

◆ EventPredicate

typedef boost::function<bool (const Event *)> ssim::EventPredicate

Definition at line 123 of file ssim.h.

◆ ForwardIterator

Definition at line 131 of file ssim.cc.

◆ ProcessId

typedef int ssim::ProcessId

process identifier type

Definition at line 59 of file ssim.h.

◆ PsTable

typedef std::vector<PDescr> ssim::PsTable

Definition at line 80 of file ssim.cc.

◆ simtime_t

simtime_t typedef for OMNET++ API compatibility

Definition at line 284 of file microsimulation.h.

◆ Time

typedef double ssim::Time

virtual time type

This type represents the basic time in the virtual (simulated) world. Being defined as an integer type, virtual time is a discrete quantity. The actual semantics of the time unit is determined by the simulated application. In other words, a time interval of 1 may be interpreted as one second, one year, or any other time interval, depending on the semantics of the simulated application.

See also
Sim::advance_delay(Time), Sim::signal_event(ProcessId, const Event*, Time), and Sim::self_signal_event(const Event*, Time).

Definition at line 79 of file ssim.h.

Enumeration Type Documentation

◆ ActionType

Enumerator
A_Event 
A_Init 
A_Stop 
A_Ignore 

Definition at line 46 of file ssim.cc.

Function Documentation

◆ cMessageKindPred()

bool ssim::cMessageKindPred ( const ssim::Event e,
const short  k 
)
inline

Definition at line 224 of file microsimulation.h.

◆ cMessageNamePred()

bool ssim::cMessageNamePred ( const ssim::Event e,
const string  s 
)
inline

Definition at line 219 of file microsimulation.h.

◆ cMessagePred()

bool ssim::cMessagePred ( const ssim::Event e,
boost::function< bool(const cMessage *msg)>  pred 
)
inline

Definition at line 214 of file microsimulation.h.

◆ discountedInterval()

double ssim::discountedInterval ( double  start,
double  end,
double  discountRate 
)
inline

Simple function to calculate the integral between the start and end times for (1+kappa)^(-u), where kappa is the discountRate (e.g. 0.03)

Definition at line 461 of file microsimulation.h.

◆ now()

Time ssim::now ( )

now() function for compatibility with C++SIM

Definition at line 14 of file microsimulation.cc.

◆ pqueue__cancel()

RcppExport SEXP ssim::pqueue__cancel ( SEXP  _ptr,
SEXP  _predicate 
)

Definition at line 146 of file pqueue.cpp.

◆ pqueue__clear()

RcppExport SEXP ssim::pqueue__clear ( SEXP  _ptr)

Definition at line 158 of file pqueue.cpp.

◆ pqueue__empty()

RcppExport SEXP ssim::pqueue__empty ( SEXP  _ptr)

Definition at line 153 of file pqueue.cpp.

◆ pqueue__new()

RcppExport SEXP ssim::pqueue__new ( SEXP  _lower)

Definition at line 128 of file pqueue.cpp.

◆ pqueue__pop()

RcppExport SEXP ssim::pqueue__pop ( SEXP  _ptr)

Definition at line 141 of file pqueue.cpp.

◆ pqueue__push()

RcppExport SEXP ssim::pqueue__push ( SEXP  _ptr,
SEXP  _priority,
SEXP  event 
)

Definition at line 134 of file pqueue.cpp.

◆ r_create_current_stream()

void ssim::r_create_current_stream ( )

A utility function to create the current_stream. Used when initialising the microsimulation package in R.

Definition at line 37 of file microsimulation.cc.

◆ r_get_user_random_seed()

void ssim::r_get_user_random_seed ( double *  outseed)

A utility function to set the user random seed for the simulation.

Definition at line 57 of file microsimulation.cc.

◆ r_next_rng_substream()

void ssim::r_next_rng_substream ( )

A utility function to move to the next user random stream for the simulation.

Definition at line 65 of file microsimulation.cc.

◆ r_remove_current_stream()

void ssim::r_remove_current_stream ( )

A utility function to remove the current_stream. Used when finalising the microsimulation package in R.

Definition at line 43 of file microsimulation.cc.

◆ r_rng_advance_substream()

void ssim::r_rng_advance_substream ( double *  inoutseed,
int *  n 
)

A utility function to advance the random sub-stream n steps for a specified seed.

Definition at line 69 of file microsimulation.cc.

◆ r_set_user_random_seed()

void ssim::r_set_user_random_seed ( double *  inseed)

A utility function to set the user random seed for the simulation.

Definition at line 48 of file microsimulation.cc.

◆ RemoveKind()

void ssim::RemoveKind ( short  kind)
inline

RemoveKind is a function to remove messages with the given kind from the queue (NB: void)

Definition at line 269 of file microsimulation.h.

◆ RemoveName()

void ssim::RemoveName ( string  name)
inline

RemoveName is a function to remove messages with the given name from the queue (NB: void)

Definition at line 276 of file microsimulation.h.

◆ Rprint_actions()

void ssim::Rprint_actions ( )

Definition at line 83 of file ssim.cc.

◆ rweibullHR()

double ssim::rweibullHR ( double  shape,
double  scale,
double  hr 
)

Random Weibull distribution for a given shape, scale and hazard ratio.

Definition at line 10 of file microsimulation.cc.

◆ simTime()

Time ssim::simTime ( )

simTime() function for OMNET++ API compatibility

Definition at line 18 of file microsimulation.cc.

◆ test_rstream2()

void ssim::test_rstream2 ( double *  x)

Simple test of the random streams (with a stupid name)

Definition at line 91 of file microsimulation.cc.

◆ transpose()

template<class T >
std::vector<std::vector<T> > ssim::transpose ( const std::vector< std::vector< T > >  data)

Function to transpose a vector of vectors. This assumes that all inner vectors have the same size and allocates space for the complete result in advance. From http://stackoverflow.com/questions/6009782/how-to-pivot-a-vector-of-vectors.

Definition at line 475 of file microsimulation.h.

◆ user_unif_rand()

double* ssim::user_unif_rand ( )

Definition at line 81 of file microsimulation.cc.

Variable Documentation

◆ actions

a_table_t ssim::actions
static

Definition at line 69 of file ssim.cc.

◆ counter_id

int ssim::counter_id = 0
static

C++ wrapper class for the RngStream library. set() sets the current R random number stream to this stream. This is compliant with being a Boost random number generator.

Definition at line 392 of file microsimulation.h.

◆ current_process

ProcessId ssim::current_process = NULL_PROCESSID
static

Definition at line 40 of file ssim.cc.

◆ current_stream

Rng * ssim::current_stream
static

Definition at line 23 of file microsimulation.cc.

◆ current_time

Time ssim::current_time = INIT_TIME
static

Definition at line 38 of file ssim.cc.

◆ default_stream

Rng* ssim::default_stream
static

Definition at line 23 of file microsimulation.cc.

◆ error_handler

SimErrorHandler* ssim::error_handler = 0
static

Definition at line 44 of file ssim.cc.

◆ INIT_TIME

const Time ssim::INIT_TIME = 0

beginning of time

Definition at line 83 of file ssim.h.

◆ NULL_PROCESSID

const ProcessId ssim::NULL_PROCESSID = -1

no process will be identified by NULL_PROCESSID

Definition at line 63 of file ssim.h.

◆ processes

PsTable ssim::processes
static

Definition at line 81 of file ssim.cc.

◆ rn

double ssim::rn = 0.0
static

Definition at line 24 of file microsimulation.cc.

◆ running

bool ssim::running = false
static

Definition at line 42 of file ssim.cc.

◆ stop_time

Time ssim::stop_time = INIT_TIME
static

Definition at line 37 of file ssim.cc.

◆ Version

const char * ssim::Version = VERSION

version identifier for this ssim library

Definition at line 33 of file ssim.cc.