ArrayEnvironment-class: ArrayEnvironment Constructor

ArrayEnvironment-classR Documentation

ArrayEnvironment Constructor

Description

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

Fields

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.

Methods

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


aqvining/Foraging-Simulator documentation built on Nov. 19, 2022, 5:43 p.m.