Class ReporterModel

Inheritance Relationships

Base Type

Class Documentation

class ReporterModel : public kami::Model

An abstract for generic models with a reporting capability.

See also

Model

Public Functions

ReporterModel()

Constructor.

virtual std::unique_ptr<nlohmann::json> collect() = 0

Collect the current state of the model.

This function should collect the model’s current state. The model, notably, does not need to collect historical state, as the historical state is retained by the Reporter instance until such time as Reporter::report() is called. However, the implementation of the collect() function is up to the end user who can, ultimately, return whatever they want.

This is not expected to return agent data collection, as the agents’ information is collected separately.

virtual unsigned int get_step_id()

Get the step id of the model.

The step_id should probably be a monotonically incrementing integer.

virtual std::shared_ptr<Model> step() override

Execute a single time step of the model.

This method will collect all the Agents in the Population associated with the model and pass them to the associated Scheduler for stepping. After scheduling, this method will run the collect() for the Reporter associated with this model.

Returns

a shared pointer to the model instance

std::unique_ptr<nlohmann::json> report()

Get the current report.

This method will return an object containg the data collected to that point in the simulation.

Returns

a unique pointer to a nlohmann::json object representing the current report

Protected Attributes

std::shared_ptr<Reporter> _rpt

The current report.

unsigned int _step_count = {}

The model’s current step count.