2
0

FuzzyEngine.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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: FuzzyEngine.h
  14. * Author: jcrada
  15. *
  16. * Created on November 1, 2009, 4:51 PM
  17. */
  18. #ifndef FL_FUZZYENGINE_H
  19. #define FL_FUZZYENGINE_H
  20. #include "FuzzyOperator.h"
  21. #include "InputLVar.h"
  22. #include "OutputLVar.h"
  23. #include "Hedge.h"
  24. #include "RuleBlock.h"
  25. #include "HedgeSet.h"
  26. namespace fl {
  27. class FuzzyEngine {
  28. private:
  29. std::string _name;
  30. FuzzyOperator* _fuzzy_op;
  31. HedgeSet* _hedge_set;
  32. std::vector<InputLVar*> _input_lvars;
  33. std::vector<OutputLVar*> _output_lvars;
  34. std::vector<RuleBlock*> _rule_blocks;
  35. public:
  36. FuzzyEngine();
  37. FuzzyEngine(const std::string& name);
  38. FuzzyEngine(const std::string& name, FuzzyOperator& fuzzy_operator);
  39. virtual ~FuzzyEngine();
  40. virtual void setName(const std::string& name);
  41. virtual std::string name() const;
  42. virtual void process(bool clear = true);
  43. virtual void process(int ruleblock, bool clear = true);
  44. virtual void reset();
  45. virtual void addInputLVar(InputLVar* lvar);
  46. virtual InputLVar* inputLVar(int index) const ;
  47. virtual InputLVar* inputLVar(const std::string& name) const;
  48. virtual InputLVar* removeInputLVar(int index) ;
  49. virtual InputLVar* removeInputLVar(const std::string& name);
  50. virtual int indexOfInputLVar(const std::string& name) const;
  51. virtual int numberOfInputLVars() const;
  52. virtual void addOutputLVar(OutputLVar* lvar);
  53. virtual OutputLVar* outputLVar(int index) const ;
  54. virtual OutputLVar* outputLVar(const std::string& name) const;
  55. virtual OutputLVar* removeOutputLVar(int index) ;
  56. virtual OutputLVar* removeOutputLVar(const std::string& name);
  57. virtual int indexOfOutputLVar(const std::string& name) const;
  58. virtual int numberOfOutputLVars() const;
  59. virtual HedgeSet& hedgeSet() const;
  60. virtual void addRuleBlock(RuleBlock* ruleblock);
  61. virtual RuleBlock* removeRuleBlock(int index);
  62. virtual RuleBlock* ruleBlock(int index) const;
  63. virtual RuleBlock* ruleBlock(const std::string& name) const;
  64. virtual int numberOfRuleBlocks() const;
  65. virtual void setFuzzyOperator(FuzzyOperator& fuzzy_operator);
  66. virtual FuzzyOperator& fuzzyOperator() const;
  67. virtual void setInput(const std::string& input_lvar, flScalar value);
  68. virtual flScalar output(const std::string& output_lvar) const;
  69. virtual std::string fuzzyOutput(const std::string& output_lvar) const;
  70. virtual std::string toString() const;
  71. };
  72. }
  73. #endif /* FL_FUZZYENGINE_H */