00001
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
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;
00045 std::vector<NLAIAGENT::CStringVarName *> _qual;
00046 std::vector<CFuzzyFact *> _facts;
00047
00048 public:
00049
00050
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
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