AutoPas  3.0.0
Loading...
Searching...
No Matches
FuzzySetFactory.h
Go to the documentation of this file.
1
7#pragma once
8
9#include <functional>
10#include <set>
11
12#include "FuzzySet.h"
13
14namespace autopas::FuzzyLogic {
15
20 public:
24 FuzzySetFactory() = delete;
25
33 static std::shared_ptr<FuzzySet> makeFuzzySet(const std::string &linguisticTerm, const std::string &functionName,
34 const std::vector<double> &params);
35
36 private:
43 static std::function<double(double)> triangleFunction(double min, double peak, double max);
44
54 static std::function<double(double)> trapezoidFunction(double min, double leftPeak, double rightPeak, double max);
55
61 static std::function<double(double)> gaussianFunction(double mean, double sigma);
62
73 static std::function<double(double)> sigmoidFunction(double center, double slope);
74
86 static std::function<double(double)> sigmoidFiniteFunction(double lower, double center, double upper);
87
95 static void throwInvalidNumberOfArguments(const std::string &linguisticTerm, const std::string &functionName,
96 size_t expected, size_t actual);
97};
98
102class MembershipFunctionOption : public Option<MembershipFunctionOption> {
103 public:
107 enum Value {
128 };
129
134
139 constexpr MembershipFunctionOption(Value option) : _value(option) {}
140
145 constexpr operator Value() const { return _value; }
146
151 static std::map<MembershipFunctionOption, std::string> getOptionNames() {
152 return {
156 };
157 };
158
159 private:
160 Value _value{Value(-1)};
161};
162
163} // namespace autopas::FuzzyLogic
A factory class that creates FuzzySets based on the given activation function.
Definition: FuzzySetFactory.h:19
FuzzySetFactory()=delete
Deleted constructor to prevent instantiation of this class.
static std::shared_ptr< FuzzySet > makeFuzzySet(const std::string &linguisticTerm, const std::string &functionName, const std::vector< double > &params)
Constructs a FuzzySet with the given linguistic term, based on the given activation function.
Definition: FuzzySetFactory.cpp:16
Class representing the choices for the membership functions.
Definition: FuzzySetFactory.h:102
constexpr MembershipFunctionOption(Value option)
Constructor from value.
Definition: FuzzySetFactory.h:139
Value
Enum for the different defuzzification methods.
Definition: FuzzySetFactory.h:107
@ Gaussian
Gaussian function.
Definition: FuzzySetFactory.h:119
@ Sigmoid
Sigmoid function.
Definition: FuzzySetFactory.h:123
@ SigmoidFinite
SigmoidFinite function.
Definition: FuzzySetFactory.h:127
@ Trapezoid
Trapezoid function.
Definition: FuzzySetFactory.h:115
@ Triangle
Triangle function.
Definition: FuzzySetFactory.h:111
static std::map< MembershipFunctionOption, std::string > getOptionNames()
Provides a way to iterate over the possible choices of DefuzzificationMethod.
Definition: FuzzySetFactory.h:151
Namespace that contains the fuzzy logic framework used by the FuzzyTuning-strategy.
Definition: namespaces.h:112