MamdaniConsequent.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /* Copyright 2010 Juan Rada-Vilela
  2. Licensed under the Apache License, Version 2.0 (the "License");
  3. you may not use this file except in compliance with the License.
  4. You may obtain a copy of the License at
  5. http://www.apache.org/licenses/LICENSE-2.0
  6. Unless required by applicable law or agreed to in writing, software
  7. distributed under the License is distributed on an "AS IS" BASIS,
  8. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  9. See the License for the specific language governing permissions and
  10. limitations under the License.
  11. */
  12. /*
  13. * File: MamdaniConsequent.h
  14. * Author: jcrada
  15. *
  16. * Created on March 3, 2010, 12:17 AM
  17. */
  18. #ifndef FL_MAMDANICONSEQUENT_H
  19. #define FL_MAMDANICONSEQUENT_H
  20. #include "FuzzyConsequent.h"
  21. #include "LinguisticTerm.h"
  22. #include "Hedge.h"
  23. #include <vector>
  24. #include "FuzzyExceptions.h"
  25. #include "FuzzyEngine.h"
  26. namespace fl {
  27. class MamdaniConsequent : public FuzzyConsequent {
  28. private:
  29. const LinguisticTerm* _term;
  30. std::vector<Hedge*> _hedges;
  31. public:
  32. MamdaniConsequent();
  33. virtual ~MamdaniConsequent();
  34. virtual void setTerm(const LinguisticTerm* term);
  35. virtual const LinguisticTerm* term() const;
  36. virtual void addHedge(Hedge* hedge);
  37. virtual Hedge* hedge(int index) const ;
  38. virtual int numberOfHedges() const;
  39. //Override
  40. virtual void execute(flScalar degree);
  41. virtual std::string toString() const;
  42. virtual void parse(const std::string& consequent,
  43. const FuzzyEngine& engine) throw (ParsingException) ;
  44. };
  45. }
  46. #endif /* FL_MAMDANICONSEQUENT_H */