Class Population

Class Documentation

class Population

An abstract for generic models.

Public Functions

std::shared_ptr<Agent> get_agent_by_id(AgentID agent_id) const

Get a reference to an Agent by AgentID

Parameters

agent_id[in] the AgentID to search for.

Returns

a reference to the desired Agent or nothing is not found

AgentID add_agent(const std::shared_ptr<Agent> &agent) noexcept

Add an Agent to the Population.

Parameters

agent – The Agent to add.

Returns

the ID of the agent added

std::shared_ptr<Agent> delete_agent(AgentID agent_id)

Remove an Agent from the Population.

Parameters

agent_id – The AgentID of the agent to remove.

Returns

a shared pointer to the Agent deleted

std::unique_ptr<std::vector<AgentID>> get_agent_list() const

Returns the agent list.

Returns

a std::vector of all the AgentID’s in the Population

Protected Attributes

std::map<kami::AgentID, std::shared_ptr<Agent>> _agent_map

A mapping of AgentID to Agent pointers.

This is the mapping of all AgentIDs to pointers to the corresponding Agent in this population. This is left exposed as protected should any subclass wish to manipulate this mapping directly.