ArrayEnvironment-class | R Documentation |
Constructor function for the ArrayEnvironment class, which inherits from the Environment class. In addition to the features of a normal environment, this object will reset foragers once all patches have been visited (a trial), while tracking a single foragers sequences over all trials
foragers
a list containing Reference Class objects that inherit from 'Forager' class.
patches
a simple feature data frame with geometries representing patches in the geometry column
bounds
a spatial features collection with one or more polygons defining the region in which any foragers can be created and moved to
sequences
the names of all patches visited (in order) by foragers (only really works with a single forager currently, sequences by multiple foragers will be mixed together). Usually the defualt of an empty character is used
array
the name of the array being run, if it has one
trials
the number of trials that have been run. Has no effect on the environment, merely usefull as metadata. Typically uses default value of 0 at creation.
initialize(
...,
patches = lapply(rep(2, times = 10), function(x) st_point(runif(x, min = -15, max =
15))) %>% st_sfc %>% data.frame(geom = ., NAME = as.character(1:length(.)),
MAX_VALUE = 10, VALUE = 8, REGEN = 1) %>% st_sf() %>% st_buffer(1) %>%
st_set_crs(32610),
bounds = st_sfc(st_buffer(st_convex_hull(reduce(patches$geometry, c)), 1), crs =
st_crs(patches)),
foragers = createForagers(3, bounds = bounds, speed = 2, quiet = TRUE)
)
Set default values for variables that are not entered manually
progress()
moves the entire environment forward one timestep by moving all foragers once and processing impact of foraging on patches
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.