56 constexpr operator Value()
const {
return _value; }
81 using Data = std::map<std::string, double>;
112 const std::shared_ptr<CrispSet> &crispSet);
138 explicit operator std::string()
const;
150 [[nodiscard]]
const std::shared_ptr<CrispSet> &
getCrispSet()
const;
156 void setCrispSet(
const std::shared_ptr<CrispSet> &crispSet);
161 friend std::shared_ptr<FuzzySet>
operator||(
const std::shared_ptr<FuzzySet> &lhs,
162 const std::shared_ptr<FuzzySet> &rhs);
167 friend std::shared_ptr<FuzzySet>
operator&&(
const std::shared_ptr<FuzzySet> &lhs,
168 const std::shared_ptr<FuzzySet> &rhs);
173 friend std::shared_ptr<FuzzySet>
operator!(
const std::shared_ptr<FuzzySet> &fuzzySet);
179 std::string _linguisticTerm;
184 std::variant<BaseMembershipFunction, ComposedMembershipFunction> _membershipFunction;
189 std::shared_ptr<CrispSet> _crispSet;
196 [[nodiscard]]
double centerOfGravity(
size_t numSamples)
const;
205 [[nodiscard]]
double meanOfMaximum(
size_t numSamples)
const;
214std::shared_ptr<FuzzySet>
operator||(
const std::shared_ptr<FuzzySet> &lhs,
const std::shared_ptr<FuzzySet> &rhs);
222std::shared_ptr<FuzzySet>
operator&&(
const std::shared_ptr<FuzzySet> &lhs,
const std::shared_ptr<FuzzySet> &rhs);
229std::shared_ptr<FuzzySet>
operator!(
const std::shared_ptr<FuzzySet> &fuzzySet);
Used to represent the different defuzzification methods.
Definition: FuzzySet.h:25
static std::map< DefuzzificationMethodOption, std::string > getOptionNames()
Provides a way to iterate over the possible choices of DefuzzificationMethod.
Definition: FuzzySet.h:62
Value
Enum for the different defuzzification methods.
Definition: FuzzySet.h:30
@ MoM
Mean of Maximum.
Definition: FuzzySet.h:38
@ CoG
Center of Gravity.
Definition: FuzzySet.h:34
DefuzzificationMethodOption()=default
Constructor.
constexpr DefuzzificationMethodOption(Value option)
Constructor from value.
Definition: FuzzySet.h:50
Used to represent a mathematical Fuzzy-Set.
Definition: FuzzySet.h:76
std::tuple< std::string, std::vector< double >, std::function< double(double)> > BaseMembershipFunction
A base membership function calculates the membership value based on a direct function evaluation.
Definition: FuzzySet.h:96
void setCrispSet(const std::shared_ptr< CrispSet > &crispSet)
Sets the crisp set of the FuzzySet.
Definition: FuzzySet.cpp:146
const std::string & getLinguisticTerm() const
Returns the linguistic term of the FuzzySet.
Definition: FuzzySet.cpp:142
friend std::shared_ptr< FuzzySet > operator&&(const std::shared_ptr< FuzzySet > &lhs, const std::shared_ptr< FuzzySet > &rhs)
Make the Intersection Operator a friend of the class.
Definition: FuzzySet.cpp:157
std::string printBaseMembershipFunction() const
Returns a string representation of the BaseMembershipFunction.
Definition: FuzzySet.cpp:121
friend std::shared_ptr< FuzzySet > operator!(const std::shared_ptr< FuzzySet > &fuzzySet)
Make the Complement Operator a friend of the class.
Definition: FuzzySet.cpp:166
friend std::shared_ptr< FuzzySet > operator||(const std::shared_ptr< FuzzySet > &lhs, const std::shared_ptr< FuzzySet > &rhs)
Make the Union Operator a friend of the class.
Definition: FuzzySet.cpp:148
const std::shared_ptr< CrispSet > & getCrispSet() const
Returns the crisp set of the FuzzySet.
Definition: FuzzySet.cpp:144
double evaluate_membership(const Data &data) const
Evaluates the membership function of this FuzzySet at the given value.
Definition: FuzzySet.cpp:27
std::map< std::string, double > Data
A map of the form {dimension_name: value}.
Definition: FuzzySet.h:81
std::function< double(const Data &)> ComposedMembershipFunction
A composed membership function is a membership function that relies on different FuzzySets to calcula...
Definition: FuzzySet.h:89
double defuzzify(DefuzzificationMethodOption method, size_t numSamples) const
Defuzzifies the FuzzySet using the given data and method.
Definition: FuzzySet.cpp:51
Namespace that contains the fuzzy logic framework used by the FuzzyTuning-strategy.
Definition: namespaces.h:112
std::shared_ptr< FuzzySet > operator!(const std::shared_ptr< FuzzySet > &fuzzySet)
Returns the complement of a FuzzySet.
Definition: FuzzySet.cpp:166
std::shared_ptr< FuzzySet > operator&&(const std::shared_ptr< FuzzySet > &lhs, const std::shared_ptr< FuzzySet > &rhs)
Returns the intersection of two FuzzySets.
Definition: FuzzySet.cpp:157
std::shared_ptr< FuzzySet > operator||(const std::shared_ptr< FuzzySet > &lhs, const std::shared_ptr< FuzzySet > &rhs)
Returns the union of two FuzzySets.
Definition: FuzzySet.cpp:148