Skip to contents

Initializes an AgentBasedModel with specified parameters and agents. If parameters is NULL, the function constructs a ModelParameters object using any additional arguments (...) passed to make_model_parameters().

Usage

make_abm(parameters = NULL, agents = NULL, ...)

Arguments

parameters

A ModelParameters instance specifying model context. If NULL, parameters are created using make_model_parameters(...).

agents

A list of Agent objects, typically created separately. Optional.

...

Additional arguments passed to make_model_parameters() if parameters is NULL.

Value

An AgentBasedModel instance.

Examples

abm <- make_abm(n_agents = 10)
abm2 <- make_abm(parameters = make_model_parameters(n_agents = 10))
abm_g <- make_abm(graph = socmod::make_small_world(N = 20, k = 6, p = 0.2))
abm_g2 <- make_model_parameters(
  graph = socmod::make_small_world(N = 20, k = 6, p = 0.2)
) %>% make_abm