Skip to contents

Trial runner helper function

Usage

run_trial(
  model,
  stop = socmod::fixated,
  legacy_behavior = "Legacy",
  adaptive_behavior = "Adaptive",
  metadata = list()
)

Arguments

model

An AgentBasedModel

stop

Stopping condition: max steps (int) or predicate function

adaptive_behavior

The behavior treated as "adaptation success". Default is "Adaptive".

Value

A Trial object

Examples

agents <- list(
  Agent$new(name = "1", behavior = "Legacy", fitness = 1),
  Agent$new(name = "2", behavior = "Adaptive", fitness = 4)
)
#> Error in initialize(...): argument "id" is missing, with no default
net <- igraph::make_graph(~ 1-2)
model <- AgentBasedModel$new(agents = agents, graph = net)
#> Error in initialize(...): unused argument (graph = list(2, FALSE, 1, 0, NULL, NULL, NULL, NULL, list(c(1, 0, 1), list(), list(c("1", "2")), list()), <environment>))
trial <- run_trial(model, stop = 10)
#> Error: object 'model' not found