| village {villager} | R Documentation |
Village
Description
This is an object that represents the state of a village at a particular time.
Details
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.
Methods
initialize()Creates a new village
propagate()Advances the village a single time step
set_initial_state()Initializes the initial state of the village
Public fields
nameAn optional name for the village
initial_conditionA function that sets the initial state of the village
current_stateThe village's current state
previous_stateThe village's previous state
modelsA list of functions or a single function that should be run at each timestep
model_dataOptional data that models may need
agent_mgrThe manager that handles all of the agents
resource_mgrThe manager that handles all of the resources Initializes a village
Methods
Public methods
Method new()
This method is meant to set the variables that are needed for a village to propagate through time.
Usage
village$new( name, initial_condition, models = list(), agent_class = villager::agent, resource_class = villager::resource )
Arguments
nameAn optional name for the village
initial_conditionA function that gets called on the first time step
modelsA list of functions or a single function that should be run at each time step
agent_classThe class that's being used to represent agents
resource_classThe class being used to describe the resources Propagates the village a single time step
Method propagate()
Usage
village$propagate(current_step)
Arguments
current_stepThe current time step
Details
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.
Returns
None Runs the user defined function that sets the initial state of the village
Method set_initial_state()
Runs the initial condition model
Usage
village$set_initial_state()
Method clone()
The objects of this class are cloneable with this method.
Usage
village$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.