forked from alvesoaj/eFLL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFuzzyRule.cpp
executable file
·41 lines (34 loc) · 1.06 KB
/
FuzzyRule.cpp
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
/*
* Robotic Research Group (RRG)
* State University of Piaui (UESPI), Brazil - Piauí - Teresina
*
* FuzzyOutput.cpp
*
* Author: Msc. Marvin Lemos <[email protected]>
* AJ Alves <[email protected]>
* Co authors: Douglas S. Kridi <[email protected]>
* Kannya Leal <[email protected]>
*/
#include "FuzzyRule.h"
FuzzyRule::FuzzyRule(){
}
FuzzyRule::FuzzyRule(int index, FuzzyRuleAntecedent* fuzzyRuleAntecedent, FuzzyRuleConsequent* fuzzyRuleConsequent){
this->index = index;
this->fuzzyRuleAntecedent = fuzzyRuleAntecedent;
this->fuzzyRuleConsequent = fuzzyRuleConsequent;
this->fired = false;
}
int FuzzyRule::getIndex(){
return this->index;
}
bool FuzzyRule::evaluateExpression(){
if (this->fuzzyRuleAntecedent != NULL){
float powerOfAntecedent = this->fuzzyRuleAntecedent->evaluate();
(powerOfAntecedent > 0.0) ? (this->fired = true) : (this->fired = false);
this->fuzzyRuleConsequent->evaluate(powerOfAntecedent);
}
return this->fired;
}
bool FuzzyRule::isFired(){
return this->fired;
}