Class ReporterAgent

Inheritance Relationships

Base Type

Class Documentation

class ReporterAgent : public kami::Agent

A superclass for all reporting agents.

All reporting agents should subclass the ReportingAgent class. At a minimum, subclasses must implement the step() function, to execute a single time step for each agent.

See also

Agent, StagedAgent

Public Functions

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

Collect the current state of the agent.

This function should collect the agent’s current state. The agent, 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.

The only restriction on collect is that it must return its data as a nlohmann::json JSON object. See Reporter for additional details.

virtual AgentID step(std::shared_ptr<ReporterModel> model) = 0

Execute a time-step for the agent.

This function should step the agent instance. Any activities that the agent should perform as part of its time step should be in this function.

Parameters

model – a reference copy of the model

Returns

a copy of the AgentID