Qualia  0.2
Public Member Functions | Public Attributes | List of all members
MultiAgent Class Referenceabstract

#include <MultiAgent.h>

Inheritance diagram for MultiAgent:
Inheritance graph
[legend]
Collaboration diagram for MultiAgent:
Collaboration graph
[legend]

Public Member Functions

 MultiAgent (int nAgents, Agent **assign=0)
 
virtual ~MultiAgent ()
 Class destructor (frees the sub-agents if ownsAgents is true). More...
 
virtual void init ()
 Initializes the agent. More...
 
virtual Actionstart (const Observation *observation)
 Chooses the first action in the episode. More...
 
virtual Actionstep (const Observation *observation)
 Performs an episode step. More...
 
virtual void end (const Observation *observation)
 Performs the last episode step. More...
 
virtual ObservationextractAgentObservation (int agentIdx, const Observation *observation)=0
 
virtual void appendAgentAction (int agentIdx, const Action *agentAction)=0
 
virtual ActioncombineAgentActions ()=0
 
- Public Member Functions inherited from Agent
virtual ~Agent ()
 
virtual void save (XFile *file)
 Saves the agent. More...
 
virtual void load (XFile *file)
 Loads an agent. More...
 

Public Attributes

Agent ** agents
 The array of sub-agents. More...
 
int nAgents
 The number of sub-agents. More...
 
bool ownsAgents
 True if this MultiAgent owns the pointers to the agents (and will thus free them at destruction). More...
 

Constructor & Destructor Documentation

MultiAgent::MultiAgent ( int  nAgents,
Agent **  assign = 0 
)

Constructor. Creates a multi-agent of nAgents sub-agents. Sub-agents can be assigned on-the-spot by specifying assign or later on by assigning them eg. this->agents[i] = new MyAgent(). If such is the case (ie. if assign is NULL), then the MultiAgent will also own the agents.

MultiAgent::~MultiAgent ( )
virtual

Class destructor (frees the sub-agents if ownsAgents is true).

Member Function Documentation

virtual void MultiAgent::appendAgentAction ( int  agentIdx,
const Action agentAction 
)
pure virtual

Appends action from sub-agent agentIdx to the action that will later be returned by the call to combineAgentActions().

virtual Action* MultiAgent::combineAgentActions ( )
pure virtual

Returns the combine action that is the result of combining all the sub-agent actions through calls to appendAgentAction(agentIdx, agentAction).

void MultiAgent::end ( const Observation observation)
virtual

Performs the last episode step.

Reimplemented from Agent.

virtual Observation* MultiAgent::extractAgentObservation ( int  agentIdx,
const Observation observation 
)
pure virtual

Returns an observation suitable for sub-agent agentIdx starting from observation observation as received by this MultiAgent.

void MultiAgent::init ( )
virtual

Initializes the agent.

Reimplemented from Agent.

Action * MultiAgent::start ( const Observation observation)
virtual

Chooses the first action in the episode.

Implements Agent.

Action * MultiAgent::step ( const Observation observation)
virtual

Performs an episode step.

Implements Agent.

Member Data Documentation

Agent** MultiAgent::agents

The array of sub-agents.

int MultiAgent::nAgents

The number of sub-agents.

bool MultiAgent::ownsAgents

True if this MultiAgent owns the pointers to the agents (and will thus free them at destruction).


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