#if !defined(FZYLV_H) #define FZYLV_H #include "fzyset.h" typedef Array1D FzySetArray; /******************************************************************************/ /* */ /* Linguistic Variable class */ /* */ /******************************************************************************/ class LinguisticVariable { public: FzySetArray FzySet; int NbFzyTerm; float DomainMax; float DomainMin; f1D point; void Initialize(int nb_terms, float min, float max); void Print(ostream &os); void SetName(char name[]){Name=name;} int FindMaxDegreeFuzzySet(float t); float FindFuzzySetValue(int ndx_fzy_set, float t); FuzzySet GetFuzzySet(int i); protected: void CreateFuzzySet(); char *Name; }; void LinguisticVariable::Initialize(int nb_terms, float min, float max) { NbFzyTerm = nb_terms; DomainMax = max; DomainMin = min; point.Initialize(NbFzyTerm+2); FzySet.Initialize(NbFzyTerm); float step = (max-min)/float(NbFzyTerm+1); point[0]= DomainMin; for(int i=1; imax){max=d[i];ndx=i;} delete [] d; return ndx; } float LinguisticVariable::FindFuzzySetValue(int ndx_fzy_set, float t) { float tt = FzySet[ndx_fzy_set].membership(t); return tt; } FuzzySet LinguisticVariable::GetFuzzySet(int ndx_fzy_set) { FuzzySet fzy; fzy.Initialize(FzySet[ndx_fzy_set]); return fzy; } #endif