#include <Agent.h>
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) |
Decider * | getDecider () |
void | swapLearner (Learner &newLearner) |
Learner * | getLearner () |
void | swapProblemGenerator (ProblemGenerator &newPG) |
ProblemGenerator * | getProblemGenerator () |
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 |
Decider * | mDecider |
Learner * | mLearner |
ProblemGenerator * | mProblemGenerator |
UUID | uniqueName |
std::string | mName |
LoomKernel * | mLoomKernel |
StubEffector * | stubbyE |
StubSensor * | stubbyS |
StubDecider * | stubbyD |
StubLearner * | stubbyL |
StubProblemGenerator * | stubbyP |
int | mState |
|
destructor |
|
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. |
|
addEffector adds a new effector to this agent.
|
|
this method adds a new sense to this agent.
|
|
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. |
|
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. |
|
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. |
|
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. |
|
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. |
|
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) |
|
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) |
|
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) |
|
get the decider |
|
this method returns a list of all effectors that this agent currently has |
|
returns this agents Learner |
|
return the human readable name of the agent |
|
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. |
|
returns this agents ProblemGenerator |
|
this method returns a list of all sensors that htis agent currently has |
|
return the guid that represents this agent within loom |
|
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. |
|
Send next instruction will send a message over network to all agents. |
|
set's the guid of the agent which is used internally to loom |
|
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); |
|
method to set this agent's LoomKernel |
|
swapDecider allows the agent to switch which Decider it uses at run-time.
|
|
swapLearner allows the agent to switch which learner it uses at run-time.
|
|
swapProblemGenerator allows the agent to switch which Problem Generator it uses at run-time.
|
|
unregisetAgent removes the agent from the agentCollector and stops the threads execution |
|
This is the update method, it is the control loop for the core and is called from the agentCollector that this agent running on. |
|
We have a Decider that is what decides what effect to select based on what the sensors, learner and problem generator tell us. |
|
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. |
|
Every agent has a learner which can update the decider |
|
we keep a reference to our agent collector so that we can communicate back from it about other agents. |
|
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. |
|
Every agent has a problem generator which is used as a curiosity function |
|
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. |
|
we keep an enumerated value for what state the agent is in |
|
|
|
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 |
|
|
|
|
|
|
|
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. |