createForagers: Forager Constructor Wrapper

View source: R/createForagers.R

createForagersR Documentation

Forager Constructor Wrapper

Description

A wrapper function to create a list of foragers from lists of parameter values. Handles single values if parameter is the same for all foragers. Assigns default values for empty fields.

Usage

createForagers(
  numForagers,
  type = "Random",
  bounds = NA,
  locations = NA,
  bearings = NA,
  speeds = NA,
  concentrations = NA,
  persistences = NA,
  sights = NA,
  giving_up_density = NA,
  efficiency = NA,
  repeatAvoids = NA,
  quiet = FALSE,
  CRS = "NA",
  turnBiases = NA,
  choice_determinism = NA
)

Arguments

numForagers

A numeric giving the number of foragers to be created

type

A character giving the type of forager to create. Currenly handles "Random" (default, parent class Forager) and "BRW" (brwForager)

bounds

A simple features collection of polygons within which all foragers must be created

locations

A list of simple features collections each containing a single st_POINT giving the initial location of a new forager. If NA or empty, foragers will be created at random locations within bounds

bearings

A single numeric giving the initial bearing of all new foragers in radians or a list of numerics equal in length to the value of numForagers

speeds

A single numeric giving the initial speed of all new foragers or a list of numerics equal in length to the value of numForagers

concentrations

A single numeric giving the initial concentration of all new foragers or a list of numerics equal in length to the value of numForagers. Ignored unless type = "BRW"

persistences

NUmeric vector with values between 0 and 1. Each element of this vector dictates the weight of an agents current direction relative to the direction of the agents current target when choosing a new direction

sights

A single numeric giving the initial sight range of all new foragers or a list of numerics equal in length to the value of numForagers

giving_up_density

the per-step energy return at which an agent will leave a foraging patch

efficiency

the proportion of a patch that an agent extracts and adds to its energy each time step spend foraging

repeatAvoids

A single numeric giving the number of unique patches a forager must visit before revisting a patch, or a list of numerics equal in length to the value of numForagers

quiet

A logical indicating whether to suppress warnings about default values used to fill in empty fields

CRS

A numeric giving the CRS code to assign to forager locations. If bounds argument is defined, the CRS of that object will be used and this argument will be ignored

turnBiases

A single numeric giving the average turn angle of a forager in radians, or a list of numerics equal in length to the value of numForagers. Ignored unless type = "BRW"

choice_determinism

A numeric vector with values between -1 and 1. For each agent, the corresponding value sets the randomness of its decisions, where -1 is nearly entirely random, 0 sets decision probabities directly proportional to the ratin of patch value to distance, and 1 nearly always selects the most valuable patch


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