Used to represent a mathematical Fuzzy-Set. More...
#include <FuzzySet.h>
Public Types | |
using | Data = std::map< std::string, double > |
A map of the form {dimension_name: value}. | |
using | ComposedMembershipFunction = std::function< double(const Data &)> |
A composed membership function is a membership function that relies on different FuzzySets to calculate the membership value. | |
using | BaseMembershipFunction = std::tuple< std::string, std::vector< double >, std::function< double(double)> > |
A base membership function calculates the membership value based on a direct function evaluation. | |
Public Member Functions | |
FuzzySet (std::string linguisticTerm, BaseMembershipFunction &&baseMembershipFunction) | |
Constructs a FuzzySet with a given linguistic term and base membership function. | |
FuzzySet (std::string linguisticTerm, ComposedMembershipFunction &&membershipFunction, const std::shared_ptr< CrispSet > &crispSet) | |
Constructs a FuzzySet with a given linguistic term, composed membership function and crisp set. | |
double | evaluate_membership (const Data &data) const |
Evaluates the membership function of this FuzzySet at the given value. | |
double | defuzzify (DefuzzificationMethodOption method, size_t numSamples) const |
Defuzzifies the FuzzySet using the given data and method. | |
std::string | printBaseMembershipFunction () const |
Returns a string representation of the BaseMembershipFunction. | |
operator std::string () const | |
Returns a string representation of the FuzzySet. | |
const std::string & | getLinguisticTerm () const |
Returns the linguistic term of the FuzzySet. | |
const std::shared_ptr< CrispSet > & | getCrispSet () const |
Returns the crisp set of the FuzzySet. | |
void | setCrispSet (const std::shared_ptr< CrispSet > &crispSet) |
Sets the crisp set of the FuzzySet. | |
Friends | |
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. | |
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. | |
std::shared_ptr< FuzzySet > | operator! (const std::shared_ptr< FuzzySet > &fuzzySet) |
Make the Complement Operator a friend of the class. | |
Used to represent a mathematical Fuzzy-Set.
using autopas::FuzzyLogic::FuzzySet::BaseMembershipFunction = std::tuple<std::string, std::vector<double>, std::function<double(double)> > |
A base membership function calculates the membership value based on a direct function evaluation.
Base membership function take a single value and returns the corresponding membership value. (m=f(x)) Additionally, the base membership function stores information about the membership function and its parameters.
using autopas::FuzzyLogic::FuzzySet::ComposedMembershipFunction = std::function<double(const Data &)> |
A composed membership function is a membership function that relies on different FuzzySets to calculate the membership value.
This is important as it allows for straightforward implementation of fuzzy logic operators. Composed membership represent higher dimensional membership functions (m=f(x1,x2,...,xn)). The necessary data is passed as a map of the form {dimension_name: value}.
using autopas::FuzzyLogic::FuzzySet::Data = std::map<std::string, double> |
A map of the form {dimension_name: value}.
Used to represent higher dimensional function inputs.
autopas::FuzzyLogic::FuzzySet::FuzzySet | ( | std::string | linguisticTerm, |
BaseMembershipFunction && | baseMembershipFunction | ||
) |
Constructs a FuzzySet with a given linguistic term and base membership function.
linguisticTerm | |
baseMembershipFunction |
autopas::FuzzyLogic::FuzzySet::FuzzySet | ( | std::string | linguisticTerm, |
ComposedMembershipFunction && | membershipFunction, | ||
const std::shared_ptr< CrispSet > & | crispSet | ||
) |
Constructs a FuzzySet with a given linguistic term, composed membership function and crisp set.
linguisticTerm | |
membershipFunction | |
crispSet |
double autopas::FuzzyLogic::FuzzySet::defuzzify | ( | DefuzzificationMethodOption | method, |
size_t | numSamples | ||
) | const |
double autopas::FuzzyLogic::FuzzySet::evaluate_membership | ( | const Data & | data | ) | const |
const std::shared_ptr< CrispSet > & autopas::FuzzyLogic::FuzzySet::getCrispSet | ( | ) | const |
const std::string & autopas::FuzzyLogic::FuzzySet::getLinguisticTerm | ( | ) | const |
std::string autopas::FuzzyLogic::FuzzySet::printBaseMembershipFunction | ( | ) | const |
Returns a string representation of the BaseMembershipFunction.
void autopas::FuzzyLogic::FuzzySet::setCrispSet | ( | const std::shared_ptr< CrispSet > & | crispSet | ) |
Sets the crisp set of the FuzzySet.
crispSet |
Make the Complement Operator a friend of the class.
fuzzySet |
|
friend |
Make the Intersection Operator a friend of the class.
lhs | |
rhs |
|
friend |
Make the Union Operator a friend of the class.
lhs | |
rhs |