This is the first part of a three tutorial series, based on fuzzy logic and fuzzy set theory (yes, they are real). Since many of you may not have heard of these, I'm going to spend part 1 explaining what these mathematical concepts are. My plan is to then implement each in C++ in parts 2 and 3.
What do I mean by "fuzzy"? Have you ever been given a question where you're pretty sure you know the answer, but not quite certain? This is a case where you are dealing with fuzziness. You may be 90% sure you have the right answer, or even 95% sure, but you aren't 100% sure. We deal with this type of uncertainty on a regular basis in life. Xav might tell you about his sexual exploits, and you decide there's a 5% chance he's telling the truth. I might talk about having a masters in math and you decide there's a 50% chance I'm telling the truth.
I can apply this to the concept of sets as well. In normal set theory, you have to precisely define the set so a potential element is either definitely in or definitely not in the set. This is great for math, but not so great when you want to talk about the "set of tall people". At 5'10", should I be included in the set? How about my 4'11" tall wife? What about Shaquille O'Neal? Since I don't know how tall is tall enough, I might have a 40% chance of being considered tall. My wife a 1% chance, and Shaq a 100% chance.
These two concepts are closely related. Rather than deal with TRUE or FALSE, we will deal with % likelihood of being true. Rather than deal with IN or OUT of a set, we will deal with % likelihood of being in. 100% means TRUE or definitely IN. 0% means FALSE or definitely OUT.
Logic has three primary operations: AND, OR, NOT. We need to define these in Fuzzy Logic. However we define them should cause them to be consistent with standard logic. Evaluating the standard and fuzzy interpretations for what we know gives us this:
TRUE AND TRUE = TRUE --> 100% AND 100% = 100%
TRUE AND FALSE = FALSE --> 100% AND 0% = 0%
FALSE AND TRUE = FALSE --> 0% AND 100% = 0%
FALSE AND FALSE = FALSE --> 0% AND 0% = 0%
TRUE OR TRUE = TRUE --> 100% OR 100% = 100%
TRUE OR FALSE = TRUE --> 100% OR 0% = 100%
FALSE OR TRUE = TRUE --> 0% OR 100% = 100%
FALSE OR FALSE = FALSE --> 0% OR 0% = 0%
NOT TRUE = FALSE --> NOT 100% = 0%
NOT FALSE = TRUE --> NOT 0% = 100%
Notice that AND gives the smaller percent, OR gives the higher percent, and NOT gives the "opposite" percent. We'll define AND to be the smaller, OR to be the larger, and NOT to be (100% - given).
Then we'll get:
75% AND 75% = 75%
75% AND 25% = 25%
25% AND 75% = 25%
25% AND 25% = 25%
75% OR 75% = 75%
75% OR 25% = 75%
25% OR 75% = 75%
25% OR 25% = 25%
NOT 75% = 25%
NOT 25% = 75%
For Fuzzy Set Theory, we need to define equivalents to UNION, INTERSECTION, and COMPLEMENT:
If the "universe" (all available elements) is {1,2,3,4,5}:
{1,2,3} INTERSECT {2,3,4} = {2,3}
{1,2,3} UNION {2,3,4} = {1,2,3,4}
COMPLEMENT {1,2,3} = {4,5}
Translating this to Fuzzy Sets gives us:
{1: 100%, 2: 100%, 3: 100%, 4: 0%, 5: 0%} INTERSECT {1: 0%, 2: 100%, 3: 100%, 4: 100%, 5: 0%} = {1: 0%, 2: 100%, 3: 100%, 4: 0%, 5: 0%}
{1: 100%, 2: 100%, 3: 100%, 4: 0%, 5: 0%} UNION {1: 0%, 2: 100%, 3: 100%, 4: 100%, 5: 0%} = {1: 100%, 2: 100%, 3: 100%, 4: 100%, 5: 0%}
COMPLEMENT {1: 100%, 2: 100%, 3: 100%, 4: 0%, 5: 0%} = {1: 0%, 2: 0%, 3: 0%, 4: 100%, 5: 100%}
Notice again that INTERSECT gets the low percentage for each element, UNION gets the high percentage for each element, and COMPLEMENT gets the "opposite" percentage for each element. So some fuzzy sets would give:
{1: 100%, 2: 75%, 3: 60%, 4: 20%, 5: 0%} INTERSECT {1: 0%, 2: 80%, 3: 65%, 4: 60%, 5: 30%} = {1: 0%, 2: 75%,3: 60%, 4: 20%, 5: 0%}
{1: 100%, 2: 75%, 3: 60%, 4: 20%, 5: 0%} UNION {1: 0%, 2: 80%, 3: 65%, 4: 60%, 5: 30%} = {1: 100%, 2: 80%,3: 65%, 4: 60%, 5: 30%}
COMPLEMENT {1: 100%, 2: 75%, 3: 60%, 4: 20%, 5: 0%} = {1: 0%, 2: 25%,3: 40%, 4: 80%, 5: 100%}
The goal, then, is to take these two concepts, and create classes equivalent to the set and boolean template/type. We won't try to perfectly recreate the mathematical objects, but we would like to extend the C++ functionality that already exists.
12 replies to this topic
#1
Posted 03 November 2008 - 08:04 PM
|
|
|
#2
Guest_Jordan_*
Posted 04 November 2008 - 05:45 AM
Guest_Jordan_*
Excellent read. I'm 90% sure I understand what you are talking about. :) +rep
#3
Posted 04 November 2008 - 08:16 AM
The key is, if this doesn't make any sense, the tutorials to follow will really not make sense.
#4
Guest_Jordan_*
Posted 14 November 2008 - 06:40 PM
Guest_Jordan_*
My response was fuzzy. :)
Thanks for the excellent read. I intend on reading part 2 fully in just a few minutes (if I can find it on my mobile).
Posted via CodeCall Mobile
Thanks for the excellent read. I intend on reading part 2 fully in just a few minutes (if I can find it on my mobile).
Posted via CodeCall Mobile
#5
Posted 14 November 2008 - 07:31 PM
I would imagine that reading code on a mobile device is not the most pleasant of experiences.
Implementing a Fuzzy Boolean is part II.
Implementing a Fuzzy Boolean is part II.
Edited by WingedPanther, 14 November 2008 - 07:33 PM.
add followup link
#6
Posted 15 November 2008 - 02:38 PM
Interesting :) I've used something similar in a smaller scale +rep
Hey! Check out my new Toyota keyboaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
#7
Posted 15 November 2008 - 03:24 PM
Wow gr8
i read about fuzzy but ive never seen real implementation
thnx alot
Posted via CodeCall Mobile
i read about fuzzy but ive never seen real implementation
thnx alot
Posted via CodeCall Mobile
#9
Posted 18 November 2008 - 12:01 PM
LOL. It was worth the lost rep.
#11
Posted 18 November 2008 - 12:11 PM
Yup. You're the one who cares about +rep, not me. The fact that you would have +rep'd me is all I need :)
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account

Back to top










