00001
00010
00011
00012 #include "Fuzzy/Operators.h"
00013
00014 RCPtr<ComposedFS> Operators::max(const RCPtr<FuzzySet>& l ,const RCPtr<FuzzySet>& r) {
00015 RCPtr<ComposedFS> cfs(new ComposedFS(ComposedFS::MAX,l,r));
00016 return(cfs);
00017 };
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 RCPtr<SingletonFS> Operators::minLFS(const RCPtr<FuzzySet>& s,const RCPtr<FuzzySet>& fs) {
00031 RCPtr<SingletonFS> sfs(new SingletonFS(s->defuzzify(),(*fs)(s->defuzzify())));
00032 return(sfs);
00033 };
00034
00035 RCPtr<FuzzySet> Operators::min(const RCPtr<FuzzySet>& l, const RCPtr<FuzzySet>& r) {
00036 RCPtr<FuzzySet> result;
00037 if (fabs(l->getMin()-l->getMax())<1E-8)
00038
00039
00040
00041 {
00042 result = minLFS(l,r);
00043 return result;
00044 };
00045 if (fabs(r->getMin()-r->getMax())<1E-8)
00046
00047 {
00048 result = minLFS(r,l);
00049 return result;
00050 };
00051 ComposedFS* cfs = new ComposedFS(ComposedFS::MIN,l,r);
00052 return(cfs);
00053 };
00054
00055 RCPtr< ComposedNDimFS > Operators::supMinComp(const std::vector<double> & d, Implication* imp) {
00056
00057
00058
00059
00060
00061
00062 RCPtr<ComposedNDimFS> ndfs = (*imp)(d,Implication::Y);
00063 return(ndfs);
00064 };