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

lm::Agent Class Reference

#include <Agent.h>

List of all members.

Public Methods

 ~Agent ()
 Agent (std::string name)
void add (Sensor &newSense)
std::list< Effector * > getEffectors ()
std::list< Sensor * > getSensors ()
void add (Effector &newEffect)
void swapDecider (Decider &newDecider)
DecidergetDecider ()
void swapLearner (Learner &newLearner)
LearnergetLearner ()
void swapProblemGenerator (ProblemGenerator &newPG)
ProblemGeneratorgetProblemGenerator ()
void registerAgent (LoomKernel *a)
void unregisterAgent ()
void update ()
std::string getNextInstruction ()
void sendNextInstruction (Effector *e)
std::list< Agent * > find (Sensor *s, int depth=0)
std::list< Agent * > find (std::list< Sensor * > sList, int depth=0)
std::list< Agent * > find (Effector *e, int depth=0)
std::list< Agent * > find (std::list< Effector * > eList, int depth=0)
std::list< Agent * > find (std::list< Sensor * > sList, std::list< Effector * > eList, int depth=0)
std::list< Effector * > findEffectors (int depth=0)
std::list< Sensor * > findSensors (int depth=0)
std::list< Agent * > findAgents (int depth=0)
std::string getName ()
UUID getUUID ()
void setAgentType (int agentType, std::list< Agent * > *agents=NULL)
void setLoomKernel (LoomKernel *ac)
void setAgentInternalName (UUID name)

Private Attributes

std::list< Effector * > mEffectors
std::list< Sensor * > mSensors
DecidermDecider
LearnermLearner
ProblemGeneratormProblemGenerator
UUID uniqueName
std::string mName
LoomKernelmLoomKernel
StubEffectorstubbyE
StubSensorstubbyS
StubDeciderstubbyD
StubLearnerstubbyL
StubProblemGeneratorstubbyP
int mState


Detailed Description

this is the agent class, all intelligent entities are agents in loom.


Constructor & Destructor Documentation

lm::Agent::~Agent  
 

destructor

lm::Agent::Agent std::string    name
 

constructor that takes a string argument for a name. This way a human readable name can be used if the developer chooses. The constructor also instantiates a stubEffector, stubSensor, and stubDecider so that the agent has some default action that it is always capable of performing. A guid is generated for a unique name which is what loom uses internally as it's name.


Member Function Documentation

void lm::Agent::add Effector   newEffect
 

addEffector adds a new effector to this agent.

Parameters:
newEffect  is a pointer ot a valid Effector
Postcondition:
newEffect is registered with this agent

void lm::Agent::add Sensor   newSense
 

this method adds a new sense to this agent.

Parameters:
newSense  is a pointer to a valid Sensor
Postcondition:
newSense is registered with this agent

std::list< Agent * > lm::Agent::find std::list< Sensor * >    sList,
std::list< Effector * >    eList,
int    depth = 0
 

check the network up to the specified depth for all Agents that have all the specified sensors in sList and all the specified Effectors in eList and return a list of references to them. If no depth is specified then we will only search the local agents on the same machine.

std::list< Agent * > lm::Agent::find std::list< Effector * >    eList,
int    depth = 0
 

check the network up to the specified depth for all agents that have all the effectors in the list eList and return a list of references to them. If no depth is specified then we will only search the local agents on the same machine.

std::list< Agent * > lm::Agent::find Effector   e,
int    depth = 0
 

check the network up to the specified depth for all agents that have Effector e and return them in a list of references. If no depth is specified then we will only search the local agents on the same machine.

std::list< Agent * > lm::Agent::find std::list< Sensor * >    sList,
int    depth = 0
 

check the network for all agents that have all the sensor in Slist up to the specified depth in the network and return them back in a list of references to agents. If no depth is specified then we will only search the local agents on the same machine.

std::list< Agent * > lm::Agent::find Sensor   s,
int    depth = 0
 

check the network up to the specified depth for all agents that have Sensors and give them back in a list of references to Agents. If no depth is specified then we will only search the local agents on the same machine.

std::list< Agent * > lm::Agent::findAgents int    depth = 0
 

find all the agents that are on the network up to the specified depth. IF no depth is specified then we default to only checking for the agents on this machine (or on this agent Collector)

std::list< Effector * > lm::Agent::findEffectors int    depth = 0
 

show me all the effectors that are on the network up to a specified depth. If no depth is specified then we default to only checking for the effectors on this machine (or on this agent collector)

std::list< Sensor * > lm::Agent::findSensors int    depth = 0
 

find all the sensors that are on the network up to the specified depth. IF no depth is specified then we default ot only checking for the sensors on this machine (or on this agent collector)

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

get the decider

std::list<Effector*> lm::Agent::getEffectors   [inline]
 

this method returns a list of all effectors that this agent currently has

Learner* lm::Agent::getLearner   [inline]
 

returns this agents Learner

std::string lm::Agent::getName  
 

return the human readable name of the agent

std::string lm::Agent::getNextInstruction  
 

a method to go the agentCollector and ask him for the next item in his queue for us. It should always be a string that is the name of the effector for us to run.

ProblemGenerator* lm::Agent::getProblemGenerator   [inline]
 

returns this agents ProblemGenerator

std::list<Sensor*> lm::Agent::getSensors   [inline]
 

this method returns a list of all sensors that htis agent currently has

UUID lm::Agent::getUUID  
 

return the guid that represents this agent within loom

void lm::Agent::registerAgent LoomKernel   a
 

register connects this agent to an agentCollector. You will always need to join an agentCollector or your agent will not work. If there isn't already an agentCollector in your application then you will need to add one - see the documentation for how to do this (it's real easy).

Also this method generates stub components for problemGen, effector, and sensor If you want to add agent specific effectors or sensors then you must add them using the addEffector and addSensor methods.

void lm::Agent::sendNextInstruction Effector   e
 

Send next instruction will send a message over network to all agents.

void lm::Agent::setAgentInternalName UUID    name
 

set's the guid of the agent which is used internally to loom

void lm::Agent::setAgentType int    agentType,
std::list< Agent * > *    agents = NULL
 

set the state of the agent to be a give type. You can pass in the various AgentState types into the agentType method. If you want an agent to have multiple roles that is ok too you would do it like this: setAgentType(REQUESTING|PARENT|STANDALONE, std::list<Agent*> a);

void lm::Agent::setLoomKernel LoomKernel   ac
 

method to set this agent's LoomKernel

void lm::Agent::swapDecider Decider   newDecider
 

swapDecider allows the agent to switch which Decider it uses at run-time.

Parameters:
newDecider  is the new Decision making Decider that the agent will use

void lm::Agent::swapLearner Learner   newLearner
 

swapLearner allows the agent to switch which learner it uses at run-time.

Parameters:
newLearner  is the new Learner that the agent will use for learning new things.

void lm::Agent::swapProblemGenerator ProblemGenerator   newPG
 

swapProblemGenerator allows the agent to switch which Problem Generator it uses at run-time.

Parameters:
newPG  is the new problem generator that the agent will use

void lm::Agent::unregisterAgent  
 

unregisetAgent removes the agent from the agentCollector and stops the threads execution

void lm::Agent::update  
 

This is the update method, it is the control loop for the core and is called from the agentCollector that this agent running on.


Member Data Documentation

Decider* lm::Agent::mDecider [private]
 

We have a Decider that is what decides what effect to select based on what the sensors, learner and problem generator tell us.

std::list<Effector*> lm::Agent::mEffectors [private]
 

We keep a list of effectors specific to us - we need this so that when we switch deciders we can tell the new one all of the effectors that we currently know about.

Learner* lm::Agent::mLearner [private]
 

Every agent has a learner which can update the decider

LoomKernel* lm::Agent::mLoomKernel [private]
 

we keep a reference to our agent collector so that we can communicate back from it about other agents.

std::string lm::Agent::mName [private]
 

this is a name that the user defines for each agent. If the user does not specify a name then the unique name is used as a string in it's place.

ProblemGenerator* lm::Agent::mProblemGenerator [private]
 

Every agent has a problem generator which is used as a curiosity function

std::list<Sensor*> lm::Agent::mSensors [private]
 

We keep a list of sensors specific to this agent. We need this so that when we switch deciders we can tell the new one all of the senses that we currently know about.

int lm::Agent::mState [private]
 

we keep an enumerated value for what state the agent is in

StubDecider* lm::Agent::stubbyD [private]
 

StubEffector* lm::Agent::stubbyE [private]
 

we include a stub implementation of the sensor, effector, Decider, Learner, and Problem Generatory so that we have a default implementation to use until the user adds his/her own implemenations to the agent

StubLearner* lm::Agent::stubbyL [private]
 

StubProblemGenerator* lm::Agent::stubbyP [private]
 

StubSensor* lm::Agent::stubbyS [private]
 

UUID lm::Agent::uniqueName [private]
 

Internally to loom we name an agent by creating a guid for the name. This is what we pass around loom in communication for names, not the string name that the user uses.


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