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

Agent.h

Go to the documentation of this file.
00001 /***************************************************************** lm-cpr beg
00002  *
00003  * AI Loom - A cross platform artificial intelligence framework
00004  * AI Loom is (c) Copyright 2003 Josh Brown
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Library General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2 of the License, or (at your option) any later version.
00010  *
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Library General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Library General Public
00017  * License along with this library; if not, write to the
00018  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00019  * Boston, MA 02111-1307, USA.
00020  *
00021  * -----------------------------------------------------------------
00022  * File:          $RCSfile: Agent.h,v $
00023  * Date modified: $Date: 2003/10/16 05:53:28 $
00024  * Version:       $Revision: 1.17 $
00025  * -----------------------------------------------------------------
00026  *
00027  ************************************************************** lm-cpr-end */
00028 #ifndef LM_AGENT_H
00029 #define LM_AGENT_H
00030 
00031 #include <list>
00032 
00033 #include "Decider.h"
00034 #include "Defs.h"
00035 #include "Effector.h"
00036 #include "Learner.h"
00037 #include "LoomKernel.h"
00038 #include "ProblemGenerator.h"
00039 #include "Sensor.h"
00040 #include "StubEffector.h"
00041 #include "StubSensor.h"
00042 #include "StubDecider.h"
00043 #include "StubLearner.h"
00044 #include "StubProblemGenerator.h"
00045 #include "UUID.h"
00046 
00047 namespace lm
00048 {
00052    class Agent
00053    {
00054    public:
00058       ~Agent();
00059       
00068       Agent(std::string name);
00069 
00070       
00071 
00077       void add(Sensor& newSense);
00078       
00079  
00084       std::list<Effector*> getEffectors(){ return mEffectors; }
00085 
00089       std::list<Sensor*> getSensors(){ return mSensors; }
00090       
00096       void add(Effector& newEffect);
00097 
00104       void swapDecider(Decider& newDecider);
00105 
00107       Decider* getDecider(){ return mDecider; }
00108 
00115       void swapLearner(Learner& newLearner);
00116 
00120       Learner* getLearner(){ return mLearner; }
00121 
00127       void swapProblemGenerator(ProblemGenerator& newPG);
00128 
00132       ProblemGenerator* getProblemGenerator(){ return mProblemGenerator; }
00133       
00145       void registerAgent(LoomKernel* a);
00146 
00151       void unregisterAgent();
00152       
00157       void update();
00158    
00160    public:
00166       std::string getNextInstruction();
00167       
00171       void sendNextInstruction(Effector* e);
00172       
00179       std::list<Agent*> find(Sensor* s, int depth=0);
00180 
00187       std::list<Agent*> find(std::list<Sensor*> sList, int depth=0);
00188 
00195       std::list<Agent*> find(Effector* e, int depth=0);
00196 
00203       std::list<Agent*> find(std::list<Effector*> eList, int depth=0);
00204 
00212       std::list<Agent*> find(std::list<Sensor*> sList, std::list<Effector*> eList, int depth=0);
00213 
00219       std::list<Effector*> findEffectors(int depth=0);
00220 
00226       std::list<Sensor*> findSensors(int depth=0);
00227 
00233       std::list<Agent*> findAgents(int depth=0);
00234 
00235 
00237       std::string getName();
00238 
00240       UUID getUUID();
00241 
00248       void setAgentType(int agentType, std::list<Agent*>* agents = NULL);
00249 
00250 
00254       void setLoomKernel(LoomKernel* ac);
00255       
00259       void setAgentInternalName(UUID name);
00260       
00261    private:
00269       std::list<Effector*> mEffectors;
00270 
00276       std::list<Sensor*> mSensors;
00277 
00282       Decider* mDecider;
00283 
00287       Learner* mLearner;
00288 
00293       ProblemGenerator* mProblemGenerator;
00294 
00300       UUID uniqueName;
00301       
00307       std::string mName;
00308 
00313       LoomKernel* mLoomKernel;
00314       
00321       StubEffector* stubbyE;
00322       StubSensor* stubbyS;
00323       StubDecider* stubbyD;
00324       StubLearner* stubbyL;
00325       StubProblemGenerator* stubbyP;
00326 
00330       int  mState;
00331       
00332    };
00333       
00334       
00335 } // end namespace
00336       
00337 
00338 #endif // LM_AGENT_H

Generated on Wed Oct 22 21:33:21 2003 for AI Loom by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002