Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members  

lm::Decider Class Reference

#include <Decider.h>

Inheritance diagram for lm::Decider:

lm::StubDecider List of all members.

Public Methods

 Decider (Effector *defaultEffect)
 Decider ()
virtual ~Decider ()
void append (std::list< Effector * > effects)
void append (std::list< Sensor * > senses)
void add (std::list< Effector * > effects)
void add (Effector &effect)
void add (Sensor &sense)
void add (std::list< Sensor * > senses)
void setEffectors (std::list< Effector * > effects)
void setSensors (std::list< Sensor * > senses)
std::list< Effector * > getEffectors ()
std::list< Sensor * > getSensors ()
void setAgent (Agent *newAgent)
void applyDecision (Effector *e, int agentState)
virtual EffectormakeDecision ()=0
AgentgetAgent ()

Protected Methods

std::list< boost::tuple< bool,
Sensor * > > 
getSensorsResults ()

Protected Attributes

std::list< Effector * > mEffectors
std::list< Sensor * > mSensors
std::list< boost::tuple< bool,
Sensor * > > 
mSensorsResults
AgentmAgent

Detailed Description

The decider class is the most integral part of an agent. This is the object that gets the results of all the sensors and makes a decision about which effector to use


Constructor & Destructor Documentation

lm::Decider::Decider Effector   defaultEffect
 

lm::Decider::Decider  
 

lm::Decider::~Decider   [virtual]
 


Member Function Documentation

void lm::Decider::add std::list< Sensor * >    senses
 

adds a list of sensors to this decider to look at

void lm::Decider::add Sensor   sense
 

adds a sensor to this decider to look at

void lm::Decider::add Effector   effect
 

adds an effector to this decider to choose from

void lm::Decider::add std::list< Effector * >    effects
 

adds a list of effectors to this decider to choose from

void lm::Decider::append std::list< Sensor * >    senses
 

void lm::Decider::append std::list< Effector * >    effects
 

void lm::Decider::applyDecision Effector   e,
int    agentState
 

this method is called internally to loom. It calls the makeDecision method that the user wrote and then determins what to do with the effector that makeDecision generates.

Agent* lm::Decider::getAgent   [inline]
 

returns this decider's agent.

std::list< Effector * > lm::Decider::getEffectors  
 

these methods exist so that the agent can get direct access into the effector and sensor lists of each agent in case he needs to swap deciders at run time. These should not be used by application developers.

std::list< Sensor * > lm::Decider::getSensors  
 

std::list< boost::tuple< bool, Sensor * > > lm::Decider::getSensorsResults   [protected]
 

This method is used to get the sensors and their results and store them in the boost::tuple. The reason we do this is that we need a

virtual Effector* lm::Decider::makeDecision   [pure virtual]
 

as a developer when you create a new agent by deriving from this class you only need to overload this method. Loom takes care of the rest

Implemented in lm::StubDecider.

void lm::Decider::setAgent Agent   newAgent
 

method that sets the decider's agent variable

void lm::Decider::setEffectors std::list< Effector * >    effects
 

void lm::Decider::setSensors std::list< Sensor * >    senses
 


Member Data Documentation

Agent* lm::Decider::mAgent [protected]
 

this is just a reference to the agent that we belong to. This allows us to get info from the agent about network related stuff

std::list<Effector*> lm::Decider::mEffectors [protected]
 

This is a list of effectors that I can choose to use

std::list<Sensor*> lm::Decider::mSensors [protected]
 

this is a list of sensors that I have that get checked continuously. If a developer needs access to the sensors and their output then they must use the mSensorsResults list.

std::list<boost::tuple<bool, Sensor*> > lm::Decider::mSensorsResults [protected]
 

This is a list of boost::tuples that contain the sensor|boolean result pair. This list is updated continuously by the agent. So the application developer can look at this tuple and immediately know what the current status is of the agent. XXX: the reason that we use boost::tuple instead of a map is that in the future we may open up the sensor api to return any type and then we couldn't use map anymore because the types might vary so we go with tuples which could easily rewrite to take any type.


The documentation for this class was generated from the following files:
Generated on Wed Oct 22 21:33:21 2003 for AI Loom by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002