Microsimulation API
|
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. 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< Action > | a_table_t |
typedef std::vector< PDescr > | PsTable |
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 std::function< bool(const Event *)> | EventPredicate |
Enumerations | |
enum | ActionType { A_Event, A_Init, A_Stop, A_Ignore, A_Event, A_Init, A_Stop, A_Ignore } |
enum | ActionType { A_Event, A_Init, A_Stop, A_Ignore, 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 () |
void | Cancel (std::function< bool(const cMessage *msg)> pred) |
Cancel is a function to cancel messages who satisfy a predicate. More... | |
void | RemoveKind (short kind) |
RemoveKind is a function to remove messages with the given kind from the queue. More... | |
void | CancelKind (short kind) |
CancelKind is a function to remove messages with the given kind from the queue. More... | |
void | RemoveName (string name) |
RemoveName is a function to remove messages with the given name from the queue. More... | |
void | CancelName (string name) |
CancelName is a function to remove messages with the given name from the queue. More... | |
void | CancelEvents () |
CancelEvents is a function to remove messages from the queue. 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... | |
double | discountedInterval (double y, double start, double end, double discountRate) |
Simple function to calculate the integral between the start and end times for y*(1+kappa)^(-u), where kappa is the discountRate (e.g. 0.03) More... | |
double | discountedPoint (double time, double discountRate) |
Simple function to calculate 1/(1+discountRate)^(time) More... | |
double | discountedPoint (double y, double time, double discountRate) |
Simple function to calculate y/(1+discountRate)^(time) 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 Rng * | default_stream |
static Rng * | current_stream |
static double | rn = 0.0 |
static Time | stop_time = INIT_TIME |
static Time | current_time = INIT_TIME |
static ProcessId | current_process = NULL_PROCESSID |
static bool | running = false |
static SimErrorHandler * | error_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... | |
static Time | stop_time = INIT_TIME |
static Time | current_time = INIT_TIME |
static ProcessId | current_process = NULL_PROCESSID |
static bool | running = false |
static SimErrorHandler * | error_handler = 0 |
static a_table_t | actions |
static PsTable | processes |
name space for the Siena simulator.
This namespace groups all the types and functionalities associated with the Siena simulator. These include:
the simulator API
the base classes for processes and events
typedef heap< Action > ssim::a_table_t |
typedef std::function<bool (const Event *)> ssim::EventPredicate |
typedef int ssim::ProcessId |
typedef std::vector< PDescr > ssim::PsTable |
typedef Time ssim::simtime_t |
simtime_t typedef for OMNET++ API compatibility
Definition at line 439 of file microsimulation.h.
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.
enum ssim::ActionType |
enum ssim::ActionType |
Cancel is a function to cancel messages who satisfy a predicate.
This works across all processes.
Definition at line 244 of file microsimulation.h.
|
inline |
CancelEvents is a function to remove messages from the queue.
This works across all processes.
Definition at line 291 of file microsimulation.h.
|
inline |
CancelKind is a function to remove messages with the given kind from the queue.
This works across all processes.
Definition at line 265 of file microsimulation.h.
|
inline |
CancelName is a function to remove messages with the given name from the queue.
This works across all processes.
Definition at line 282 of file microsimulation.h.
|
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 616 of file microsimulation.h.
|
inline |
Simple function to calculate the integral between the start and end times for y*(1+kappa)^(-u), where kappa is the discountRate (e.g. 0.03)
Definition at line 625 of file microsimulation.h.
|
inline |
Simple function to calculate 1/(1+discountRate)^(time)
Definition at line 633 of file microsimulation.h.
|
inline |
Simple function to calculate y/(1+discountRate)^(time)
Definition at line 639 of file microsimulation.h.
Time ssim::now | ( | ) |
now() function for compatibility with C++SIM
Definition at line 9 of file microsimulation.cc.
RcppExport SEXP ssim::pqueue__cancel | ( | SEXP | _ptr, |
SEXP | _predicate | ||
) |
Definition at line 146 of file pqueue.cpp.
RcppExport SEXP ssim::pqueue__clear | ( | SEXP | _ptr | ) |
Definition at line 158 of file pqueue.cpp.
RcppExport SEXP ssim::pqueue__empty | ( | SEXP | _ptr | ) |
Definition at line 153 of file pqueue.cpp.
RcppExport SEXP ssim::pqueue__new | ( | SEXP | _lower | ) |
Definition at line 128 of file pqueue.cpp.
RcppExport SEXP ssim::pqueue__pop | ( | SEXP | _ptr | ) |
Definition at line 141 of file pqueue.cpp.
RcppExport SEXP ssim::pqueue__push | ( | SEXP | _ptr, |
SEXP | _priority, | ||
SEXP | event | ||
) |
Definition at line 134 of file pqueue.cpp.
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 32 of file microsimulation.cc.
void ssim::r_get_user_random_seed | ( | double * | outseed | ) |
A utility function to set the user random seed for the simulation.
Definition at line 52 of file microsimulation.cc.
void ssim::r_next_rng_substream | ( | ) |
A utility function to move to the next user random stream for the simulation.
Definition at line 60 of file microsimulation.cc.
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 38 of file microsimulation.cc.
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 64 of file microsimulation.cc.
void ssim::r_set_user_random_seed | ( | double * | inseed | ) |
A utility function to set the user random seed for the simulation.
Definition at line 43 of file microsimulation.cc.
|
inline |
RemoveKind is a function to remove messages with the given kind from the queue.
This works across all processes.
Definition at line 256 of file microsimulation.h.
|
inline |
RemoveName is a function to remove messages with the given name from the queue.
This works across all processes.
Definition at line 274 of file microsimulation.h.
double ssim::rweibullHR | ( | double | shape, |
double | scale, | ||
double | hr | ||
) |
Random Weibull distribution for a given shape, scale and hazard ratio.
Definition at line 5 of file microsimulation.cc.
Time ssim::simTime | ( | ) |
simTime() function for OMNET++ API compatibility
Definition at line 13 of file microsimulation.cc.
void ssim::test_rstream2 | ( | double * | x | ) |
Simple test of the random streams (with a stupid name)
Definition at line 86 of file microsimulation.cc.
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 651 of file microsimulation.h.
double* ssim::user_unif_rand | ( | ) |
Definition at line 76 of file microsimulation.cc.
|
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 547 of file microsimulation.h.
|
static |
|
static |
|
static |
Definition at line 18 of file microsimulation.cc.
|
static |
Definition at line 18 of file microsimulation.cc.
|
static |
|
static |
const ProcessId ssim::NULL_PROCESSID = -1 |
|
static |
Definition at line 19 of file microsimulation.cc.