Class Agent

Inheritance Relationships

Derived Types

Class Documentation

class Agent

A superclass for all agents.

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

Subclassed by kami::ReporterAgent, kami::StagedAgent

Public Functions

AgentID get_agent_id() const

Get the Agent’s AgentID.

Returns

the AgentID

virtual AgentID step(std::shared_ptr<Model> 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

Friends

friend bool operator==(const Agent &lhs, const Agent &rhs)

Compare if two Agents are the same Agent.

Subclasses of Agent may chose to extend this operator to tighten the restrictions on the comparison.

Note

This does not compare that two Agent instances are identical. Accordingly, this can be used to compare two instances of the same Agent at different points in its time stream.

Parameters
  • lhs – is the left-hand side of the equality test.

  • rhs – is the right-hand side of the equality test.

Returns

true is they are equal and false if not.

friend bool operator!=(const Agent &lhs, const Agent &rhs)

Compare if two Agents are not the same Agent.

Subclasses of Agent may chose to extend this operator to tighten the restrictions on the comparison.

Note

This does not compare that two Agent instances are identical. Accordingly, this can be used to compare two instances of the same Agent at different points in its time stream.

Parameters
  • lhs – is the left-hand side of the equality test.

  • rhs – is the right-hand side of the equality test.

Returns

true is they are not equal and false if they are.