forked from EngineeringLibrary/fuzzyLogic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fuzzy.h
95 lines (73 loc) · 3.9 KB
/
fuzzy.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#ifndef FUZZY_H
#define FUZZY_H
#include "SistemasdeControle/headers/modelLibs/model.h"
#include "triangular.h"
#include "SistemasdeControle/headers/primitiveLibs/LinAlg/matrix.h"
#include <vector>
#include <map>
namespace ModelHandler {
struct modelString
{
std::string str;
public:
modelString(){}
~modelString(){str.clear();}
modelString(std::string str) {this->str = str;}
std::string getString(){return this->str;}
void setString(std::string str){this->str = str;}
};
template <typename Type>
class Fuzzy: public Model<Type>
{
// LinAlg::Matrix<modelString> InputNames;
// LinAlg::Matrix<advancedModelHandler::MembershipFunction<double>*> InputMF;
std::map< std::string, std::map< std::string, advancedModelHandler::MembershipFunction<double>* > > InputMF;
// LinAlg::Matrix<modelString> OutputNames;
// LinAlg::Matrix<advancedModelHandler::MembershipFunction<double>*> OutputMF;
std::map< std::string, std::map< std::string, advancedModelHandler::MembershipFunction<double>* > > OutputMF;
LinAlg::Matrix<modelString> rules;
LinAlg::Matrix<Type> fuzzyficatedValue;
public:
void addInputMF(std::string InputName,
std::string MFName,
advancedModelHandler::MembershipFunction<Type>* MF);
std::map<std::string, advancedModelHandler::MembershipFunction<Type>*> getInputMF(std::string InputName);
void addOutputMF(std::string OutputName,
std::string MFName,
advancedModelHandler::MembershipFunction<Type>* MF);
void removeInputMF(unsigned nInput,
std::string MFName,
const advancedModelHandler::MembershipFunction<Type>* MF);
void removeOutputMF(unsigned nOutput,
std::string MFName,
const advancedModelHandler::MembershipFunction<Type>* MF);
void addRules(std::string rule);
std::string viewRules();
void removeRules();
LinAlg::Matrix<Type> membershipFunctionPosition (std::map<std::string, std::map<std::string, advancedModelHandler::MembershipFunction<double> *> > &MF, const std::string &firstKey, const std::string &secondKey);
LinAlg::Matrix<Type> membershipFunctionQuantities(std::map<std::string, std::map<std::string, advancedModelHandler::MembershipFunction<double> *> > &MF);
unsigned getMaxNumberOfMembershipFunctions(std::map<std::__cxx11::string, std::map<std::__cxx11::string, advancedModelHandler::MembershipFunction<double> *> > &Input);
LinAlg::Matrix<Type> fuzzyfication( LinAlg::Matrix<Type> Input);
LinAlg::Matrix<Type> rulesExecute(LinAlg::Matrix<Type> fuzzyficatedValue);
LinAlg::Matrix<Type> defuzzyfication(LinAlg::Matrix<Type> rulesMatrix);
Type maxV(Type a, Type b);
Type minV(Type a, Type b);
Type sim(Type x){}
Type sim(Type x, Type y){}
LinAlg::Matrix<Type> sim(LinAlg::Matrix<Type> x);
LinAlg::Matrix<Type> sim(Type lmin, Type lmax, Type step){}
LinAlg::Matrix<Type> sim(LinAlg::Matrix<Type> x, LinAlg::Matrix<Type> y){}
std::string print(){}
unsigned getNumberOfVariables() const{}
unsigned getNumberOfInputs() const{}
unsigned getNumberOfOutputs() const{}
void setLinearVector(LinAlg::Matrix<Type> Input, LinAlg::Matrix<Type> Output){}
void setLinearModel(LinAlg::Matrix<Type> Input, LinAlg::Matrix<Type> Output){}
Fuzzy(){}
private:
// getInputNames();
// getMFNames(std::string InputName)
};
}
#include "fuzzy.hpp"
#endif // FUZZY_H