Constructor for the state-class
Usage
# S4 method for class 'state'
initialize(
.Object,
iteration,
setting,
agents = list(),
potential_agents = list(),
iteration_variables = data.frame(),
variables = list()
)Arguments
- .Object
For this class, should be left unspecified (see Example).
- iteration
Numeric denoting the iteration number that this state represents. Makes it possible to order states into one coherent trace, showing how agents walked around over time.
- setting
Object of the
background-class.- agents
List containing objects of the
agent-classrepresenting the agents that are currently walking around in thesetting. Defaults to an empty list.- potential_agents
List containing objects of the
agent-classrepresenting agents that are waiting to enter thesetting. Defaults to an empty list.- iteration_variables
Dataframe containing values for variables that control the simulation under the hood, such as
max_agents. Defaults to an empty data.frame.- variables
Named list containing variables that you want to use to control the simulation in the
fxargument of thesimulate. Defaults to an empty list.
Value
Object of the state-class
Examples
# Create a background in which agents will walk around
my_background <- background(shape = rectangle(center = c(0, 0),
size = c(2, 2)))
# Initialize state
my_state <- state(iteration = 0,
setting = my_background)
# Access the two slots that were specified
my_state@iteration
#> [1] 0
my_state@agents
#> list()