Agents Module Documentation

Agent

class agent.Agent(unique_id, model)

Base class to create Agent objects. The agents are controlled by the scheduler of the Model associated.

Attributes:
model: Model associated to the agent. unique_id: Unique id of the agent. color: Color with which the agent will be represented in the visualization.
Methods:
step: Method invoked by the Model scheduler in each step. Step common to all Agents.
step()

Method invoked by the Model scheduler in each step. Step common to all Agents.

Occupant

Agent Modules

AStar

aStar.canMovePos(model, cellPos, posAux, others=[])
Evaluate if a position is reachable in a continuous space.
Args:
model: Model which invokes the algorithm. cellPos: a first one position given as (x, y). posAux: a second one position given as (x, y). others: List of auxiliary positions given to be considered impenetrable, that is, they will not be used by the AStar.

Return: List of positions (x, y).

aStar.getConectedCellsContinuous(model, cell, others)
Gets a list of connected cells in a continuous space.
Args:
model: Model which invokes the algorithm. cell: cell object corresponding to the position. other: List of auxiliary positions given to be considered impenetrable, that is, they will not be used by the AStar.

Return: List of positions (x, y).

aStar.getConectedCellsRooms(model, cell)
Gets a list of connected cells in a space defined by rooms.
Args:
model: Model which invokes the algorithm. cell: cell object corresponding to the room.

Return: List of positions (x, y).

aStar.getPathContinuous(model, start, finish, other=[])
Calculate the optimal path in the models with the space continuous.
Args:
model: Model which invokes the algorithm. start: Initial position. finish: Final position. other: List of auxiliary positions given to be considered impenetrable, that is, they will not be used by the AStar.

Return: List of positions (x, y).

aStar.getPathRooms(model, start, finish)
Calculate the optimal path in the models with the space defined by rooms.
Args:
model: Model which invokes the algorithm. start: Initial position. finish: Final position.

Return: List of positions (x, y).

Markov

class behaviourMarkov.Markov(agent_aux)

Base class to models the activity of the agents by means of Markovian behavior.

Attributes:
agent: Agent that is controlled by this models.
Methods:
runStep: Execute a Markovian state change by evaluating the initial state and the probabilities associated with each possible state. getNextState: Evaluate a random change based on the probabilities corresponding to each state.
getNextState(markov_matrix, NumberCurrentState)
Evaluate a random change based on the probabilities corresponding to each state.
Args:
markov_matrix: Markov matrix corresponding to a certain moment. NumberCurrentState: Unique id as number of the current state.
runStep(markov_matrix)
Execute a Markovian state change by evaluating the initial state and the probabilities associated with each possible state.
Args:
markov_matrix: Markov matrix corresponding to a certain moment.

FOV

fov.FOV_RADIUS = 30000

In the file aStar.py the filed of vision algorithm is implemented.

class fov.Map(map)

Class to calculate the field of vision (fov).

Attributes:
data: Map to which to apply the algorithm.
Methods:
do_fov: Calculate the field of view from a position (x, y).
More information:
http://www.roguebasin.com/index.php?title=Python_shadowcasting_implementation
do_fov(x, y)
Calculate the field of view from a position (x, y).
Args:
x, y: Observer’s position

Return: Array of sight positions.

fov.makeFOV(dungeon, pos)
Create the invocation object of the fov algorithm and invoke it.
Args:
dungeon: Array pos: Observer’s position

Return: Array of sight positions.