TakagiSugenoConsequent.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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: TakagiSugenoConsequent.h
  14. * Author: jcrada
  15. *
  16. * Created on March 4, 2010, 12:18 AM
  17. */
  18. #ifndef FL_TAKAGISUGENOCONSEQUENT_H
  19. #define FL_TAKAGISUGENOCONSEQUENT_H
  20. #include "FuzzyConsequent.h"
  21. #include "InfixToPostfix.h"
  22. namespace fl {
  23. class TakagiSugenoConsequent : public FuzzyConsequent {
  24. private:
  25. const FuzzyEngine* _fuzzy_engine;
  26. std::string _consequent;
  27. std::string _postfix_function;
  28. InfixToPostfix _infix2postfix;
  29. protected:
  30. const FuzzyEngine& fuzzyEngine() const;
  31. void setFuzzyEngine(const FuzzyEngine& fuzzy_engine);
  32. std::string consequent() const;
  33. void setConsequent(const std::string& consequent);
  34. std::string postfixFunction() const;
  35. void setPostfixFunction(const std::string& postfix);
  36. public:
  37. TakagiSugenoConsequent();
  38. virtual ~TakagiSugenoConsequent();
  39. virtual void parse(const std::string& consequent,
  40. const FuzzyEngine& engine) throw (ParsingException);
  41. virtual void execute(flScalar degree);
  42. virtual std::string toString() const;
  43. static void main(int args, char** argv);
  44. };
  45. }
  46. #endif /* FL_TAKAGISUGENOCONSEQUENT_H */