1 /* 2 fuzzylite (R), a fuzzy logic control library in C++. 3 Copyright (C) 2010-2017 FuzzyLite Limited. All rights reserved. 4 Author: Juan Rada-Vilela, Ph.D. <jcrada@fuzzylite.com> 5 6 This file is part of fuzzylite. 7 8 fuzzylite is free software: you can redistribute it and/or modify it under 9 the terms of the FuzzyLite License included with the software. 10 11 You should have received a copy of the FuzzyLite License along with 12 fuzzylite. If not, see <http://www.fuzzylite.com/license/>. 13 14 fuzzylite is a registered trademark of FuzzyLite Limited. 15 */ 16 17 #ifndef FL_ACTIVATED_H 18 #define FL_ACTIVATED_H 19 20 #include "fl/term/Term.h" 21 22 namespace fl { 23 class TNorm; 24 25 /** 26 The Activated class is a special Term that contains pointers to the 27 necessary information of a term that has been activated as part of the 28 Antecedent of a Rule. The ownership of the pointers is not transferred to 29 objects of this class. The Activated class was named 30 `Thresholded` in versions 4.0 and earlier. 31 32 @author Juan Rada-Vilela, Ph.D. 33 @see OutputVariable 34 @see Term 35 @since 5.0 36 */ 37 class FL_API Activated : public Term { 38 private: 39 const Term* _term; 40 scalar _degree; 41 const TNorm* _implication; 42 43 public: 44 explicit Activated(const Term* term = fl::null, scalar degree = 1.0, 45 const TNorm* implication = fl::null); 46 virtual ~Activated() FL_IOVERRIDE; 47 FL_DEFAULT_COPY_AND_MOVE(Activated) 48 49 virtual std::string className() const FL_IOVERRIDE; 50 /** 51 Returns the parameters of the term 52 @return `"degree implication term"` 53 */ 54 virtual std::string parameters() const FL_IOVERRIDE; 55 /** 56 Does nothing. 57 @param parameters are irrelevant 58 */ 59 virtual void configure(const std::string& parameters) FL_IOVERRIDE; 60 61 virtual Complexity complexity() const FL_IOVERRIDE; 62 /** 63 Computes the implication of the activation degree and the membership 64 function value of @f$x@f$ 65 @param x is a value 66 @return @f$d \otimes \mu(x)@f$, where @f$d@f$ is the activation degree 67 */ 68 virtual scalar membership(scalar x) const FL_IOVERRIDE; 69 virtual std::string toString() const FL_IOVERRIDE; 70 71 /** 72 Sets the activated term 73 @param term is the activated term 74 */ 75 virtual void setTerm(const Term* term); 76 /** 77 Gets the activated term 78 @return the activated term 79 */ 80 virtual const Term* getTerm() const; 81 82 /** 83 Sets the activation degree of the term 84 @param degree is the activation degree of the term 85 */ 86 virtual void setDegree(scalar degree); 87 /** 88 Gets the activation degree of the term 89 @return the activation degree of the term 90 */ 91 virtual scalar getDegree() const; 92 93 /** 94 Sets the implication operator 95 @param implication is the implication operator 96 */ 97 virtual void setImplication(const TNorm* implication); 98 /** 99 Gets the implication operator 100 @return the implication operator 101 */ 102 virtual const TNorm* getImplication() const; 103 104 virtual Activated* clone() const FL_IOVERRIDE; 105 }; 106 } 107 #endif /* FL_ACTIVATED_H */ 108