AutoPas  3.0.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Friends | List of all members
autopas::FuzzyLogic::FuzzySet Class Reference

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< FuzzySetoperator|| (const std::shared_ptr< FuzzySet > &lhs, const std::shared_ptr< FuzzySet > &rhs)
 Make the Union Operator a friend of the class.
 
std::shared_ptr< FuzzySetoperator&& (const std::shared_ptr< FuzzySet > &lhs, const std::shared_ptr< FuzzySet > &rhs)
 Make the Intersection Operator a friend of the class.
 
std::shared_ptr< FuzzySetoperator! (const std::shared_ptr< FuzzySet > &fuzzySet)
 Make the Complement Operator a friend of the class.
 

Detailed Description

Used to represent a mathematical Fuzzy-Set.

Member Typedef Documentation

◆ BaseMembershipFunction

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.

◆ ComposedMembershipFunction

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}.

◆ Data

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.

Constructor & Destructor Documentation

◆ FuzzySet() [1/2]

autopas::FuzzyLogic::FuzzySet::FuzzySet ( std::string  linguisticTerm,
BaseMembershipFunction &&  baseMembershipFunction 
)

Constructs a FuzzySet with a given linguistic term and base membership function.

Parameters
linguisticTerm
baseMembershipFunction

◆ FuzzySet() [2/2]

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.

Parameters
linguisticTerm
membershipFunction
crispSet

Member Function Documentation

◆ defuzzify()

double autopas::FuzzyLogic::FuzzySet::defuzzify ( DefuzzificationMethodOption  method,
size_t  numSamples 
) const

Defuzzifies the FuzzySet using the given data and method.

Parameters
methodThe defuzzification method to use.
numSamplesThe number of samples to use for the numerical defuzzification.
Returns
The defuzzified value of this FuzzySet.

◆ evaluate_membership()

double autopas::FuzzyLogic::FuzzySet::evaluate_membership ( const Data data) const

Evaluates the membership function of this FuzzySet at the given value.

Parameters
dataA map of the form {dimension_name: value}.
Returns
The membership value of the given value in this FuzzySet.

◆ getCrispSet()

const std::shared_ptr< CrispSet > & autopas::FuzzyLogic::FuzzySet::getCrispSet ( ) const

Returns the crisp set of the FuzzySet.

Returns
The crisp set of the FuzzySet.

◆ getLinguisticTerm()

const std::string & autopas::FuzzyLogic::FuzzySet::getLinguisticTerm ( ) const

Returns the linguistic term of the FuzzySet.

Returns
The linguistic term of the FuzzySet.

◆ printBaseMembershipFunction()

std::string autopas::FuzzyLogic::FuzzySet::printBaseMembershipFunction ( ) const

Returns a string representation of the BaseMembershipFunction.

Returns
A string representation of the BaseMembershipFunction.

◆ setCrispSet()

void autopas::FuzzyLogic::FuzzySet::setCrispSet ( const std::shared_ptr< CrispSet > &  crispSet)

Sets the crisp set of the FuzzySet.

Parameters
crispSet

Friends And Related Symbol Documentation

◆ operator!

std::shared_ptr< FuzzySet > operator! ( const std::shared_ptr< FuzzySet > &  fuzzySet)
friend

Make the Complement Operator a friend of the class.

Parameters
fuzzySet
Returns
The complement of fuzzySet.

◆ operator&&

std::shared_ptr< FuzzySet > operator&& ( const std::shared_ptr< FuzzySet > &  lhs,
const std::shared_ptr< FuzzySet > &  rhs 
)
friend

Make the Intersection Operator a friend of the class.

Parameters
lhs
rhs
Returns
The intersection of lhs and rhs.

◆ operator||

std::shared_ptr< FuzzySet > operator|| ( const std::shared_ptr< FuzzySet > &  lhs,
const std::shared_ptr< FuzzySet > &  rhs 
)
friend

Make the Union Operator a friend of the class.

Parameters
lhs
rhs
Returns
The union of lhs and rhs.

The documentation for this class was generated from the following files: