# Home    # nevrax.com   
Nevrax
Nevrax.org
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
Docs
 
Documentation  
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  

fuzzyvar.h

Go to the documentation of this file.
00001 
00007 /* Copyright, 2000 Nevrax Ltd.
00008  *
00009  * This file is part of NEVRAX NEL.
00010  * NEVRAX NEL is free software; you can redistribute it and/or modify
00011  * it under the terms of the GNU General Public License as published by
00012  * the Free Software Foundation; either version 2, or (at your option)
00013  * any later version.
00014 
00015  * NEVRAX NEL is distributed in the hope that it will be useful, but
00016  * WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00018  * General Public License for more details.
00019 
00020  * You should have received a copy of the GNU General Public License
00021  * along with NEVRAX NEL; see the file COPYING. If not, write to the
00022  * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
00023  * MA 02111-1307, USA.
00024  */
00025 
00026 #ifndef NL_FUZZY_VAR_H
00027 #define NL_FUZZY_VAR_H
00028 
00029 #include "nel/ai/fuzzy/fuzzyset.h"
00030 #include "nel/ai/logic/var.h"
00031 #include "nel/ai/fuzzy/fuzzyfact.h"
00032 
00033 namespace NLAIFUZZY
00034 {
00035 
00036         class CSimpleFuzzyCond;
00037 
00038         class CFuzzyVar : public NLAILOGIC::IBaseVar {
00039                 private:
00040                         double _Value;
00041                         double _Min;
00042                         double _Max;
00043                         char *_Name;
00044                         std::vector<IFuzzySet *> _sets;                         // Sous ensembles flous
00045                         std::vector<NLAIAGENT::CStringVarName *> _qual;         // Qualificateurs linguistiques associés        
00046                         std::vector<CFuzzyFact *> _facts;
00047 
00048                 public:
00049                         // Constructors
00050                         // Parmaters: name, val min, val max, initial value
00051                         CFuzzyVar(const NLAIAGENT::IVarName &, double, double, NLAIAGENT::IObjetOp *);
00052                         CFuzzyVar(const NLAIAGENT::IVarName &, double, double, double value = 0 );
00053                         CFuzzyVar(const CFuzzyVar &);
00054                         ~CFuzzyVar();
00055 
00056                         // Adds a fuzzy set to the var
00057                         void addSet(IFuzzySet *, char *);
00058                         IFuzzySet *getSet(char *);
00059 
00060                         std::list<CFuzzyFact *> *fuzzify(double val);
00061                         virtual double unfuzify();
00062                         void addFact(CFuzzyFact *);
00063                         void addFact(char *,double);
00064                         bool isIn(IFuzzySet *);
00065                         float membership(IFuzzySet *);
00066 
00067                         CSimpleFuzzyCond *getCond(char *);
00068 
00069                         virtual void setValue(NLAIAGENT::IObjetOp *obj);
00070                         virtual void setValue(float);
00071                         virtual NLAIAGENT::IObjetOp *getValue() const;
00072                         virtual const NLAIC::IBasicType *clone() const;
00073                         virtual const NLAIC::IBasicType *newInstance() const;
00074                         virtual void save(NLMISC::IStream &os);
00075                         virtual void load(NLMISC::IStream &is);
00076                         virtual void getDebugString(std::string &) const;
00077                         virtual const NLAIAGENT::IObjectIA::CProcessResult &run();
00078                         bool isEqual(const CFuzzyVar &a) const;
00079                         bool isEqual(const NLAIAGENT::IBasicObjectIA &a) const;
00080                         virtual bool isTrue() const;
00081                         const NLAIC::CIdentType &getType() const;
00082                         virtual bool operator==(NLAILOGIC::IBaseVar *var);
00083                         bool unify(NLAILOGIC::IBaseVar *, bool assign = false);
00084                         bool unify(NLAIAGENT::IObjetOp *, bool assign = false);
00085 
00086                         virtual NLAIAGENT::IObjetOp *operator == (NLAIAGENT::IObjetOp &a) const;
00087                         
00088                         static const NLAIC::CIdentType IdFuzzyVar;
00089 
00090                         sint32 getMethodIndexSize() const;
00091                         virtual NLAIAGENT::tQueue isMember(const NLAIAGENT::IVarName *,const NLAIAGENT::IVarName *,const NLAIAGENT::IObjectIA &) const;
00092                         virtual NLAIAGENT::IObjectIA::CProcessResult runMethodeMember(sint32, NLAIAGENT::IObjectIA *);
00093                         virtual NLAIAGENT::IObjectIA::CProcessResult runMethodeMember(sint32, sint32, NLAIAGENT::IObjectIA *);
00094 
00095                         virtual void init(NLAIAGENT::IObjectIA *);
00096         };
00097 }
00098 
00099 #endif