forked from alvesoaj/eFLL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Fuzzy.h
executable file
·76 lines (67 loc) · 1.77 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
/*
* Robotic Research Group (RRG)
* State University of Piauí (UESPI), Brazil - Piauí - Teresina
*
* Fuzzy.h
*
* Author: AJ Alves <aj.alves@zerokol.com>
* Co authors: Dr. Ricardo Lira <ricardor_usp@yahoo.com.br>
* Msc. Marvin Lemos <marvinlemos@gmail.com>
* Douglas S. Kridi <douglaskridi@gmail.com>
* Kannya Leal <kannyal@hotmail.com>
*/
#ifndef FUZZY_H
#define FUZZY_H
// IMPORTING NECESSARY LIBRARIES
#include <inttypes.h>
#include "FuzzyInput.h"
#include "FuzzyOutput.h"
#include "FuzzyRule.h"
// Array struct for FuzzyInput objects
struct fuzzyInputArray
{
FuzzyInput *fuzzyInput;
fuzzyInputArray *next;
};
// Array struct for FuzzyOutput objects
struct fuzzyOutputArray
{
FuzzyOutput *fuzzyOutput;
fuzzyOutputArray *next;
};
// Array struct for FuzzyRule objects
struct fuzzyRuleArray
{
FuzzyRule *fuzzyRule;
fuzzyRuleArray *next;
};
// Main class of this library
class Fuzzy
{
public:
// CONTRUCTORS
Fuzzy();
// DESTRUCTOR
~Fuzzy();
// PUBLIC METHODS
bool addFuzzyInput(FuzzyInput *fuzzyInput);
bool addFuzzyOutput(FuzzyOutput *fuzzyOutput);
bool addFuzzyRule(FuzzyRule *fuzzyRule);
bool setInput(int fuzzyInputIndex, float crispValue);
bool fuzzify();
bool isFiredRule(int fuzzyRuleIndex);
float defuzzify(int fuzzyOutputIndex);
private:
// PRIVATE VARIABLES
// pointers to manage the array of FuzzyInput
fuzzyInputArray *fuzzyInputs;
// pointers to manage the array of FuzzyOutput
fuzzyOutputArray *fuzzyOutputs;
// pointers to manage the array of FuzzyRule
fuzzyRuleArray *fuzzyRules;
// PRIVATE METHODS
void cleanFuzzyInputs(fuzzyInputArray *aux);
void cleanFuzzyOutputs(fuzzyOutputArray *aux);
void cleanFuzzyRules(fuzzyRuleArray *aux);
};
#endif