village | R Documentation |
This is an object that represents the state of a village at a particular time.
This class acts as a type of record that holds the values of the different village variables. This class can be subclassed to include more variables that aren't present.
initialize()
Creates a new village
propagate()
Advances the village a single time step
set_initial_state()
Initializes the initial state of the village
name
An optional name for the village
initial_condition
A function that sets the initial state of the village
current_state
The village's current state
previous_state
The village's previous state
models
A list of functions or a single function that should be run at each timestep
model_data
Optional data that models may need
agent_mgr
The manager that handles all of the agents
resource_mgr
The manager that handles all of the resources Initializes a village
new()
This method is meant to set the variables that are needed for a village to propagate through time.
village$new( name, initial_condition, models = list(), agent_class = villager::agent, resource_class = villager::resource )
name
An optional name for the village
initial_condition
A function that gets called on the first time step
models
A list of functions or a single function that should be run at each time step
agent_class
The class that's being used to represent agents
resource_class
The class being used to describe the resources Propagates the village a single time step
propagate()
village$propagate(current_step)
current_step
The current time step
This method is used to advance the village a single time step. It should NOT be used to set initial conditions. See the set_initial_state method.
None Runs the user defined function that sets the initial state of the village
set_initial_state()
Runs the initial condition model
village$set_initial_state()
clone()
The objects of this class are cloneable with this method.
village$clone(deep = FALSE)
deep
Whether to make a deep clone.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.