Struct AgentLogFrame

Struct Documentation

struct AgentLogFrame

Frame of logging data related to a specific agent type and state. The data available depends on the AgentLoggingConfig used for the agent type at runtime

Public Functions

explicit AgentLogFrame(const std::map<LoggingConfig::NameReductionFn, detail::Any> &data, unsigned int count)

Constructs an AgentLogFrame from existing data

Parameters:
  • data – Map of reduction data

  • count – Population size (alive agents)

unsigned int getCount() const

Return the number of alive agents in the population

Returns:

The population size

template<typename T>
T getMin(const std::string &variable_name) const

Return the result of a min reduction performed on the specified agent variable This returns the maximum value of the specified variable found in the agent population

Parameters:

variable_name – The agent variable that was reduced

Template Parameters:

T – The type of agent variable variable_name

Throws:
  • exception::InvalidAgentVar – If a min reduction of the agent variable of name variable_name was not found within the log.

  • exception::InvalidVarType – If the agent variable variable_name does not have type T within the agent.

Returns:

The result of the min reduction

template<typename T>
T getMax(const std::string &variable_name) const

Return the result of a max reduction performed on the specified agent variable This returns the minimum value of the specified variable found in the agent population

Parameters:

variable_name – The agent variable that was reduced

Template Parameters:

T – The type of agent variable variable_name

Throws:
  • exception::InvalidAgentVar – If a max reduction of the agent variable of name variable_name was not found within the log.

  • exception::InvalidVarType – If the agent variable variable_name does not have type T within the agent.

Returns:

The result of the max reduction

template<typename T>
sum_input_t<T>::result_t getSum(const std::string &variable_name) const

Return the result of a sum reduction performed on the specified agent variable This returns the result of summing every agent’s copy of the specified variable

Parameters:

variable_name – The agent variable that was summed

Template Parameters:

T – The type of agent variable variable_name

Throws:
  • exception::InvalidAgentVar – If a sum reduction of the agent variable of name variable_name was not found within the log.

  • exception::InvalidVarType – If the agent variable variable_name does not have type T within the agent.

Returns:

The result of the sum (The type of this return value is the highest range type of the same format)

double getMean(const std::string &variable_name) const

Return the result of a mean reduction performed on the specified agent variable This returns the mean average value of the specified agent variable

Parameters:

variable_name – The agent variable that was averaged

Template Parameters:

T – The type of agent variable variable_name

Throws:
  • exception::InvalidAgentVar – If a mean reduction of the agent variable of name variable_name was not found within the log.

  • exception::InvalidVarType – If the agent variable variable_name does not have type T within the agent.

Returns:

The result of the average

double getStandardDev(const std::string &variable_name) const

Return the result of a standard deviation reduction performed on the specified agent variable This returns the standard deviation of the set of agent’s copies of the specified agent variable

Parameters:

variable_name – The agent variable that was reduced

Template Parameters:

T – The type of agent variable variable_name

Throws:
  • exception::InvalidAgentVar – If a standard deviation reduction of the agent variable of name variable_name was not found within the log.

  • exception::InvalidVarType – If the agent variable variable_name does not have type T within the agent.

Returns:

The result of the standard deviation reduction