Professional Documents
Culture Documents
Fuzzysystem
Fuzzysystem
Fuzzysystem
org/twntduff/realtime-fuzzysystem/src
Overview
Fuzzy Logic is an AI logic system that handles approximate reasoning rather
than traditional binary sets (true or false). Fuzzy logic variables may have a truth
variable that varies in degree from 0 to 1. 1 being completely true and 0 being
completely false leaving a gray area where the variable can be defined as both true
and false to a certain degree. Fuzzy logic systems can be thought of as more
similar to how a human brain operates by forming a number of partial truths which
we assign to higher truths which the brain weighs and makes certain decisions.
Fuzzy Breakdown
Fuzzy Variable:
Fuzzy variables are composed of fuzzy values which define the different
levels of that variable.
Fuzzy variables can be composed of any number of values.
Fuzzy Value:
Fuzzy values are composed of lines which points define the numerical
values (X) for the given fuzzy value.
There are multiple types of value shapes that can compose a fuzzy value.
Fuzzy Math
Calculating Degree of Membership (DoM)
Y = M (X - X1) + Y1
Example:
X = 18
M = -1 / 13 ---> -.077
X = -.077 (18 - 10) + 1
X = -1.386 + .077 + 1
X = 0.384
udes
M = -1 / 25 ---> -.04
X = (0.5 - 1) / (-.04) + 25
X = 37.5
Fuzzy Operators
NOT X
Example: 0.7 close ---> (1 - 0.7) = 0.3 NOT close
X OR Y
Example: 0.7 close, 0.3 ammoLow ---> max(0.7, 0.3) = 0.7 close OR
ammoLow
X AND Y
Example: 0.7 close, 0.3 ammoLow ---> min(0.7, 0.3) = 0.3 close AND
ammoLow
Alternative Interpretations
Other definitions of the operator AND use different t-norms.
Examples:
Product
X AND Y
Example: 0.7 close, 0.3 ammoLow ---> mult(0.7, 0.3) = 0.21 close AND
ammoLow
Lukasiewicz
X AND Y
Example: 0.7 close, 0.3 ammoLow ---> max(0.7 + 0.3 - 1, 0.0) = 0.0 close
AND ammoLow
Other definitions of the operator OR use different t-conorms.
Examples:
Product
X OR Y
Example: 0.7 close, 0.3 ammoLow ---> 0.7 + 0.3 - 0.7 * 0.3 = 0.79 close OR
ammoLow
Lukasiewicz
X OR Y
Example: 0.7 close, 0.3 ammoLow ---> min(0.7 + 0.3, 1.0) = 1.0 close OR
ammoLow
Defuzzification
Center of Gravity (CoG) / Centroid
This is the most commonly used defuzzification technique in engineering
because of its accuracy but isn't as commonly used in games because of its heavy
computation for complex membership functions.
Z = (A+B) / 2