SuperAgentManager Class Reference

Program-side interface to comunicate with the different agent managers. More...

#include <SuperAgentManager.h>

Inheritance diagram for SuperAgentManager:

Inheritance graph
[legend]
Collaboration diagram for SuperAgentManager:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 SuperAgentManager (ThreadManager *MTHREAD_h)
 ~SuperAgentManager ()
vector< string > getAgentTypeNames ()
 Return the category names of the agents (e.g. "Agent_farmer").
vector< int > getAgentCountByType ()
 Return the number of agents managed for each type.
vector< Manager_base * > getManagers ()
 Return the vector of Managers (pointers).
void addManager (Manager_base *manager_h)
 Add the manager to the vector of managers.
void setAgentMoulds ()
 Asks managers to setting their moulds.
void populateAgents ()
 Asks managers to rise their actual agents.
void locate ()
 Asks managers to locate agents in the space and assign plots, eventually creating new layers.
void assignObjectsToAgents ()
 Asks managers to assign objects to their agents.
void assignSpatialObjectsToAgents ()
 Asks managers to assign spatial objects to their agent's plots.
int getNewUniqueAgentID ()
int getNewUniqueManagerID ()
void rescaleMoulds (double factor_h)
 Ask managers to rescale their agent's mould coefficients of a constant factor.
void createBehaviours ()
 Ask managers to create the behaviour system on their agents.
void endInit ()
 If managers need to fix something before the rimulation really begane, they can do it here.
void prepare ()
 Ask managers to prepare the period.
void act ()
 Ask managers to actually take their decisions.
void update ()
 Ask managers to update the data of their agents as loop in ending.
void planNext ()
 Ask managers to plan for the following year, including decision to leave the sector.
vector< Agent_base * > getAgentsByType (bool onlySpatial, string category_h="")

Private Attributes

vector< Manager_base * > managers
 Vector of all the managers of the various type of agents.
int uniqueAgentIDCounter
 Counter unique for each agent in the model.
int uniqueManagerIDCounter
 Counter for each manager in the model.

Detailed Description

Program-side interface to comunicate with the different agent managers.

Main class for agents. It should be an interface for the I/O with the program (particularly, with the Scheduler) ON THE PROGRAM SIDE.
This class has a unique istance and own a vector of Manager_base object (called without too much fantacy "managers").
The idea is to have a parallel hierachical system for the agent managers and for the agents. The former are responsable to aggregate the agents they manage and produce aggregated autput, while the latter are the behaviour of the single agents.
In the middle of the hiearchical system there is a division between agents with space-related carachteristics (e.g. farmers) and agents not georeferenced (e.g. market agents).

this file --> interface programmer side


Manager_base --> interface on the single agent side, base class for manager objects
Manager_nospace --> half-derived class for manager object of agent without explicit spatial rappresentation
manager_space --> the same for agents that require geolocalisation
agents/manager_xxxs --> the final manager object for the specific agent type


Agent_base --> desribing the behaviour of all modelled agents, base
Agent_nospace --> derived class for agetns without space requirements
Agent_space --> derived class for spaced related agents
agents/agent_xxxx --> describing the single agent behaviour

For each new "agent type" there should so the need of only two files. The agents need to know only about their manager, and their manager need info only from their agents and the "SuperAgentManager" class.

Author:
Antonello Lobianco

Definition at line 61 of file SuperAgentManager.h.


Constructor & Destructor Documentation

SuperAgentManager ( ThreadManager MTHREAD_h  ) 

Constructor of the Super Agent Manager object. It will cover all the aspects of dealing with agents

Definition at line 30 of file SuperAgentManager.cpp.

~SuperAgentManager (  ) 

Definition at line 38 of file SuperAgentManager.cpp.


Member Function Documentation

vector< string > getAgentTypeNames (  ) 

Return the category names of the agents (e.g. "Agent_farmer").

Definition at line 46 of file SuperAgentManager.cpp.

Referenced by Output::initOutputAggregatedData().

Here is the caller graph for this function:

vector< int > getAgentCountByType (  ) 

Return the number of agents managed for each type.

Definition at line 55 of file SuperAgentManager.cpp.

Referenced by Output::printAggregatedData().

Here is the caller graph for this function:

vector<Manager_base*> getManagers (  )  [inline]

Return the vector of Managers (pointers).

Definition at line 72 of file SuperAgentManager.h.

Referenced by Output::initOutputAggregatedData(), and Output::printAggregatedData().

Here is the caller graph for this function:

void addManager ( Manager_base manager_h  )  [inline]

Add the manager to the vector of managers.

Definition at line 75 of file SuperAgentManager.h.

Referenced by Init::setInitLevel1().

Here is the caller graph for this function:

void setAgentMoulds (  ) 

Asks managers to setting their moulds.

See also:
Manager_base::setAgentMoulds()

Definition at line 64 of file SuperAgentManager.cpp.

Referenced by Init::setInitLevel1().

Here is the caller graph for this function:

void populateAgents (  ) 

Asks managers to rise their actual agents.

See also:
Manager_base::riseMyAgents()

Definition at line 92 of file SuperAgentManager.cpp.

Referenced by Init::setInitLevel1().

Here is the caller graph for this function:

void locate (  ) 

Asks managers to locate agents in the space and assign plots, eventually creating new layers.

See also:
Manager_base::locateMyAgents();

Definition at line 99 of file SuperAgentManager.cpp.

Referenced by Init::setInitLevel3().

Here is the caller graph for this function:

void assignObjectsToAgents (  ) 

Asks managers to assign objects to their agents.

See also:
Manager_base::assignObjectsToAgents()

Definition at line 78 of file SuperAgentManager.cpp.

Referenced by Init::setInitLevel3().

Here is the caller graph for this function:

void assignSpatialObjectsToAgents (  ) 

Asks managers to assign spatial objects to their agent's plots.

See also:
Manager_space::assignObjectsToAgents()

Definition at line 85 of file SuperAgentManager.cpp.

Referenced by Init::setInitLevel3().

Here is the caller graph for this function:

int getNewUniqueAgentID (  )  [inline]

Definition at line 86 of file SuperAgentManager.h.

Referenced by Manager_farmers::riseMyAgents().

Here is the caller graph for this function:

int getNewUniqueManagerID (  )  [inline]

Definition at line 87 of file SuperAgentManager.h.

Referenced by Manager_base::Manager_base().

Here is the caller graph for this function:

void rescaleMoulds ( double  factor_h  ) 

Ask managers to rescale their agent's mould coefficients of a constant factor.

See also:
Manager_base::rescaleMoulds()

Definition at line 71 of file SuperAgentManager.cpp.

Referenced by Init::setInitLevel1().

Here is the caller graph for this function:

void createBehaviours (  ) 

Ask managers to create the behaviour system on their agents.

See also:
Manager_farmer::createBehaviours()

Definition at line 106 of file SuperAgentManager.cpp.

Referenced by Init::setInitLevel3().

Here is the caller graph for this function:

void endInit (  ) 

If managers need to fix something before the rimulation really begane, they can do it here.

Definition at line 113 of file SuperAgentManager.cpp.

Referenced by Init::setInitLevel3().

Here is the caller graph for this function:

void prepare (  ) 

Ask managers to prepare the period.

See also:
Manager_farmer::prepare()

Definition at line 120 of file SuperAgentManager.cpp.

Referenced by Scheduler::run().

Here is the caller graph for this function:

void act (  ) 

Ask managers to actually take their decisions.

See also:
Manager_farmer::act()

Definition at line 127 of file SuperAgentManager.cpp.

Referenced by Scheduler::run().

Here is the caller graph for this function:

void update (  ) 

Ask managers to update the data of their agents as loop in ending.

See also:
Manager_farmer::update()

Definition at line 134 of file SuperAgentManager.cpp.

Referenced by Scheduler::run().

Here is the caller graph for this function:

void planNext (  ) 

Ask managers to plan for the following year, including decision to leave the sector.

See also:
Manager_farmer::planNext()

Definition at line 147 of file SuperAgentManager.cpp.

Referenced by Scheduler::run().

Here is the caller graph for this function:

vector< Agent_base * > getAgentsByType ( bool  onlySpatial,
string  category_h = "" 
)

Definition at line 154 of file SuperAgentManager.cpp.

Referenced by Gis::getClosestAgents(), Output::initOutputAggregatedData(), Output::initOutputDetailedData(), Output::printAggregatedData(), and Output::printDebugMatrices().

Here is the caller graph for this function:


Member Data Documentation

vector<Manager_base*> managers [private]

Vector of all the managers of the various type of agents.

Definition at line 107 of file SuperAgentManager.h.

Referenced by act(), addManager(), assignObjectsToAgents(), assignSpatialObjectsToAgents(), createBehaviours(), endInit(), getAgentCountByType(), getAgentsByType(), getAgentTypeNames(), getManagers(), locate(), planNext(), populateAgents(), prepare(), rescaleMoulds(), setAgentMoulds(), update(), and ~SuperAgentManager().

int uniqueAgentIDCounter [private]

Counter unique for each agent in the model.

Definition at line 108 of file SuperAgentManager.h.

Referenced by getNewUniqueAgentID(), and SuperAgentManager().

int uniqueManagerIDCounter [private]

Counter for each manager in the model.

Definition at line 109 of file SuperAgentManager.h.

Referenced by getNewUniqueManagerID(), and SuperAgentManager().


The documentation for this class was generated from the following files: