Skip to contents

Agent attributes include information about previous, current, and next behaviors, neighbors (an instance of the Neighbors class). Use class methods to calculate exposure probability, add neighbors, or set agent fitness.

Public fields

prev_behavior

Previous agent behavior.

curr_behavior

Current agent behavior.

next_behavior

Next behavior the agent could do, depending on iterate_model.

neighbors

Initial set of neighbors.

prev_fitness

Previous agent fitness.

curr_fitness

Current agent fitness.

next_fitness

Next fitness.

name

Agent's name.

group

Agent's group.

Methods


Method new()

Create a new Agent instance.

Usage

Agent$new(
  behavior = "",
  fitness = 0,
  name = NULL,
  neighbors = c(),
  group = NULL
)

Arguments

behavior

Initial agent behavior.

fitness

Agent fitness.

name

Agent name; should be unique or maybe face unexpected problems.

neighbors

Initialize neighbors; typically done in ABM initialization.

Returns

A new Agent object. Add agents to this agent's neighbor field


Method add_neighbors()

Usage

Agent$add_neighbors(new_neighbors)

Arguments

new_neighbors

List of Agents to add as neighbors.

Returns

self (Agent) Calculate the exposure probability for this agent.


Method exposure_prob()

Usage

Agent$exposure_prob()

Returns

Float ≥ 0 and ≤ 1 representing the probability of a non-trivial exposure to the adaptive behavior, where non-trivial exposure means the learner is doing the legacy behavior and selects an agent doing the adaptive behavior. Set the agent's current fitness value.


Method set_fitness()

Usage

Agent$set_fitness(fitness)

Arguments

fitness

The fitness to assign.

Returns

self


Method clone()

The objects of this class are cloneable with this method.

Usage

Agent$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.