API Documentation (ver. 0.9.9)

Create a New Model

Use NewModel() to create and initialize a new model. This is the first step in the model description.

The function will return a pointer to the newly created model, and this pointer will be used throughout the model description source file.

M3AM *NewModel(const char *label, SpaceDim dimensions);

Create a New Class

Use NewClass() to create a new “Class” object identified by a label, with a predefined number of states.

The function will take care to update the data structures (particularly linking this object with the M3AM model pointer.

Error NewClass(M3AM *model, char *label, NumStates states);

Create a New Agent

Use NewAgent() to create a new agent object, identified by a label. Set the agent class by passing its label as function parameter.

Error NewAgent(M3AM *model, const char *agent_label, const char *class_label, Point *coordinates, Density csi);

Initial Agent State Probabilities

Add the initial probabilities of an agent identified by its label with AddInitProb(). It change the probability of a specified state.

Error AddInitProb(M3AM *model, const char *class_label, NumStates i, double prob);

Add Self-Loop Rate

Use AddSelfLoop() to add a new self-loop rate for a given agent class.

Error AddSelfLoop(M3AM *model, const char *class_label, NumStates i, double val);

Add Local Transition Rate

Use AddLocTr() to add a new local transition rate to a given agent class, identified by its label.

Error AddLocTr(M3AM *model, const char *class_label, NumStates r, NumStates c, double val);

Create a New Message Type

Use NewMSG() to add a new message type to the model, identifying it with a label.

Error NewMSG(M3AM *model, const char *message_label);

Add Message Type to Class

Use AddMsgToCl() to link a message type to a specific agent class.

Error AddMsgToCl(M3AM *model, const char *clabel, const char *mlabel);

Add Message Generation Probability

Use AddMsgGenProb() to set a message generation probability for specified message and agent class.

Error AddMsgGenProb(M3AM *model, const char *class_label, const char *message_label, NumStates r, NumStates c, double val);

Add Message Acceptance Probability

Use AddMsgAccProb() to set a message acceptance probability for specified message and agent class.

Error AddMsgAccProb(M3AM *model, const char *class_label, const char *message_label, NumStates r, NumStates c, double val);

Add a Message Perception Probability

Use AddPer() to update the messages perception values, with a new probability for given message and transmitting and receiving agents.

Error AddPer(M3AM *model, Message msg, const char *rx, const char *tx, NumStates r, NumStates c, double val);

Class Iterator

Use the following functions to initialize and use a class iterator

Class ClassIterator(M3AM *model);
Class NextClass(Class cl);
short ClassIsValid(Class cl);
short ClassIs(Class cl, const char *class_label);

Message Iterator

As for the classes, it’s possible to define and use message iterators

Message MessageIterator(M3AM *model);
Message NextMessage(Message msg);
short MsgIsValid(Message msg);
int MessageIs( Message msg, const char *message_label);

Analysis

Set the parameter of the analysis

Params SetSimParams(Time t_start, Time t_end, Step dt, Tolerance epslon, int iterations, int threads_number)

and launch the analysis with

Error AnalyzeModel(Params analysis_parameters, M3AM model, OUT_Mode output_mode);