Miscellaneous Methods

These other methods are also available within DeviceAPI for use within agent functions:

Method

Return

Description

getID()

unsigned int

Returns the current agent’s unique identifier, this ID is unique to the agent throughout the simulation. All IDs are greater than 0.

getStepCounter()

unsigned int

Returns the current step index, the first step has index 0. Exit conditions execute before the step counter is incremented.

getThreadIndex()

unsigned int

Returns the current thread index, each agent executing the agent function has a unique thread index in the range [0, N).

isAgent()

bool

When passed a string literal, this function will return a boolean confirming whether that string matches the executing agent’s name. This function is considered expensive.

isState()

bool

When passed a string literal, this function will return a boolean confirming whether that string matches the executing agent’s state. This function is considered expensive.