Manager_base Class Reference

Abstract base class for the managers of agents (interface agent-side). More...

#include <Manager_base.h>

Inheritance diagram for Manager_base:

Inheritance graph
[legend]
Collaboration diagram for Manager_base:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Manager_base (ThreadManager *MTHREAD_h, string name_h)
virtual ~Manager_base ()
virtual void riseMyAgents ()=0
virtual void locateMyAgents ()=0
 Create new layers, locate the managed agents in the space and assign the plots to agents;.
virtual void assignObjectsToAgents ()
 Assign non-spacial objects to agents.
virtual void assignSpatialObjectsToAgents ()
virtual void createBehaviours ()=0
 Assign spacial objects to agents. Doesn't do anything if agent is not spatial.
virtual void endInit ()
virtual void prepare ()=0
 Individual managers can skip this function if they don't have anything to set before simulation.
virtual void act ()=0
virtual void update ()=0
virtual void planNext ()=0
int getNewMouldLocalID ()
int getNewAgentLocalID ()
string getName ()
vector< Agent_base * > getMyAgents ()
int countMyAgents ()
 Return all managed agents.
Agent_basegetAgentByLocalID (double localID_h)
 Return the pointer to a managed agent gived its ID;.
vector< Agent_base * > getRandomAgents (int size_h)
 Randomly return size_h pointers to its managed agents;.
virtual void setAgentMoulds ()=0
 Init the moulds.
void rescaleMoulds (double factor_h)
 Rescale the mould coefficients of a constant factor (e.g. for the subregion).
void setName (string name_h)
vector< int > getMouldIDs ()
int getMouldLocalIDCounter ()
int getManagerID ()

Protected Attributes

vector< Agent_base * > agentsMoulds
 Vector of pointers to their managed agents (moulds).
vector< Agent_base * > managedAgents
 Vector of pointers to their managed agents (actual agents).
vector< Agent_base * > removedAgents
 Vector of pointers to agents "removed" from the model.
int mouldLocalIDCounter
 each mould has its own local ID (unique for each agent typology)
int agentLocalIDCounter
 each agent has its own local ID (unique for each agent typology)
string name
 name of the category of agents (eg. "farmers")
int managerID
 Id of the manager.
Agent_basecollectorAgent
 This agent collects (And become the owner) of all spatial objects left by the leaving agents. Is agent_base type (an not agent_space) as in the future it could be used for other things as well.

Detailed Description

Abstract base class for the managers of agents (interface agent-side).

This is the interface agent_side. All (or most.. now we'll see) function should be "virtual", as they should be coded according with the specific agent type.
This is the base class for all the manager objects:
Manager_base --> manager_nospacial --> ...
Manager_base --> manager_spaciallyExplicit --> ...
Regional data is declared "const", leading to a read-only way. To write back to the environment must be used specialized functions.

Author:
Antonello Lobianco

Definition at line 47 of file Manager_base.h.


Constructor & Destructor Documentation

Manager_base ( ThreadManager MTHREAD_h,
string  name_h 
)

Definition at line 27 of file Manager_base.cpp.

~Manager_base (  )  [virtual]

Definition at line 38 of file Manager_base.cpp.


Member Function Documentation

virtual void riseMyAgents (  )  [pure virtual]

This abstract virtual function when applyed to the various manager, make them to rise their agents from their moulds according to their specific code. Rise the agents (mostly from the moulds)

Implemented in Manager_farmers.

virtual void locateMyAgents (  )  [pure virtual]

Create new layers, locate the managed agents in the space and assign the plots to agents;.

Implemented in Manager_farmers.

void assignObjectsToAgents (  )  [virtual]

Assign non-spacial objects to agents.

Abstract virtual function to be ran on init time to assign objects to each agents according to their mould and each manager rules.

Definition at line 74 of file Manager_base.cpp.

virtual void assignSpatialObjectsToAgents (  )  [inline, virtual]

Reimplemented in Manager_space.

Definition at line 63 of file Manager_base.h.

virtual void createBehaviours (  )  [pure virtual]

Assign spacial objects to agents. Doesn't do anything if agent is not spatial.

Implemented in Manager_farmers.

virtual void endInit (  )  [inline, virtual]

Reimplemented in Manager_farmers.

Definition at line 65 of file Manager_base.h.

virtual void prepare (  )  [pure virtual]

Individual managers can skip this function if they don't have anything to set before simulation.

Implemented in Manager_farmers.

virtual void act (  )  [pure virtual]

Implemented in Manager_farmers.

virtual void update (  )  [pure virtual]

Implemented in Manager_farmers.

virtual void planNext (  )  [pure virtual]

Implemented in Manager_farmers.

int getNewMouldLocalID (  )  [inline]

Definition at line 72 of file Manager_base.h.

Referenced by Manager_farmers::setAgentMoulds().

Here is the caller graph for this function:

int getNewAgentLocalID (  )  [inline]

Definition at line 73 of file Manager_base.h.

Referenced by Manager_farmers::riseMyAgents().

Here is the caller graph for this function:

string getName (  )  [inline]

Definition at line 74 of file Manager_base.h.

Referenced by Manager_farmers::planNext(), Manager_farmers::riseMyAgents(), Manager_farmers::update(), and ~Manager_base().

Here is the caller graph for this function:

vector<Agent_base*> getMyAgents (  )  [inline]

Definition at line 75 of file Manager_base.h.

int countMyAgents (  )  [inline]

Return all managed agents.

Definition at line 76 of file Manager_base.h.

Agent_base * getAgentByLocalID ( double  localID_h  ) 

Return the pointer to a managed agent gived its ID;.

Definition at line 57 of file Manager_base.cpp.

Referenced by Manager_farmers::locateMyAgents().

Here is the caller graph for this function:

vector< Agent_base * > getRandomAgents ( int  size_h  ) 

Randomly return size_h pointers to its managed agents;.

Definition at line 99 of file Manager_base.cpp.

virtual void setAgentMoulds (  )  [pure virtual]

Init the moulds.

This abstract virtual function when applyed to the various manager, make them to "create" the moulds for their agents according to their specific code

Implemented in Manager_space, and Manager_farmers.

void rescaleMoulds ( double  factor_h  ) 

Rescale the mould coefficients of a constant factor (e.g. for the subregion).

Definition at line 90 of file Manager_base.cpp.

void setName ( string  name_h  )  [inline]

Definition at line 85 of file Manager_base.h.

vector< int > getMouldIDs (  ) 

Definition at line 111 of file Manager_base.cpp.

int getMouldLocalIDCounter (  )  [inline]

Definition at line 87 of file Manager_base.h.

int getManagerID (  )  [inline]

Definition at line 88 of file Manager_base.h.

Referenced by Agent_base::answerStats().

Here is the caller graph for this function:


Member Data Documentation

vector<Agent_base*> agentsMoulds [protected]

Vector of pointers to their managed agents (moulds).

Definition at line 88 of file Manager_base.h.

Referenced by rescaleMoulds(), Manager_farmers::riseMyAgents(), Manager_farmers::setAgentMoulds(), and ~Manager_base().

vector<Agent_base*> managedAgents [protected]

Vector of pointers to their managed agents (actual agents).

Definition at line 92 of file Manager_base.h.

Referenced by Manager_farmers::act(), assignObjectsToAgents(), Manager_farmers::calibrateLandValues(), countMyAgents(), Manager_farmers::createBehaviours(), getAgentByLocalID(), Manager_farmers::getAverageRightsByAct(), getMyAgents(), getRandomAgents(), Manager_farmers::landAllocation(), Manager_farmers::locateMyAgents(), Manager_farmers::planNext(), Manager_farmers::prepare(), Manager_farmers::removeFromModel(), Manager_farmers::riseMyAgents(), Manager_farmers::update(), and ~Manager_base().

vector<Agent_base*> removedAgents [protected]

Vector of pointers to agents "removed" from the model.

Definition at line 93 of file Manager_base.h.

Referenced by ~Manager_base().

int mouldLocalIDCounter [protected]

each mould has its own local ID (unique for each agent typology)

Definition at line 94 of file Manager_base.h.

Referenced by getMouldIDs(), getMouldLocalIDCounter(), getNewMouldLocalID(), and Manager_base().

int agentLocalIDCounter [protected]

each agent has its own local ID (unique for each agent typology)

Definition at line 95 of file Manager_base.h.

Referenced by getNewAgentLocalID(), and Manager_base().

string name [protected]

name of the category of agents (eg. "farmers")

Definition at line 96 of file Manager_base.h.

Referenced by getName(), Manager_farmers::landAllocation(), Manager_base(), Manager_farmers::quotePlot(), and setName().

int managerID [protected]

Id of the manager.

Definition at line 97 of file Manager_base.h.

Referenced by getManagerID(), Manager_farmers::locateMyAgents(), Manager_base(), and Manager_farmers::Manager_farmers().

Agent_base* collectorAgent [protected]

This agent collects (And become the owner) of all spatial objects left by the leaving agents. Is agent_base type (an not agent_space) as in the future it could be used for other things as well.

Definition at line 98 of file Manager_base.h.

Referenced by Manager_farmers::Manager_farmers(), Manager_farmers::removeFromModel(), and Manager_farmers::~Manager_farmers().


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