Professional Documents
Culture Documents
Fuzzylite Slides 3.1
Fuzzylite Slides 3.1
fuzzylite
A Fuzzy Logic Control Library in C++
Juan Rada-Vilela
www.fuzzylite.com
Introduction
Introduction
Introduction
Introduction
Introduction
∗ http://goo.gl/oYWGkM
† http://goo.gl/VDgOk9
Limitations
• Matlab and Fuzzy Logic Toolbox: Costly license
• Octave and Fuzzy Logic Toolkit: Restrictive license
• jFuzzyLogic: Unfortunate design choices
• Others: do not even bother. . .
Objectives
Overall Goal
Introduction to Fuzzy Logic Controllers
Specific Objectives
• Design of Fuzzy Logic Controllers
• Operation of Fuzzy Logic Controllers
• Examples of Fuzzy Logic Controllers
• Description of fuzzylite
Design
Definition
Controller
Example
Problem
How much to tip at a restaurant?
Solution
Controller
Service if Service is poor then Tip is cheap Tip
if Service is good then Tip is average
if Service is great then Tip is generous
Linguistic Variables
great generous
good average
poor cheap
Linguistic Variables
Tip
Service
1.0
1.0
µ( y)
0.5
µ(x)
0.5
0.0
0.0
1.0
µ(x)
µ(y)
0.5
0.5
0.0
0.0
0 poor good great 10 0 cheap average generous 25
x y
Rules
if Service is poor then Tip is cheap
if Service is good then Tip is average
if Service is great then Tip is generous
25
cheap average generous
Tip
0
Operation
Inputs Fuzzification
Inference
Defuzzification Outputs
Inputs Fuzzification
Inference
Defuzzification Outputs
Fuzzification
Definition
Fuzzification: Converts crisp input values into a fuzzy set
Example
Service Fuzzification
1.0
S̃(x) = ∑ µi (x)/i
i∈S
0.0
Inputs Fuzzification
Inference
Defuzzification Outputs
Inference
Definition
Inference: activates the rules to generate fuzzy outputs
Accumulation of Fuzzy
Outputs Outputs
Inference
Activation of the Antecedents
Example
Activation
Activation degree
Inference
Activation of the Antecedents
Example
Activation
Inference
Modification of Consequents
Example
Modification
⊗ : Activation Operator
Inference
Modification of Consequents
Example
{(1.0 ⊗ cheap), (0.0 ⊗ average), (0.0 ⊗ generous)}
1.0
µ(y)
0.5
0.0
Inference
Modification of Consequents
Example
{(0.0 ⊗ cheap), (0.2 ⊗ average), (0.8 ⊗ generous)}
1.0
1.0
µ(y)
µ(y)
0.5
0.5
0.0
0.0
Inference
Accumulation of Consequents
Example
S̃(7.0) = 0.0/poor + 0.2/good + 0.8/great
Activation Modification
Accumulation
T̃7.0 = (0.0 ⊗ cheap) ⊕ (0.2 ⊗ average) ⊕ (0.8 ⊗ generous)
⊕ : Accumulation Operator
Inference
Modification of Consequents
Example
{(0.0 ⊗ cheap), (0.2 ⊗ average), (0.8 ⊗ generous)}
1.0
1.0
µ(y)
µ(y)
0.5
0.5
0.0
0.0
Inference
Accumulation of Consequents
Example
T̃7.0 = (0.0 ⊗ cheap) ⊕ (0.2 ⊗ average) ⊕ (0.8 ⊗ generous)
1.0
1.0
µ(y)
µ(y)
0.5
0.5
0.0
0.0
0 cheap average generous 25 0 cheap average generous 25
y y
Inputs Fuzzification
Inference
Defuzzification Outputs
Defuzzification
Definition
Defuzzification: converts the fuzzy outputs into crisp values
Example
Centroid Maxima
1.0
1.0
●●●
µ( y)
µ(y)
0.5
0.5
●
0.0
0.0
Inputs Fuzzification
Inference
Defuzzification Outputs
fuzzylite
Features
Main Features
• Mamdani, Takagi-Sugeno and Tsukamoto FLCs
• 17+ linguistic terms
• 13 fuzzy logic operators
• Seven defuzzifiers
• Six types of hedges (e.g. very, somewhat, not)
• Import and export using FCL, FIS, C++
• Extend and incorporate new components
Linguistic Terms
Abstract Model
InputVariable
input : scalar
terms : vector<Term∗ >
Engine RuleBlock
inputs : vector<InputVariable∗ > rules : vector<Rule∗ >
outputs : vector<OutputVariable∗ > tnorm : TNorm∗
ruleBlocks : vector<RuleBlock∗ > snorm : SNorm∗
hedges : vector<Hedge∗ > activation : TNorm∗
process() : void fireRules() : void
OutputVariable
terms : vector<Term∗ >
output : Accumulated∗
defuzzifier : Defuzzifier∗
defuzzify() : scalar
Conclusions
• Easy to operate
Conclusions
vs.
Ramp term
0
Future Work
Donations
fuzzylite
A Fuzzy Logic Control Library in C++
Juan Rada-Vilela
www.fuzzylite.com