Trial class for running a single simulation
Trial class for running a single simulation
Details
Represents a single run of an AgentBasedModel over time, with customizable
interaction and update logic. Tracks time-series observations and outcome
measures such as adaptation success and steps to fixation.
Methods
Initialize a Trial with a model and functions
Arguments
model
An AgentBasedModel instance
metadata
Label-value metadata store for trial information
Method run()
Run the model and collect results
Usage
Trial$run(
stop = 50,
legacy_behavior = "Legacy",
adaptive_behavior = "Adaptive"
)
Arguments
stop
Either integer for max steps, or predicate function
legacy_behavior
The maladaptive behavior treated as "adaptation failure"
adaptive_behavior
The behavior treated as "adaptation success"
Add or update metadata in a Trial object
Usage
Trial$add_metadata(new_metadata)
Arguments
new_metadata
A named list to merge into existing metadata
self
The Trial object
Return the trial's metadata as a named list.
Returns
A named list containing metadata values for this trial, including
any scalar or function-valued inputs specified during setup.
Method get_observations()
Return the observation data
Method get_outcomes()
Return outcome measures
Method get_label()
Return the label for this trial (if set)
Method clone()
The objects of this class are cloneable with this method.
Usage
Trial$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.