Classical and Fuzzy Logic Be Autonomous Latest
-
Upload
natarajan-subramanyam -
Category
Documents
-
view
34 -
download
2
description
Transcript of Classical and Fuzzy Logic Be Autonomous Latest
1
CLASSICAL LOGIC AND FUZZY LOGIC
Dr S.Natarajan Professor Department of Information Science and Engineering PESIT, Bangalore
CLASSICAL LOGIC AND FUZZY LOGIC
Part I Logic
Classical Predicate Logic – tautologies, Contradictions, Equivalence, Exclusive Or Exclusive Nor, Logical Proofs, Deductive InferencesFuzzy Logic, Approximate Reasoning, Fuzzy Tautologies, Contradictions, Equivalence and Logical Proofs, Other forms of the Implication Operation
Part II Fuzzy Systems
Natural language processing, Lingustic Hedges, Rule Based Systems, Multiple conjunctve antecedents , Aggregation of Fuzzy Rules, Graphical techniques of inference
2
3
Classical Logic
What is
LOGIC- Small part of Human body to reason
LOGIC- means to compel us to infer correct answers
What is
NOT LOGIC- Not responsible for our creativity or ability to
remember
LOGIC helps in organizing words to form words- not
context dependent
4
Fuzzy Logic
FUZZY LOGIC is a method to formalize humancapacity to Imprecise learning called ApproximateReasoning
Such reasoning represents human ability to reason approximately and judge under uncertainty
In Fuzzy Logic --- all truths are partial or approximate Here, the reasoning has been termed as Interpolative reasoning
September 5, 2006 Applied Discrete MathematicsWeek 1: Logic and Sets
5
Negation (NOT)Negation (NOT)
Unary Operator, Symbol: Unary Operator, Symbol:
PP PP
truetrue falsefalse
falsefalse truetrue
September 5, 2006 Applied Discrete MathematicsWeek 1: Logic and Sets
6
Conjunction (AND)Conjunction (AND)
Binary Operator, Symbol: Binary Operator, Symbol:
PP QQ PPQQ
truetrue truetrue truetrue
truetrue falsefalse falsefalse
falsefalse truetrue falsefalse
falsefalse falsefalse falsefalse
September 5, 2006 Applied Discrete MathematicsWeek 1: Logic and Sets
7
Disjunction (OR)Disjunction (OR)
Binary Operator, Symbol: Binary Operator, Symbol:
PP QQ PPQQ
truetrue truetrue truetrue
truetrue falsefalse truetrue
falsefalse truetrue truetrue
falsefalse falsefalse falsefalse
September 5, 2006 Applied Discrete MathematicsWeek 1: Logic and Sets
8
Exclusive Or (XOR)Exclusive Or (XOR)
Binary Operator, Symbol: Binary Operator, Symbol:
PP QQ PPQQ
truetrue truetrue falsefalse
truetrue falsefalse truetrue
falsefalse truetrue truetrue
falsefalse falsefalse falsefalse
September 5, 2006 Applied Discrete MathematicsWeek 1: Logic and Sets
9
Implication (if - then)Implication (if - then)
Binary Operator, Symbol: Binary Operator, Symbol:
PP QQ PPQQ
truetrue truetrue truetrue
truetrue falsefalse falsefalse
falsefalse truetrue truetrue
falsefalse falsefalse truetrue
September 5, 2006 Applied Discrete MathematicsWeek 1: Logic and Sets
10
Biconditional (if and only if)Biconditional (if and only if)
Binary Operator, Symbol: Binary Operator, Symbol:
PP QQ PPQQ
truetrue truetrue truetrue
truetrue falsefalse falsefalse
falsefalse truetrue falsefalse
falsefalse falsefalse truetrue
September 5, 2006 Applied Discrete MathematicsWeek 1: Logic and Sets
11
Statements and OperatorsStatements and OperatorsStatements and operators can be combined in any Statements and operators can be combined in any
way to form new statements.way to form new statements.
PP QQ PP QQ ((P)P)((Q)Q)
truetrue truetrue falsefalse falsefalse falsefalse
truetrue falsefalse falsefalse truetrue truetrue
falsefalse truetrue truetrue falsefalse truetrue
falsefalse falsefalse truetrue truetrue truetrue
September 5, 2006 Applied Discrete MathematicsWeek 1: Logic and Sets
12
Statements and OperationsStatements and OperationsStatements and operators can be combined in any way Statements and operators can be combined in any way
to form new statements.to form new statements.
PP QQ PPQQ (P(PQ)Q) ((P)P)((Q)Q)
truetrue truetrue truetrue falsefalse falsefalse
truetrue falsefalse falsefalse truetrue truetrue
falsefalse truetrue falsefalse truetrue truetrue
falsefalse falsefalse falsefalse truetrue truetrue
September 5, 2006 Applied Discrete MathematicsWeek 1: Logic and Sets
13
Equivalent StatementsEquivalent Statements
PP QQ (P(PQ)Q) ((P)P)((Q)Q) (P(PQ)Q)((P)P)((Q)Q)
truetrue truetrue falsefalse falsefalse truetrue
truetrue falsefalse truetrue truetrue truetrue
falsefalse truetrue truetrue truetrue truetrue
falsefalse falsefalse truetrue truetrue truetrue
The statements The statements (P(PQ) and (Q) and (P)P)((Q) are Q) are logically equivalentlogically equivalent, ,
because because (P(PQ)Q)((P)P)((Q) is always true.Q) is always true.
September 5, 2006 Applied Discrete MathematicsWeek 1: Logic and Sets
14
Conditional (Implication)Conditional (Implication)
This one is probably the least intuitive. It’s only This one is probably the least intuitive. It’s only partly akin to the English usage of “if,then” or partly akin to the English usage of “if,then” or “implies”.“implies”.
DEF: DEF: p p q q is true if is true if q q is true, or if is true, or if pp is false. In is false. In the final case (the final case (pp is true while is true while qq is false) is false) p p q q is false.is false.
Semantics: “Semantics: “pp implies implies q q ” is true if one can ” is true if one can mathematically derive mathematically derive q q from from pp..
15
Truth Tables
P Q P P Q P Q P Q PQ
False False True False False True True
False True True False True True False
True False False False True False False
True True False True True True True
September 5, 2006 Applied Discrete MathematicsWeek 1: Logic and Sets
16
Tautologies and ContradictionsTautologies and Contradictions
A tautology is a statement that is always true.A tautology is a statement that is always true.
Examples: Examples: RR((R)R)(P(PQ)Q)((P)P)((Q)Q)
If SIf ST is a tautology, we write ST is a tautology, we write ST.T.If SIf ST is a tautology, we write ST is a tautology, we write ST. This symbol T. This symbol
is also used for logical equivalence.is also used for logical equivalence.
September 5, 2006 Applied Discrete MathematicsWeek 1: Logic and Sets
17
Tautologies and ContradictionsTautologies and Contradictions
A contradiction is a statement that is alwaysA contradiction is a statement that is always
false.false.
Examples: Examples:
RR((R)R)
(((P(PQ)Q)((P)P)((Q))Q))
The negation of any tautology is a contra-The negation of any tautology is a contra-
diction, and the negation of any contradiction is diction, and the negation of any contradiction is
a tautology.a tautology.
18
TAUTOLOGIES
Tautologies – Compound Propositions which are ALWAYS TRUE , irrespective of TRUTH VALUES of INDIVIDUAL SIMPLE PROPOSITIONS
APPLICATIONS- DEDUCTIVE REASONING, THEOREM PROVING , DEDUCTIVE INFERENCING ETC.,Example: A is a set of prime numbers given by (A1 = 1 , A2 = 2, A3 = 3, A4 = 5, A5 = 7, A6 = 11 …) on
the real line universe X, then the proposition Ai is not divisible by 6 is A TAUTOLOGY
19
Proof by Contradiction
• A method for proving A method for proving p p qq..
• Assume Assume pp, and prove that , and prove that pp ( (qq qq))
• ((qq qq) is a trivial contradiction, equal to ) is a trivial contradiction, equal to FF
• Thus Thus ppFF, which is only true if , which is only true if pp==FF
20
Contradiction Proof Example
• Definition:Definition: The real number The real number rr is is rational rational if there if there exist integers exist integers p p and and q q ≠≠ 0, 0, with no common factors with no common factors other than 1 (i.e., gcd(other than 1 (i.e., gcd(pp,,qq)=1), such that )=1), such that r=p/q.r=p/q. A A real number that is not rational is called real number that is not rational is called irrational.irrational.
• Theorem:Theorem: Prove that is irrational. Prove that is irrational.2
Classical Logic
• disjunction ( )∨• conjunction ( )∧• negation (−)• implication (→)• equivalence (↔)
22
Classical Logic & Fuzzy Logic
Classical predicate logic
T: uU [0,1]
U: universe of all propositions.
All elements u U are true for proposition P are called the truth set of P: T(P).
Those elements u U are false for P are called falsity set of P: F(P).
T(Y) = 1 T(Ø) = 0
Logic
Example 5.1. Let P be the proposition “The structural beam is an 18WF45” and let Q bethe proposition “The structural beam is made of steel.” Let X be the universe of structuralmembers comprising girders, beams, and columns; x is an element (beam); A is the set of all wide-flange (WF) beams; andB is the set of all steel beams. Hence, P : x is in A Q : x is in B
24
Classical Logic &Fuzzy Logic
Given a proposition P: xA, P: xA, we have the following logical connectives:
Disjunction PQ: x A or x B hence, T(PQ) = max(T(P),T(Q))Conjunction PQ: xA and xB
hence T(P Q)= min(T(P),T(Q))Negation If T(P) =1, then T(P) = 0 then T(P) =1Implication (P Q): xA or xB Hence , T(P Q)= T(P Q)(P ←→ Q) : T (P ←→ Q) = 1, for T (P) = T (Q) = 0, for T (P) ≠ T (Q)
25
Classical Logic &Fuzzy Logic
Equivalence
1, for T(P) = T(Q)(P Q): T(PQ)=
0, for T(P) T(Q)
The logical connective implication, i.e.,P Q (P implies
Q) presented here is also known as the classical
implication.
P is referred to as hypothesis or antecedent
Q is referred to as conclusion or consequent.
26
Classical Logic &Fuzzy Logic
T(PQ)=(T(P)T(Q))Or PQ= (AB is true)T(PQ) = T(PQ is true) = max (T(P),T(Q))(AB)= (AB)= ABSo (AB)= ABOr AB false AB
Truth table for various compound propositions
P Q P PQ PQ PQ PQ
T(1) T(1) F(0) T(1) T(1) T(1) T(1)
T(1) F(0) F(0) T(1) F(0) F(0) F(0)
F(0) T(1) T(1) T(1) F(0) T(1) F(0)
F(0) F(0) T(1) F(0) F(0) T(1) T(1)
Classical LogicP : truth that x A∈Q : truth that x B where truth is measured in terms of the truth value, that ∈is,if x A, T (P)∈ = 1; otherwise, T (P) = 0if x B, T (Q) = 1; otherwise, T (Q) = 0∈or, using the characteristic function to represent truth (1) and falsity (0), the following notation results: χA(x) = 1 x A∈ = 0 x ∉ A
A notion of mutual exclusivity arises in this calculus. For the situation involving two propositions P and Q, where T (P) ∩ T (Q) = Ø, we have that the truth of P always implies the falsity of Q and vice versa; hence, P and Q are mutually exclusive propositions.
Logic(P ←→ Q) : T (P ←→ Q) = 1, for T (P) = T (Q) = 0, for T (P) ≠ T (Q)
LogicExample 5.2. (Similar to Gill, 1976). Consider the following four propositions:1. if 1 + 1 = 2, then 4 > 0; conclusion is T regardless of the Hypothesis2. if 1 + 1 = 3, then 4 > 0; conclusion is T regardless of the Hypothesis3. if 1 + 1 = 3, then 4 < 0; both propositions are false but this does not disprove the implication4. if 1 + 1 = 2, then 4 < 0. a true hypothesis cannot produce a false conclusionHence, the classical form of the implication is true for all propositions of P and Q except for those propositions that are in both the truth set of P and the false set of Q E EE E E E E E E E_͞E_͞_͞E_͞T (P → Q) = T (P) ∩ T (Q)
Logic __(P → Q) ≡ (A ∪ B is true) ≡ (either “not in A” or “in B”) _͞ _͞_͞_͞so that T (P → Q) = T (P Q) = max(T (P), T (Q))∨This expression is linguistically equivalent to the statement “P → Q is true” when either “not A” or “B” is true (logical or)Graphically, this implication and the analogous set operation are represented by the Venn diagram in Figure
Logic
Suppose the implication operation involves two different universes of discourse: P is a proposition described by set A, which is defined on universe X, and Q is a proposition described by set B, which is defined on universe Y. Then, the implication P → Q can be represented in set-theoretic terms by the relation R, where R is defined as
_͞R = (A × B) ∪ (A × Y) ≡ IF A, THEN B IF x A where ∈ x X and A X∈ ⊂THEN y B where ∈ y Y and B Y∈ ⊂The graphic in the figure below, represents the space of the Cartesian product X × Y showing typical sets A and B; superposed on this space is the set-theoretic equivalent ofthe implication. That is,
32
Classical Logic &Fuzzy Logic
PQ: If x A, Then y B, or PQ AB
The shaded regions of the compound Venn diagram in the following figure represent the truth domain of the implication, If A, then B(PQ).
B Y
X
A
33
34
Two ways to interpret “If x is A then y is B”:
A
B
A entails By
x
A coupled with B
A
B
x
y
Fuzzy if-then rules (3.3) (cont.)
35
Two ways to interpret “If x is A then y is B”:
A coupled with B
B
A
y
x
Fuzzy if-then rules (cont.)
36
Classical Logic &Fuzzy Logic
IF A, THEN B, or IF A , THEN CPREDICATE LOGIC (PQ)(PS)Where P: xA, AX
Q: yB, BYS: yC, CY
SET THEORETIC EQUIVALENT (A X B)(A X C) = R = relation ON X Y
Truth domain for the above compound proposition.
37
38
Classical Logic
Venn diagram for equivalence (darkened areas), that is, for T (A ↔ B).
Example:
Suppose we consider the universe of positive integers, X = {1 ≤ n ≤ 8}. Let P = “n is an even number” and let Q = “(3 ≤ n ≤ 7) ∧ (n = 6).” Then T (P) = {2, 4, 6, 8} and T (Q) = {3, 4, 5, 7}. The equivalence P ↔ Q has the truth set ___ ___T (P ←→ Q) = (T (P ) ∩ T (Q)) ∪ (T (P) ∩ T (Q)) = {4} ∪ {1} = {1, 4}
Classical LogicExample . Prove that P ↔ Q if P = “n is an integer power of 2 less than 7 and greater than zero” and Q = “n2− 6n + 8 = 0.” Since T (P) = {2, 4} and T (Q) = {2, 4}, it follows that P ↔ Q is an equivalence
Classical Logic
Exclusive OR grey areas
TautologiesModus ponens deduction, is a very common inference scheme used in forward- chaining rule-based expert systems It is an operation whose task is to find the truth value of a consequent in a production rule, given the truth value of the antecedent in the ruleModus ponens deduction concludes that given two propositions, P and P → Q, if both of which are true, then the truth of the simple proposition Q is automatically inferred.Modus tollens, an implication between two propositions is combined with a second proposition and both are used to imply a third proposition
Common Tautologies _ B ∪ B ←→ X. _ A ∪ X; A ∪ X ←→ X. (A ∧ (A → B)) → B (modus ponens) _ _ (B ∧ (A → B)) →A (modus tollens).
Classical Logic &Fuzzy Logic
Exclusive orExclusive NorExclusive or P “” Q(AB) (AB)Exclusive Nor(P “” Q)(PQ)Logical proofsLogic involves the use of inference in everyday life.
In natural language if we are given some hypothesis it is often useful to make certain conclusions from them the so called process of inference (P1P2….Pn) Q is true.
Classical Logic &Fuzzy Logic
Hypothesis : Engineers are mathematicians. Logical thinkers do not believe in magic. Mathematicians are logical thinkers.Conclusion : Engineers do not believe in magic.Let us decompose this information into individual propositionsP: a person is an engineerQ: a person is a mathematicianR: a person is a logical thinkerS: a person believes in magicThe statements can now be expressed as algebraic propositions as((PQ)(RS)(QR))(PS)It can be shown that the proposition is a tautology.ALTERNATIVE: proof by contradiction.
Classical Logic &Fuzzy Logic
Deductive inferences
The modus ponens deduction ( for p q if p holds the q is inferred) is used as a tool for making inferences in rule based systems. This rule can be translated into a relation between sets A and B.
R = (AB)(AY) Y is the universe
Now suppose a new antecedent say A’ is known, since A implies B is defined on the cartesian space X Y, B can be found through the following set theoretic formulation
__
B= AR= A((AB)(AY))
Denotes the composition operation. Modus ponens deduction can also be used for compound rule.
Classical Logic &Fuzzy Logic
Whether A is contained only in the complement of A or whether A’ and A overlap to some extent as described next:
IF AA, THEN y=B
IF AA THEN y =C
IF AA , AA, THEN y= BC
Fuzzy Logic
The restriction of classical propositional calculus to a two-valued logic has created many interesting paradoxes over the ages. For example, the barber of Seville is a classic paradox (also termed as Russell’s barber). In the small Spanish town of Seville, there is a rule that all and only those men who do not shave themselves are shaved by a barber. Who shaves the barber?
Another example comes from ancient Greece. Does the liar from Crete lie when he claims, “All Cretians are liars”? If he is telling the truth, then the statement is false. If the statement is false, he is not telling the truth.
Fuzzy Logic
Let S: the barber shaves himself
S’: he does not
S S’ and S’ S
T(S) = T(S’) = 1 – T(S)
T(S) = 1/2
But for binary logic T(S) = 1 or 0
Fuzzy propositions are assigned for fuzzy sets:
10
~
~~
A
A xPT
50
Classical Logic &Fuzzy Logic
Some common tautologies follow:
BB X AX; A X X
AB (A(AB))B (modeus ponens)(B(AB))A (modus tollens)Proof:(A(AB)) B(A(AB)) B Implication((AA) (AB))B Distributivity((AB))B Excluded middle laws(AB)B Identity(AB)B Implication(AB)B Demorgans lawA(BB) AssociativityAX Excluded middle lawsX T(X) =1 Identity; QED
51
Classical Logic & Fuzzy Logic
Proof(B(AB))A(B(AB))A((BA)(BB)) A((BA))A(BA)A
(BA)A
(BA)AB(AA)BX = X T(X) =1 A B AB (A(AB) (A(AB)B
O 0 1 0 1
O 1 1 0 1
1 0 0 0 1
1 1 1 1 1
Truth table (modus ponens)
52
53
Classical Logic &Fuzzy Logic
Exclusive orExclusive NorExclusive or P “” Q(AB) (AB)Exclusive Nor(P “” Q)(PQ)Logical proofsLogic involves the use of inference in everyday life.
In natural language if we are given some hypothesis it is often useful to make certain conclusions from them the so called process of inference (P1P2….Pn) Q is true.
54
Classical Logic &Fuzzy Logic
Hypothesis : Engineers are mathematicians. Logical thinkers do not believe in magic. Mathematicians are logical thinkers.Conclusion : Engineers do not believe in magic.Let us decompose this information into individual propositionsP: a person is an engineerQ: a person is a mathematicianR: a person is a logical thinkerS: a person believes in magicThe statements can now be expressed as algebraic propositions as((PQ)(RS)(QR))(PS)It can be shown that the proposition is a tautology.ALTERNATIVE: proof by contradiction.
55
Classical Logic &Fuzzy Logic
Deductive inferences
The modus ponens deduction is used as a tool for making inferences in rule based systems. This rule can be translated into a relation between sets A and B.
R = (AB)(AY)
Now suppose a new antecedent say A’ is known, since A implies B is defined on the cartesian space X Y, B can be found through the following set theoretic formulation B= AR= A((AB)(AY))
Denotes the composition operation. Modus ponens deduction can also be used for compound rule.
56
Classical Logic &Fuzzy Logic
Whether A is contained only in the complement of A or whether A’ and A overlap to some extent as described next:
IF AA, THEN y=B
IF AA THEN y =C
IF AA , AA, THEN y= BC
Fuzzy Logic
~~
1 PTPT
~~~~
~~~~
,max
:
QTPTQPT
BorAxQP
~~~~
~~~~
,min
:
QTPTQPT
BandAxQP
~~~~~~
~~
,max QTPTQPTQPT
QP
Negation
Disjunction
Conjunction
Implication [Zadeh, 1973]
Fuzzy Logic
When the logical conditional implication is of the compound form,
IF x is , THEN y is , ELSE y is
Then fuzzy relation is:
whose membership function can be expressed as:
~A
~B
~C
~~~~~CABAR
yxyxyx CABAR
~~~~~
1,max,
Fuzzy Logic
Rule-based format to represent fuzzy information.
Rule 1: IF x is , THEN y is , where and represent fuzzy propositions (sets)
Now suppose we introduce a new antecedent, say, and we consider the following rule
Rule 2: IF x is , THEN y is
~A
~B
~B
~A
'~A '
~B
RAB ''~~
Fuzzy Logic
Fuzzy Logic
Suppose we use A in fuzzy composition, can we get
The answer is: NO
Example:
For the problem in pg 127, let
A’ = AB’ = A’ R = A R = {0.4/1 + 0.4/2 + 1/3 + 0.8/4 + 0.4/5 + 0.4/6} ≠ B
RBB ~~
62
Classical Logic &Fuzzy Logic
Logic connectives
Disjunction Conjunction Negation –Implication Equivalence
If xA, T(P) =1 otherwise T(P) = 0OrxA(x)={ 1 if x A, otherwise it is 0 }
If T(p)T()=0 implies P true, false, or true P false. P and are mutually exclusive propositions.
63
General format:– If x is A then y is B (where A & B are linguistic
values defined by fuzzy sets on universes of discourse X & Y).
• “x is A” is called the antecedent or premise• “y is B” is called the consequence or
conclusion– Examples:
• If pressure is high, then volume is small.• If the road is slippery, then driving is dangerous.• If a tomato is red, then it is ripe.• If the speed is high, then apply the brake a little.
Fuzzy if-then rules
64
– Meaning of fuzzy if-then-rules (A B)
• It is a relation between two variables x & y; therefore it is a binary fuzzy relation R defined on X * Y
• There are two ways to interpret A B:–A coupled with B–A entails B
if A is coupled with B then:
Fuzzy if-then rules (cont.)
65
If A entails B then:
R = A B = A B ( material implication)
R = A B = A (A B) (propositional calculus)
R = A B = ( A B) B (extended propositional calculus)
Fuzzy if-then rules (3.3) (cont.)
66
67
Spring 2003 CMSC 203 - Discrete Structures 68
Rules of InferenceRules of Inference
Rules of inferenceRules of inference provide the justification of provide the justification of the steps used in a proof.the steps used in a proof.
One important rule is called One important rule is called modus ponensmodus ponens or the or the law of detachmentlaw of detachment. It is based on the . It is based on the tautology tautology (p (p (p (p q)) q)) q. We write it in the following q. We write it in the following way:way:
ppp p q q________ qq
The two The two hypotheseshypotheses p and p p and p q q are are written in a column, and the written in a column, and the conclusionconclusionbelow a bar, where below a bar, where means means “therefore”.“therefore”.
Spring 2003 CMSC 203 - Discrete Structures 69
Rules of InferenceRules of Inference
The general form of a rule of inference is:The general form of a rule of inference is:
pp11
pp22 .. .. .. ppnn________ qq
The rule states that if pThe rule states that if p11 andand p p22 andand … … andand p pnn are all true, then q is true as are all true, then q is true as well.well.
Each rule is an established tautology Each rule is an established tautology ofof pp11 p p22 … … p pnn q q
These rules of inference can be used These rules of inference can be used in any mathematical argument and do in any mathematical argument and do not not require any proof.require any proof.
70
CS 173 Proofs - Modus Ponens
I am Mila.If I am Mila, then I am a great swimmer.
I am a great swimmer!
p
p q
q
Tautology:
(p (p q)) q
Inference Rule:
Modus Ponens
71
CS 173 Proofs - Modus Tollens
I am not a great skater.If I am Erik, then I am a great skater.
I am not Erik!
q
p q
p
Tautology:
(q (p q)) p
Inference Rule:
Modus Tollens
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
Fuzzy Logic
The restriction of classical propositional calculus to a two-valued logic has created many interesting paradoxes over the ages. For example, the barber of Seville is a classic paradox (also termed as Russell’s barber). In the small Spanish town of Seville, there is a rule that all and only those men who do not shave themselves are shaved by a barber. Who shaves the barber?
Another example comes from ancient Greece. Does the liar from Crete lie when he claims, “All Cretians are liars”? If he is telling the truth, then the statement is false. If the statement is false, he is not telling the truth.
93
Fuzzy Logic
Let S: the barber shaves himself
S’: he does not
S S’ and S’ S
T(S) = T(S’) = 1 – T(S)
T(S) = 1/2
But for binary logic T(S) = 1 or 0
Fuzzy propositions are assigned for fuzzy sets:
10
~
~~
A
A xPT
94
Fuzzy Logic
~~
1 PTPT
~~~~
~~~~
,max
:
QTPTQPT
BorAxQP
~~~~
~~~~
,min
:
QTPTQPT
BandAxQP
~~~~~~
~~
,max QTPTQPTQPT
QP
Negation
Disjunction
Conjunction
Implication [Zadeh, 1973]
95
Fuzzy Logic
xyxyx
YABAR
ABAR~~~~
1,max,~~~~
Example:
= medium uniqueness =
= medium market size =
Then…
4
2.0
3
1
2
6.0
5
3.0
4
8.0
3
1
2
4.0
~A
~B
96
Fuzzy Logic
97
Fuzzy Logic
When the logical conditional implication is of the compound form,
IF x is , THEN y is , ELSE y is
Then fuzzy relation is:
whose membership function can be expressed as:
~A
~B
~C
~~~~~CABAR
yxyxyx CABAR
~~~~~
1,max,
98
Fuzzy Logic
Rule-based format to represent fuzzy information.
Rule 1: IF x is , THEN y is , where and represent fuzzy propositions (sets)
Now suppose we introduce a new antecedent, say, and we consider the following rule
Rule 2: IF x is , THEN y is
~A
~B
~B
~A
'~A '
~B
RAB ''~~
99
Fuzzy Logic
100
Fuzzy Logic
Suppose we use A in fuzzy composition, can we get
The answer is: NO
Example:
For the problem in pg 127, let
A’ = AB’ = A’ R = A R = {0.4/1 + 0.4/2 + 1/3 + 0.8/4 + 0.4/5 + 0.4/6} ≠ B
RBB ~~
101
Fuzzy Tautologies, Contradictions, Equivalence, and Logical Proofs
The following form of the implication operator show different techniques for obtaining the membership function values of fuzzy relation defined on the Cartesian product space X × Y:
~R
102
Fuzzy Tautologies, Contradictions, Equivalence, and Logical Proofs
The following common methods are among those proposed in the literature for the composition operation , where is the input, or antecedent defined on the universe X, is the output, or consequent defined on the universe Y, and is a fuzzy relation characterizing the relationship between specific inputs (x) and specific outputs (y):
Refer fig on next slide…
~~~RAB
~A
~B
~R
103
Fuzzy Tautologies, Contradictions, Equivalence, and Logical Proofs
The extension of truth operations for tautologies, contradictions, equivalence, and logical proofs is no different for fuzzy sets; the results, however, can differ considerably from those in classical logic. If the truth values for the simple propositions of a fuzzy logic compound proposition are strictly true (1) or false (0), the results follow identically those in classical logic. However, the use of partially true (or partially false) simple propositions in compound propositional statements results in new ideas termed quasi tautologies, quasi contradictions, and quasi equivalence. Moreover, the idea of a logical proof is altered because now a proof can be shown only to a “matter of degree”. Some examples of these will be useful.
104
Fuzzy Tautologies, Contradictions, Equivalence, and Logical Proofs
Truth table (approximate modus ponens)
A B AB (A(AB)) (A(AB))B
.3 .2 .7 .3 .7
.3 .8 .8 .3 .8 Quasi tautology
.7 .2 .3 .3 .7
.7 .8 .8 .7 .8
Truth table (approximate modus ponens)
A B AB (A(AB)) (A(AB))B
.4 .1 .6 .4 .6
.4 .9 .9 .4 .9 Quasi tautology
.6 .1 .4 .4 .6
.6 .9 .9 .6 .9
105
Fuzzy Tautologies, Contradictions, Equivalence, and Logical Proofs
The following form of the implication operator show different techniques for obtaining the membership function values of fuzzy relation defined on the Cartesian product space X × Y:
~R
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
CLASSICAL LOGIC AND FUZZY LOGIC
Part I Logic
Classical Predicate Logic – tautologies, Contradictions, Equivalence, Exclusive Or Exclusive Nor, Logical Proofs, Deductive InferencesFuzzy Logic, Approximate Reasoning, Fuzzy Tautologies, Contradictions, Equivalence and Logical Proofs, Other forms of the Implication Operation
Part II Fuzzy Systems
Natural language processing, Lingustic Hedges, Rule Based Systems, Multiple conjunctve antecedents , Aggregation of Fuzzy Rules, Graphical techniques of inference
132
133
NATURAL LANGUAGE
● Is perhaps the most powerful form of conveying information.
● Despite its vagueness and ambiguity it is the vehicle for human communication, and it seems appropriate that a mathematical theory that deals with fuzziness and ambiguity is also the same tool used to express and interpret the linguistic character of our language. Natural language is used in the expression of knowledge form known as RULE BASED SYSTEMS
NATURAL LANGUAGE● Cognitive scientists tell us that human base their
thinking primarily on conceptual patterns and mental images rather than on any numerical quantities.
● In fact the expert system paradigm known as “Frames” is based on the notion of a cognitive picture in one's mind.
● Furthermore, humans communicate with their own natural language by referring to previous mental images with rather vague but simple terms.
● Despite the vagueness and ambiguity in natural language, humans communicating in a common language have very little trouble in basic understanding.
● Since a vast amount of information involved in human communication involves natural language terms that, by their very nature, are often vague, imprecise, ambiguous, and fuzzy, we will propose the use of fuzzy sets as the mathematical foundation of our Natural Language (NL).
● NL consists of - atomic terms :The fundamental terms. Ex: slow, medium, young, beautiful etc. - composite : a collection of of atomic terms or set of terms. Ex: very slow horse, heavy-weight female, fairly beautiful painting, etc
137
Natural Language
The time interval x was the period exhibiting a 100 percent maximum ofpossible values as measured along some arbitrary social scale, [and]the interval x was the period of time exhibiting 100 percent minimum ofthese values as measured along the same scale.
Crisp version of this passage is identical to that posed by the law ofexcluded middle of probability theory.
The decomposition of compound rules into canonical (equivalent) forms and the treatment of rules forms as logical propositions. The
characterization of the confidence in a particular rule is addressed by using the truth qualifications. The expression of rules as a collection of logical implications manipulated by inference schemes
138
Knowledge & Mappings
• Knowledge is a collection of “facts” from some domain.
• What we need is a representation of facts that can be manipulated by a program.– Some symbolic representation is necessary.– Need to be able to map facts to symbols.– Need to be able to map symbols to facts?
139
A.I. Problems & K.R.
• Game playing - need rules of the game, strategy, heuristic function(s).
• Expert Systems - list of rules, methods to extract new rules.
• Learning - the space of all things learnable (domain representation), concept representation.
• Natural Language - symbols, groupings, semantic mappings, ...
140
Representation Properties
Representational Adequacy - Is it possible to represent everything of interest ?
Inferential Adequacy - Can new information be inferred?
Inferential Efficiency - How easy is it to infer new knowledge?
Acquisitional Efficiency - How hard is it to gather information (knowledge)?
141
Search and State Representation
• Each state could be represented as a collection of facts.
• Keeping many such states in memory may be impossible.
• Most facts will not change when we move from one state to another.
142
The Frame Problem
• Determining how to best represent facts that change from state to state along with those facts that do not change is the Frame Problem.
• Sometimes the hard part is determining which facts change and which do not.
143
Fuzzy Rule-based systems
Using fuzzy sets as a calculus to interpret natural language. It is vague, imprecise, ambiguous and fuzzy.
Fundamental terms atoms
Collection of atomic terms composite or set of terms
An atomic term (a linguistic variable) can be interpreted using fuzzy sets.
An atomic term in the universe of natural language, X.
Define a fuzzy set in the universe of interpretations or meanings, Y as a specific meaning of .
~A
Suppose we define a specific atomic term in the universe of NL, X, as element and we define fuzzy set A in the universe of interpretations , or meanings, Y, as a specific meaning for the term . then NL can be expressed as a mapping, M from a set of atomic terms in X to a corresponding set of interpretations defined on Y.
● Each atomic term in X corresponds to a fuzzy set A in Y, which is the “interpretation” of
145
Fuzzy Rule-based systems
~A
X Y ~~AM
Mapping of a linguistic atom to a cognitive interpretation ~A
251
2525
251
,
12
~
~~
y
yy
yyoug
yy
M
AM
146
Fuzzy Rule-based systems
Composite
yyNot
yyy
and
yyy
or
and
or
1:
,min
:
,max
:
LINGUISTIC HEDGES
● In linguistics, fundamental atomic terms are often modified with adjectives (nouns) or adverbs (verbs) . like very, low, slight, almost, more-or-less, etc
● Using fuzzy sets as the calculus of interpretation, these linguistic hedges have the effect of modifying the membership function for a basic atomic term
Define = a(y)/y, theny
● “very” = 2 =ʃ [μα(y)]2/y
● “Very, very” = 4
● “plus” =1.25
● “slightly” =sqrt () = ʃ [ μα(y))]0.5/y
● “minus” = 0.75
● The first three equations are called “concentrations”
● Another operation on linguistic fuzzy sets is known as intensification.
● Intensification can be expressed by numerous algorithms, one of which, proposed by Zadeh, is
● “intensify” a = = ● Combination of concentration and dilation
● Parentheses may be used to change the precedence order and ambiguities may be resolved by the use of association-to-the-right. For example, “plus very minus” as plus(very(minus))
22(y) for 0<= (y) <= 0.5
1-2[1-(y)]2 for 0.5 <= (y) <= 1
Concentration of A Dilation of A
0 x
1
0 x
1
Intensification of A
A
A
151
Concentration – reduces the degree of membership of the elements
which are “partly” in the set
Hedge “very” with membership of .9 reduced by 10 percent to a value
.81 – whereas, membership value of .1 is reduced by an order of
magnitude .01.
Decrease – Manifestation of the properties of the properties of the membership value itself for 0 ≤µ ≤ 1 then µ >= µ2
Dilation- Stretch or dilate fuzzy set by increasing the membership
of elements that are ‘partly’ in the set
For the hedge ‘slightly’ membership value .81 is increased by 11% to get 0.9 and the membership value of 0.01 is increased by an order of magnitude to 0.1
Precedence Operation
First Hedge, not
Second and
Third or
Precedence for linguistic hedges and logical operations
153
Linguistic Hedges
15.0121
5.002
2
2
75.0
5
21
21
25.1
4
2
2
yy
yy
Intensify
Minus
y
y
Slightly
plus
veryVery
y
y
Very
y
y
It increases contrast.
154
Precedence of the Operations
Example:
Suppose we have a universe of integers, Y = {1,2,3,4,5}. We define the following linguistic terms as a mapping onto Y:
“small” =
“large” =
5
1.
4
8.
3
6.
2
4.
1
2.
5
2.
4
4.
3
6.
2
8.
1
1
155
“very small” = “small”2 = {1/1 + 0.64/2 + 0.36/3 + 0.16/4 +0.04/5}“Not very small” = 1- “very small” = {0/1 + 0.36/2 + 0.64/3+ 0.84/4+ 0.96/5}Thus we construct a phrase, or a composite term:α = “not very small and not very very large” which involves the following set-theoretic operations:
156
Example (contd)
“Intensely small” =
5
08.0
4
32.0
3
68.0
2
92.0
1
1
5
2.02
4
4.02
3
6.0121
2
8.0121
1
1121
22
222
Rule-based systems
● In the field of AI there are various ways to represent knowledge.IF premise (antecedent), THEN conclusion
(consequent)● Commonly referred to as the IF-THEN rule-based
form● The rule-based system is distinguished from expert
systems in the sense that the rules comprising a rule-based system might derive from sources other that human experts and, in this context, are distinguished from expert systems.
158
Rule-based Systems
IF-THEN rule based form
Canonical Rule Forms
1. Assignment statementsx = large, x y
2. Conditional statementsIf A then B,If A then B, else C
3. Unconditional statementsstopgo to 5
unconditional can beIf any conditions, then stopIf condition Ci, then restrict Ri
Canonical Rule Forms
● Assignment statements x = largebanana’s color = yellow
x approx= s● Conditional statements
IF the tomato is red THEN the tomato is ripe IF x is very hot THEN stop● Unconditional statements
go to 9 stop divide by x
turn the pressure higher
● The rule base under consideration could be described using a collection of conditional restrictive statements. These statements may also be modeled as fuzzy conditional statements, such as
IF condition C1 THEN restriction R1.● The unconditional restrictions might be in the form R1: The output is B1
AND R2: The output is B2
AND etc. Where B1, B2, …. Are fuzzy consequents.
● The canonical form for a fuzzy rule-based system
Rule 1: IF cond C1, THEN restriction R1
Rule 2: IF cond C2, THEN restriction R2
.
.Rule n: IF cond Cn, THEN restriction Rn.
● Example if the temperature is hot, then the pressure is
rather high. if the temperature is cold, then the pressure is
very low.● The vague term “rather high” in the first statement
places a fuzzy restriction on the pressure , based on a fuzzy “hot” temperature condition in the antecedent.
163
Decomposition of Compound Rule
Any compound rule structure can be decomposed and reduced to a number of simple canonical rules.
The most commonly used techniques
Multiple Conjunctive Antecedents
If x is and , then y is
Define
~A LAA
~
2
~ SB
~LS AAAA
~
2
~
1
~~
xxx LS AAA
~
1
~~
,,min
The rule can be rewritten.
IF THENSA
~
SB~
Decomposition of Compound Rules
● A linguistic statement expressed by a human might involve compound rule structures
as an example, consider a rule-based for a simple home temperature control problem, which might contain the following rules.
IF it is raining hard THEN close the window.IF the room temp is very hot,THEN IF the heat is on THEN turn the heat lower AND IF it is not raining hard THEN open the window. etc..
165
Multiple Disjunctive Antecedents
If x is or or … or
then y is
1
~A 2
~A LA
~
SB~
xxx
AAAA
LS AAA
LS
,,max 1
~
2
~
1
~~
IF THENSA
~
SB~
● Multiple conjunctive antecedents IF x is A1 and A2 … and AL THEN y is Bs
As = A1 ∩ A2 ∩ … ∩ AL
As(x) = min [A1(x), … , Al(x)]
IF As THEN Bs
● Multiple disjunctive antecedentsIF x is A1 or A2 … or AL THEN y is Bs
As = A1 A2 … A L
As(x) = max [A1(x), … , Al(x)]
IF x is As THEN y is Bs
167
Condition Statements
1. IF THEN ( ELSE ) decomposed into:
IF THEN or IF NOT THEN
1
~A
~
1B2
~B
1
~A 1
~B 1
~A 2
~B
2. IF (THEN ) unless decomposed into:IF THEN or IF NOT THEN NOT
1
~A
~
1B 2
~A
1
~A 1
~B 2
~A 1
~B
3. IF THEN ( ELSE IF THEN ( )) decomposed into:
IF THEN or IF NOT and THEN NOT
1
~A
~
1B2
~A
1
~A 1
~B 1
~A 2
~B
~
2B2
~A
4. Nested IF-THEN rules IF THEN (IF , THEN ( )) becomes IF and THEN
Each canonical form is an implication, and we can reduce the rules to a series of relations.
1
~A 2
~A
1
~B
1
~A 2
~A 1
~B
168
Condition Statements
“likely” “very likely” “highly likely” “true” “fairly true” “very true” “false” “fairly false” “very false”
1
x
Xx
anything
Let be a fuzzy truth value “very true” “true” “fairly true” “fairly false” “false”
A truth qualification proposition can be expressed as:“x is is ”
orx is is =
~A
~A
5.0~
~
x
x
A
A
169
Aggregation of fuzzy rule
The process of obtaining the overall consequent (conclusion) from the individual consequent contributed by each rule in the rule-base is known as aggregation of rules.
Conjunctive System of Rules:
Yyyyy
yyyy
ryyy
r
,,min 1
21
Disjunctive System of Rules:
Yyyyy
yyyy
ryyy
r
,,max 1
21
170
171
“highly unlikely” = “minus very very unlikely” = “(very very unlikely)0.75” = 1/0 + 1/.1 + 1/.2 + .5/.3 + .3/.4}
Ex: if a fuzzy variable x has a membership value equal to .85 in the fuzzy set A i.e., (x)=.85 as shown in the figure then its membership values for the following truth qualification statements are determined from figure
: x is A is true : x is A is false: x is A isfairly true: x is A is very false
A(a)
1
.96
.85
.15
0 .85 1 a
A(x) = .85
A(x) = .15
A(x) = .96
A(x) = .04
Aggregation of Fuzzy Rules
● Conjunctive system of rules. y = y1 and y2 and … and yr
Or y = y1 ∩y2 ∩ … ∩ yr
Defined by y(y) = min (y1(y),…yr(y)) for y belongs to Y
● Disjunctive system of rules y = y1 or y2 or … or yr
Or y = y1 U y2 U … U yr
Defined by y(y) = max (y1(y), … y(r-1)(y), yr(y)) for y belongs to Y
175
176
177
178
179
180
181
182
183
184
185
186
Slide Slide 187187
Fuzzy Rule BaseFuzzy Rule Base Fuzzy rules can be formulated:Fuzzy rules can be formulated:
• from human expert’s knowledge or experiencefrom human expert’s knowledge or experience• by statistical analysis of numerical data by statistical analysis of numerical data
obtained from experimentationobtained from experimentation• through neuro-fuzzy optimisation (learning) through neuro-fuzzy optimisation (learning)
process – ANFIS (Adaptive Neuro-Fuzzy process – ANFIS (Adaptive Neuro-Fuzzy Inference System), FuNe (Neuro-Fuzzy learning Inference System), FuNe (Neuro-Fuzzy learning network with rule generation)network with rule generation)
188
Artificial Intelligence – CS364Artificial Intelligence – CS364Fuzzy LogicFuzzy Logic
13th October 2005 Bogdan L. Vrusias © 2005 189
Graphical Techniques of InferenceGraphical Techniques of Inference• The most commonly used fuzzy inference technique is the
so-called Mamdani method.
• In 1975, Professor Ebrahim Mamdani of London University built one of the first fuzzy systems to control a steam engine and boiler combination. He applied a set of fuzzy rules supplied by experienced human operators.
Slide Slide 190190
Fuzzy Inference Systems (FIS)Fuzzy Inference Systems (FIS) Inspiration: lexical imprecision in natural language Inspiration: lexical imprecision in natural language
reasoningreasoning
““price of crude oil which has price of crude oil which has edged higheredged higher in in recent recent weeksweeks after being after being remarkably stableremarkably stable through through much much of the yearof the year, may , may fluctuatefluctuate as much as a dollar a as much as a dollar a barrel in the barrel in the months aheadmonths ahead, but , but abrupt changesabrupt changes are are not likelynot likely, many analysts , many analysts believebelieve.”.”
Almost all our everyday reasoning is approximate Almost all our everyday reasoning is approximate in nature.in nature.
Slide Slide 191191
FIS: InspirationFIS: Inspiration Exploit the tolerance for imprecision.Exploit the tolerance for imprecision. High precision entails high cost.High precision entails high cost.
• park the carpark the car• park the car 10cm from the curbpark the car 10cm from the curb
High precision entails low tractabilityHigh precision entails low tractability• reduce the precision of information to make a reduce the precision of information to make a
complex problem more tractablecomplex problem more tractable
Slide Slide 192192
FIS: ApplicationsFIS: Applications Replacement of human operator by a FIS:Replacement of human operator by a FIS:
• Sendai subway (Hitachi), Elevator control (Hitachi, Sendai subway (Hitachi), Elevator control (Hitachi, Toshiba)Toshiba)
• Nuclear reactor control (Hitachi)Nuclear reactor control (Hitachi)• Automobile transmission (Nissan, Subaru, Honda)Automobile transmission (Nissan, Subaru, Honda)• Video image stabilisation (Canon, Minolta)Video image stabilisation (Canon, Minolta)
Replacement of human expert by a FIS:Replacement of human expert by a FIS:• medical diagnosis medical diagnosis • SecuritiesSecurities• Fault diagnosisFault diagnosis• Credit worthinessCredit worthiness
Slide Slide 193193
FISFIS
Defuzzifier
Slide Slide 194194
Fuzzy OperationsFuzzy Operations Union operation (OR)Union operation (OR)
Intersection operation (AND)Intersection operation (AND)
Complement operation (NOT)Complement operation (NOT)
BABA x ,max)(
A B
BABA x ,min)(
A B
A
AA x 1)(
A
Slide Slide 195195
Mamdani Fuzzy InferenceMamdani Fuzzy Inference Single rule with single antecedentSingle rule with single antecedent
Rule:Rule: if x is A then y is B if x is A then y is B
Fact:Fact: x is A’ x is A’
Inference:Inference: y is B’ y is B’ Graphical Representation:Graphical Representation:
A
X
A’ B
Y
x is A’
B’
Y
A’
Xy is B’
Slide Slide 196196
FIS: Mamdani ProcedureFIS: Mamdani Procedure iithth rule: rule: if xif x11 is A is A1i1i and … and x and … and xnn is A is Ani ni then y is Bthen y is Bii
1. Determine the degree of membership of each input to different fuzzy terms Aji:
2. Determine the strength of each rule antecedent
3. Determine the contribution of each rule
4. Rule aggregation
5. Defuzzification
j runs on each fuzzy term
i runs on each rule
Artificial Intelligence – CS364Artificial Intelligence – CS364Fuzzy LogicFuzzy Logic
13th October 2005 Bogdan L. Vrusias © 2005 197
Mamdani Fuzzy InferenceMamdani Fuzzy Inference• The Mamdani-style fuzzy inference process is performed
in four steps:
1. Fuzzification of the input variables
2. Rule evaluation (inference)
3. Aggregation of the rule outputs (composition)
4. Defuzzification.
Artificial Intelligence – CS364Artificial Intelligence – CS364Fuzzy LogicFuzzy Logic
13th October 2005 Bogdan L. Vrusias © 2005 198
Mamdani Fuzzy InferenceMamdani Fuzzy InferenceWe examine a simple two-input one-output problem that includes three rules:
Rule: 1 Rule: 1IF x is A3 IF project_funding is adequateOR y is B1 OR project_staffing is smallTHEN z is C1 THEN risk is low
Rule: 2 Rule: 2IF x is A2 IF project_funding is marginalAND y is B2 AND project_staffing is largeTHEN z is C2 THEN risk is normal
Rule: 3 Rule: 3IF x is A1 IF project_funding is inadequateTHEN z is C3 THEN risk is high
Artificial Intelligence – CS364Artificial Intelligence – CS364Fuzzy LogicFuzzy Logic
13th October 2005 Bogdan L. Vrusias © 2005
Step 1: FuzzificationStep 1: Fuzzification• The first step is to take the crisp inputs, x1 and y1 (project funding and
project staffing), and determine the degree to which these inputs belong to each of the appropriate fuzzy sets.
Crisp Inputy1
0.1
0.71
0y1
B1 B2
Y
Crisp Input
0.20.5
1
0
A1 A2 A3
x1
x1 X
(x = A1) = 0.5
(x = A2) = 0.2
(y = B1) = 0.1
(y = B2) = 0.7
Project Funding Project Staffing
Artificial Intelligence – CS364Artificial Intelligence – CS364Fuzzy LogicFuzzy Logic
13th October 2005 Bogdan L. Vrusias © 2005 200
Step 2: Rule EvaluationStep 2: Rule Evaluation• The second step is to take the fuzzified inputs,
(x=A1) = 0.5, (x=A2) = 0.2, (y=B1) = 0.1 and (y=B2) = 0.7,
and apply them to the antecedents of the fuzzy rules.
• If a given fuzzy rule has multiple antecedents, the fuzzy operator (AND or OR) is used to obtain a single number that represents the result of the antecedent evaluation.
• This number (the truth value) is then applied to the consequent membership function.
Artificial Intelligence – CS364Artificial Intelligence – CS364Fuzzy LogicFuzzy Logic
13th October 2005 Bogdan L. Vrusias © 2005 201
Step 2: Rule EvaluationStep 2: Rule Evaluation
RECALL:
To evaluate the disjunction of the rule antecedents, we use the OR fuzzy operation. Typically, fuzzy expert systems make use of the classical fuzzy operation union:
AB(x) = max [A(x), B(x)]
Similarly, in order to evaluate the conjunction of the rule antecedents, we apply the AND fuzzy operation intersection:
AB(x) = min [A(x), B(x)]
Artificial Intelligence – CS364Artificial Intelligence – CS364Fuzzy LogicFuzzy Logic
13th October 2005 Bogdan L. Vrusias © 2005 202
Step 2: Rule EvaluationStep 2: Rule Evaluation
A3
1
0 X
1
y10 Y
0.0
x1 0
0.1C1
1
C2
Z
1
0 X
0.2
0
0.2C1
1
C2
Z
A2
x1
Rule 3:
A11
0 X 0
1
Zx1
THEN
C1 C2
1
y1
B2
0 Y
0.7
B10.1
C3
C3
C30.5 0.5
OR(max)
AND(min)
OR THENRule 1:
AND THENRule 2:
IF x is A3 (0.0) y is B1 (0.1) z is C1 (0.1)
IF x is A2 (0.2) y is B2 (0.7) z is C2 (0.2)
IF x is A1 (0.5) z is C3 (0.5)
Artificial Intelligence – CS364Artificial Intelligence – CS364Fuzzy LogicFuzzy Logic
13th October 2005 Bogdan L. Vrusias © 2005 203
Step 2: Rule EvaluationStep 2: Rule Evaluation• Now the result of the antecedent evaluation can be applied
to the membership function of the consequent.
• There are two main methods for doing so:– Clipping
– Scaling
Artificial Intelligence – CS364Artificial Intelligence – CS364Fuzzy LogicFuzzy Logic
13th October 2005 Bogdan L. Vrusias © 2005 204
Step 2: Rule EvaluationStep 2: Rule Evaluation• The most common method of correlating the rule
consequent with the truth value of the rule antecedent is to cut the consequent membership function at the level of the antecedent truth. This method is called clipping (lambda-cut).
• Since the top of the membership function is sliced, the clipped fuzzy set loses some information.
• However, clipping is still often preferred because it involves less complex and faster mathematics, and generates an aggregated output surface that is easier to defuzzify.
Artificial Intelligence – CS364Artificial Intelligence – CS364Fuzzy LogicFuzzy Logic
13th October 2005 Bogdan L. Vrusias © 2005 205
Step 2: Rule EvaluationStep 2: Rule Evaluation• While clipping is a frequently used method, scaling offers
a better approach for preserving the original shape of the fuzzy set.
• The original membership function of the rule consequent is adjusted by multiplying all its membership degrees by the truth value of the rule antecedent.
• This method, which generally loses less information, can be very useful in fuzzy expert systems.
Artificial Intelligence – CS364Artificial Intelligence – CS364Fuzzy LogicFuzzy Logic
13th October 2005 Bogdan L. Vrusias © 2005 206
Step 2: Rule EvaluationStep 2: Rule Evaluation
Degree ofMembership1.0
0.0
0.2
Z
Degree ofMembership
Z
C2
1.0
0.0
0.2
C2
clipping scaling
Artificial Intelligence – CS364Artificial Intelligence – CS364Fuzzy LogicFuzzy Logic
13th October 2005 Bogdan L. Vrusias © 2005 207
Step 3: Aggregation of the rule outputsStep 3: Aggregation of the rule outputs• Aggregation is the process of unification of the outputs of
all rules.
• We take the membership functions of all rule consequents previously clipped or scaled and combine them into a single fuzzy set.
• The input of the aggregation process is the list of clipped or scaled consequent membership functions, and the output is one fuzzy set for each output variable.
Artificial Intelligence – CS364Artificial Intelligence – CS364Fuzzy LogicFuzzy Logic
13th October 2005 Bogdan L. Vrusias © 2005 208
Step 3: Aggregation of the rule outputsStep 3: Aggregation of the rule outputs
00.1
1C1
Cz is 1 (0.1)
C2
0
0.2
1
Cz is 2 (0.2)
0
0.5
1
Cz is 3 (0.5)
ZZZ
0.2
Z0
C30.5
0.1
Artificial Intelligence – CS364Artificial Intelligence – CS364Fuzzy LogicFuzzy Logic
13th October 2005 Bogdan L. Vrusias © 2005 209
Step 4: DefuzzificationStep 4: Defuzzification• The last step in the fuzzy inference process is
defuzzification.
• Fuzziness helps us to evaluate the rules, but the final output of a fuzzy system has to be a crisp number.
• The input for the defuzzification process is the aggregate output fuzzy set and the output is a single number.
Artificial Intelligence – CS364Artificial Intelligence – CS364Fuzzy LogicFuzzy Logic
13th October 2005 Bogdan L. Vrusias © 2005 210
Step 4: DefuzzificationStep 4: Defuzzification• There are several defuzzification methods, but probably
the most popular one is the centroid technique. It finds the point where a vertical line would slice the aggregate set into two equal masses. Mathematically this centre of gravity (COG) can be expressed as:
b
aA
b
aA
dxx
dxxx
COG
Artificial Intelligence – CS364Artificial Intelligence – CS364Fuzzy LogicFuzzy Logic
13th October 2005 Bogdan L. Vrusias © 2005 211
Step 4: DefuzzificationStep 4: Defuzzification• Centroid defuzzification method finds a point representing
the centre of gravity of the fuzzy set, A, on the interval, ab.
• A reasonable estimate can be obtained by calculating it over a sample of points.
( x )
1.0
0.0
0.2
0.4
0.6
0.8
160 170 180 190 200
a b
210
A
150X
Artificial Intelligence – CS364Artificial Intelligence – CS364Fuzzy LogicFuzzy Logic
13th October 2005 Bogdan L. Vrusias © 2005 212
Step 4: DefuzzificationStep 4: Defuzzification
4.675.05.05.05.02.02.02.02.01.01.01.0
5.0)100908070(2.0)60504030(1.0)20100(
COG
1.0
0.0
0.2
0.4
0.6
0.8
0 20 30 40 5010 70 80 90 10060
Z
Degree ofMembership
67.4
Artificial Intelligence – CS364Artificial Intelligence – CS364Fuzzy LogicFuzzy Logic
13th October 2005 Bogdan L. Vrusias © 2005 213
Sugeno Fuzzy InferenceSugeno Fuzzy Inference• Mamdani-style inference, as we have just seen, requires us
to find the centroid of a two-dimensional shape by integrating across a continuously varying function. In general, this process is not computationally efficient.
• Michio Sugeno suggested to use a single spike, a singleton, as the membership function of the rule consequent.
• A singleton, or more precisely a fuzzy singleton, is a fuzzy set with a membership function that is unity at a single particular point on the universe of discourse and zero everywhere else.
Artificial Intelligence – CS364Artificial Intelligence – CS364Fuzzy LogicFuzzy Logic
13th October 2005 Bogdan L. Vrusias © 2005 214
Sugeno Fuzzy InferenceSugeno Fuzzy Inference• Sugeno-style fuzzy inference is very similar to the
Mamdani method. Sugeno changed only a rule consequent. Instead of a fuzzy set, he used a mathematical function of the input variable. The format of the Sugeno-style fuzzy rule is
IF x is AAND y is BTHEN z is f(x, y)
where x, y and z are linguistic variables; A and B are fuzzy sets on universe of discourses X and Y, respectively; and f(x, y) is a mathematical function.
Artificial Intelligence – CS364Artificial Intelligence – CS364Fuzzy LogicFuzzy Logic
13th October 2005 Bogdan L. Vrusias © 2005 215
Sugeno Fuzzy InferenceSugeno Fuzzy Inference• The most commonly used zero-order Sugeno fuzzy
model applies fuzzy rules in the following form:
IF x is AAND y is BTHEN z is k
where k is a constant.
• In this case, the output of each fuzzy rule is constant. All consequent membership functions are represented by singleton spikes.
Artificial Intelligence – CS364Artificial Intelligence – CS364Fuzzy LogicFuzzy Logic
13th October 2005 Bogdan L. Vrusias © 2005 216
Sugeno Rule EvaluationSugeno Rule Evaluation
A3
1
0 X
1
y10 Y
0.0
x1 0
0.1
1
Z
1
0 X
0.2
0
0.2
1
Z
A2
x1
IF x is A1 (0.5) z is k3 (0.5)Rule 3:
A11
0 X 0
1
Zx1
THEN
1
y1
B2
0 Y
0.7
B10.1
0.5 0.5
OR(max)
AND(min)
OR y is B1 (0.1) THEN z is k1 (0.1)Rule 1:
IF x is A2 (0.2) AND y is B2 (0.7) THEN z is k2 (0.2)Rule 2:
k1
k2
k3
IF x is A3 (0.0)
A3
1
0 X
1
y10 Y
0.0
x1 0
0.1
1
Z
1
0 X
0.2
0
0.2
1
Z
A2
x1
IF x is A1 (0.5) z is k3 (0.5)Rule 3:
A11
0 X 0
1
Zx1
THEN
1
y1
B2
0 Y
0.7
B10.1
0.5 0.5
OR(max)
AND(min)
OR y is B1 (0.1) THEN z is k1 (0.1)Rule 1:
IF x is A2 (0.2) AND y is B2 (0.7) THEN z is k2 (0.2)Rule 2:
k1
k2
k3
IF x is A3 (0.0)
Artificial Intelligence – CS364Artificial Intelligence – CS364Fuzzy LogicFuzzy Logic
13th October 2005 Bogdan L. Vrusias © 2005 217
Sugeno Aggregation of the Rule OutputsSugeno Aggregation of the Rule Outputs
z is k1 (0.1) z is k2 (0.2) z is k3 (0.5) 0
1
0.1Z 0
0.5
1
Z0
0.2
1
Zk1 k2 k3 0
1
0.1Zk1 k2 k3
0.20.5
Graphical Technique of Inference
Case 1 : CRISP SETS max-min
Graphical Technique of InferenceCase 2: CRISP SETS: Using max-product (or correlation product) implication technique, aggregated output for r rules would be:
rk
jinputiinputy kkk AAkB
,,2,1
max2~1~~
rk
jinputiinputy kkk AAkB
,,2,1
max2~1~~
jinputiinputy kkk AAkB
2~1~~
max rk ,,2,1
Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 220
Mamdani-style inference, as we have just seen, Mamdani-style inference, as we have just seen, requires us to find the centroid of a two-dimensional requires us to find the centroid of a two-dimensional shape by integrating across a continuously varying shape by integrating across a continuously varying function. In general, this process is not function. In general, this process is not computationally efficient.computationally efficient.
Michio SugenoMichio Sugeno suggested to use a single spike, a suggested to use a single spike, a singletonsingleton, as the membership function of the rule , as the membership function of the rule consequent. A consequent. A singletonsingleton, or more precisely a , or more precisely a fuzzy fuzzy singletonsingleton, is a fuzzy set with a membership function , is a fuzzy set with a membership function that is unity at a single particular point on the that is unity at a single particular point on the universe of discourse and zero everywhere else.universe of discourse and zero everywhere else.
Sugeno fuzzy inferenceSugeno fuzzy inference
Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 221
Sugeno-style fuzzy inference is very similar to the Sugeno-style fuzzy inference is very similar to the Mamdani method. Sugeno changed only a rule Mamdani method. Sugeno changed only a rule consequent. Instead of a fuzzy set, he used a consequent. Instead of a fuzzy set, he used a mathematical function of the input variable. The mathematical function of the input variable. The format of the format of the Sugeno-style fuzzy ruleSugeno-style fuzzy rule is is
IFIF xx is is AAANDAND yy is is BBTHEN THEN zz is is f f ((x, yx, y))
where where xx, , yy and and zz are linguistic variables; are linguistic variables; AA and and BB are are fuzzy sets on universe of discourses fuzzy sets on universe of discourses XX and and YY, , respectively; and respectively; and f f ((x, yx, y) is a mathematical function.) is a mathematical function.
Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 222
The most commonly used The most commonly used zero-order Sugeno fuzzy zero-order Sugeno fuzzy modelmodel applies fuzzy rules in the following form: applies fuzzy rules in the following form:
IFIF xx is is AAANDAND yy is is BBTHEN THEN zz is is kk
where where kk is a constant. is a constant.
In this case, the output of each fuzzy rule is constant. In this case, the output of each fuzzy rule is constant. All consequent membership functions are represented All consequent membership functions are represented by singleton spikes.by singleton spikes.
Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 223
A3
1
0 X
1
y10 Y
0.0
x1 0
0.1
1
Z
1
0 X
0.2
0
0.2
1
Z
A2
x1
IF x is A1 (0.5) z is k3 (0.5)Rule 3:
A11
0 X 0
1
Zx1
THEN
1
y1
B2
0 Y
0.7
B10.1
0.5 0.5
OR(max)
AND(min)
OR y is B1 (0.1) THEN z is k1 (0.1)Rule 1:
IF x is A2 (0.2) AND y is B2 (0.7) THEN z is k2 (0.2)Rule 2:
k1
k2
k3
IF x is A3 (0.0)
Sugeno-style rule evaluationSugeno-style rule evaluation
Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 224
Sugeno-style Sugeno-style aggregation of the rule outputsaggregation of the rule outputs
z is k1 (0.1) z is k2 (0.2) z is k3 (0.5) 0
1
0.1Z 0
0.5
1
Z0
0.2
1
Zk1 k2 k3 0
1
0.1Zk1 k2 k3
0.20.5
Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 225
Weighted average (WA):Weighted average (WA):
655.02.01.0
805.0502.0201.0
)3()2()1(
3)3(2)2(1)1(
kkk
kkkkkkWA
0 Z
Crisp Outputz1
z1
Sugeno-style Sugeno-style defuzzificationdefuzzification
Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 226
How to make a decision on which method How to make a decision on which method to apply to apply Mamdani or Sugeno? Mamdani or Sugeno? Mamdani method is widely accepted for capturing Mamdani method is widely accepted for capturing
expert knowledge. It allows us to describe the expert knowledge. It allows us to describe the expertise in more intuitive, more human-like expertise in more intuitive, more human-like manner. However, Mamdani-type fuzzy inference manner. However, Mamdani-type fuzzy inference entails a substantial computational burden. entails a substantial computational burden.
On the other hand, Sugeno method is On the other hand, Sugeno method is computationally effective and works well with computationally effective and works well with optimisation and adaptive techniques, which makes optimisation and adaptive techniques, which makes it very attractive in control problems, particularly it very attractive in control problems, particularly for dynamic nonlinear systems.for dynamic nonlinear systems.
Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 227
Building a fuzzy expert system: case studyBuilding a fuzzy expert system: case study
A service centre keeps spare parts and repairs failed A service centre keeps spare parts and repairs failed ones. ones.
A customer brings a failed item and receives a spare A customer brings a failed item and receives a spare of the same type. of the same type.
Failed parts are repaired, placed on the shelf, and Failed parts are repaired, placed on the shelf, and thus become spares. thus become spares.
The objective here is to advise a manager of the The objective here is to advise a manager of the service centre on certain decision policies to keep service centre on certain decision policies to keep the customers satisfied.the customers satisfied.
Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 228
Process of developing a fuzzy expert systemProcess of developing a fuzzy expert system
1. Specify the problem and define linguistic variables.1. Specify the problem and define linguistic variables.
2. Determine fuzzy sets.2. Determine fuzzy sets.
3. Elicit and construct fuzzy rules.3. Elicit and construct fuzzy rules.
4. Encode the fuzzy sets, fuzzy rules and procedures 4. Encode the fuzzy sets, fuzzy rules and procedures
to perform fuzzy inference into the expert system.to perform fuzzy inference into the expert system.
5. Evaluate and tune the system.5. Evaluate and tune the system.
Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 229
Step Step 11: Specify the problem and define: Specify the problem and define linguistic variableslinguistic variables
There are four main linguistic variables: average There are four main linguistic variables: average waiting time (mean delay) waiting time (mean delay) mm, repair utilisation , repair utilisation factor of the service centre factor of the service centre , number of servers , number of servers ss, , and initial number of spare parts and initial number of spare parts nn..
Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 230
Linguistic variables and their rangesLinguistic variables and their ranges
Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 231
Step Step 22: Determine fuzzy sets: Determine fuzzy sets
Fuzzy sets can have a variety of shapes. However, Fuzzy sets can have a variety of shapes. However, a triangle or a trapezoid can often provide an a triangle or a trapezoid can often provide an adequate representation of the expert knowledge, adequate representation of the expert knowledge, and at the same time, significantly simplifies the and at the same time, significantly simplifies the process of computation.process of computation.
Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 232
Fuzzy sets of Fuzzy sets of Mean Delay mMean Delay m
0.10
1.0
0.0
0.2
0.4
0.6
0.8
0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1Mean Delay (normalised)
SVS M
Degree of Membership
Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 233
Fuzzy sets of Fuzzy sets of Number of Servers sNumber of Servers s
0.10
1.0
0.0
0.2
0.4
0.6
0.8
0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
M LS
Degree of Membership
Number of Servers (normalised)
Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 234
Fuzzy sets of Fuzzy sets of Repair Utilisation Factor Repair Utilisation Factor
0.10
1.0
0.0
0.2
0.4
0.6
0.8
0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1Repair Utilisation Factor
M HL
Degree of Membership
Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 235
Fuzzy sets of Fuzzy sets of Number of Spares nNumber of Spares n
0.10
1.0
0.0
0.2
0.4
0.6
0.8
0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
S RSVS M RL L VL
Degree of Membership
Number of Spares (normalised)
Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 236
Step Step 33: Elicit and construct fuzzy rules: Elicit and construct fuzzy rules
To accomplish this task, we might ask the expert to To accomplish this task, we might ask the expert to describe how the problem can be solved using the describe how the problem can be solved using the fuzzy linguistic variables defined previously.fuzzy linguistic variables defined previously.
Required knowledge also can be collected from Required knowledge also can be collected from other sources such as books, computer databases, other sources such as books, computer databases, flow diagrams and observed human behaviour. flow diagrams and observed human behaviour.
Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 237
The square FAM representationThe square FAM representation
m
s
M
RL
VL
S
RS
L
VS
S
M
VS S M
L
M
S
Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 238
The rule tableThe rule table
Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 239
Rule Base 1Rule Base 1
Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 240
Cube FAM of Rule Base 2Cube FAM of Rule Base 2
VS VS VSVS VS VS
VS VS VS
VL L M
HS
VS VS VSVS VS VS
VS VS VSM
VS VS VSVS VS VS
S S VSL
s
LVS S M
m
MH
VS VS VS
LVS S M
S
m
VS VS VSM
S S VSL
s
S VS VS
MVS S M
m
VS S M
m
S
RS S VSM
M RS SL
s
S
M M SM
RL M RSL
s
Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 241
Step Step 44: Encode the fuzzy sets, fuzzy rules: Encode the fuzzy sets, fuzzy rules and procedures to perform fuzzyand procedures to perform fuzzy inference into the expert systeminference into the expert systemTo accomplish this task, we may choose one of To accomplish this task, we may choose one of two options: to build our system using a two options: to build our system using a programming language such as C/C++ or Pascal, programming language such as C/C++ or Pascal, or to apply a fuzzy logic development tool such as or to apply a fuzzy logic development tool such as MATLAB Fuzzy Logic Toolbox or Fuzzy MATLAB Fuzzy Logic Toolbox or Fuzzy Knowledge Builder.Knowledge Builder.
Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 242
Step Step 55: Evaluate and tune the system: Evaluate and tune the system
The last, and the most laborious, task is to evaluate The last, and the most laborious, task is to evaluate and tune the system. We want to see whether our and tune the system. We want to see whether our fuzzy system meets the requirements specified at fuzzy system meets the requirements specified at the beginning. the beginning.
Several test situations depend on the mean delay, Several test situations depend on the mean delay, number of servers and repair utilisation factor. number of servers and repair utilisation factor.
The Fuzzy Logic Toolbox can generate surface to The Fuzzy Logic Toolbox can generate surface to help us analyse the system’s performance.help us analyse the system’s performance.
Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 243
Three-dimensional plots for Rule Base 1Three-dimensional plots for Rule Base 1
00.2
0.40.6
0.81
0
0.2
0.4
0.6
0.2
0.3
0.4
0.5
0.6
number_of_serversmean_delay
nu
mb
er_
of_
spa
res
Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 244
Three-dimensional plots for Rule Base 1Three-dimensional plots for Rule Base 1
00.2
0.40.6
0.81
0
0.2
0.4
0.6
0.2
0.3
0.4
0.5
0.6
utilisation_factormean_delay
nu
mb
er_
of_
spa
res
Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 245
Three-dimensional plots for Rule Base 2Three-dimensional plots for Rule Base 2
00.2
0.40.6
0.81
0
0.2
0.4
0.6
0.15
0.2
0.25
0.3
0.35
number_of_serversmean_delay
nu
mb
er_
of_
spa
res
Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 246
Three-dimensional plots for Rule Base 2Three-dimensional plots for Rule Base 2
00.2
0.40.6
0.81
0
0.2
0.4
0.6
0.2
0.3
0.4
utilisation_factormean_delay
num
ber
_of_
spar
es
0.5
Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 247
However, even now, the expert might not be However, even now, the expert might not be satisfied with the system performance. satisfied with the system performance.
To improve the system performance, we may use To improve the system performance, we may use additional sets additional sets Rather SmallRather Small and and Rather LargeRather Large on the universe of discourse on the universe of discourse Number of ServersNumber of Servers, , and then extend the rule base.and then extend the rule base.
Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 248
Modified fuzzy sets of Modified fuzzy sets of Number of Servers sNumber of Servers s
0.10
1.0
0.0
0.2
0.4
0.6
0.8
0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1Number of Servers (normalised)
RS M RL LS
Degree of Membership
Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 249
Cube FAM of Rule Base 3Cube FAM of Rule Base 3
VS VS VS
VS VS VS
VS VS VS
VS VS VS
VS VS VS
VS VS VS
VS VS VS
VS VS VS
VS VS VS
VS VS VS
VS VS VS
VS VS VS
VS VS VS
S S VS
S S VS
VL L M
VL RL RS
M M S
RL M RS
L M RS
HS
M
RL
L
RS
s
LVS S M
m
MH
VS VS VS
VS VS VS
VS VS VS
S S VS
S S VS
LVS S M
S
M
RL
L
RS
m
s
S VS VS
S VS VS
RS S VS
M RS S
M RS S
MVS S M
m
VS S M
m
S
M
RL
L
RS
s
S
M
RL
L
RS
s
Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 250
Three-dimensional plots for Rule Base 3Three-dimensional plots for Rule Base 3
00.2
0.40.6
0.81
0
0.2
0.4
0.6
0.15
0.2
0.25
0.3
0.35
number_of_serversmean_delay
num
ber
_of_
spar
es
Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 251
Three-dimensional plots for Rule Base 3Three-dimensional plots for Rule Base 3
00.2
0.40.6
0.81
0
0.2
0.4
0.6
0.2
0.3
0.4
utilisation_factormean_delay
nu
mb
er_
of_
spa
res
0.5
Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 252
Tuning fuzzy systems Tuning fuzzy systems
1.1. Review model input and output variables, and if Review model input and output variables, and if required redefine their ranges.required redefine their ranges.
2.2. Review the fuzzy sets, and if required define Review the fuzzy sets, and if required define additional sets on the universe of discourse.additional sets on the universe of discourse. The use of wide fuzzy sets may cause the fuzzyThe use of wide fuzzy sets may cause the fuzzy system to perform roughly.system to perform roughly.
3.3. Provide sufficient overlap between neighbouring Provide sufficient overlap between neighbouring sets. It is suggested that triangle-to-triangle and sets. It is suggested that triangle-to-triangle and trapezoid-to-triangle fuzzy sets should overlap trapezoid-to-triangle fuzzy sets should overlap between 25% to 50% of their bases.between 25% to 50% of their bases.
Negnevitsky, Pearson Education, 2002Negnevitsky, Pearson Education, 2002 253
4.4. Review the existing rules, and if required add new Review the existing rules, and if required add new rules to the rule base.rules to the rule base.
5.5. Examine the rule base for opportunities to write Examine the rule base for opportunities to write hedge rules to capture the pathological behaviour hedge rules to capture the pathological behaviour of the system.of the system.
6.6. Adjust the rule execution weights. Most fuzzy Adjust the rule execution weights. Most fuzzy logic tools allow control of the importance of rules logic tools allow control of the importance of rules by changing a weight multiplier.by changing a weight multiplier.
7.7. Revise shapes of the fuzzy sets. In most cases, Revise shapes of the fuzzy sets. In most cases, fuzzy systems are highly tolerant of a shape fuzzy systems are highly tolerant of a shape approximation.approximation.
Graphical Technique of Inference
Example:Rule 1: if x1 is and x2 is , then y is
Rule 2: if x1 is or x2 is , then y is input(i) = 0.35 input(j) = 55
1
1~A 1
2~A
~
1B2
1~A 2
2~A
~
2B
255
Graphical Technique of Inference
If x1 is and x2 is then y is , k = 1,2,..., r
Graphical methods that emulate the inference process and make manual computations involving a few simple rules.
Case 1: inputs x1, and x2 are crisp.
Memberships1 x1 = input(i)
(x1) = (x1 – input(i)) = 0 otherwise
1 x2 = input(i)(x2) = (x2 – input(i)) = 0 otherwise
256
Graphical Technique of Inference
For r disjunctive rules:
A11 refers to the first fuzzy antecedent of the first rule.
A12 refers to the second fuzzy antecedent of the first rule.
rk
jinputiinputy kkk AAkB
,,2,1
,minmax2~1~~
257
258
259
Summary
• Fuzzy Modelling – subjectivity blessing rather than a curse
Vagueness present in the definition of the terms is consistent with the information contained in the conditional rules developed by
the Engineer when observing some complex process• Set of linguistic variables and their meanings is compatible and
consistent with set of conditional rules used, the outcome of the
qualitative process is translated into objective and quantifiable results• Fuzzy mathematical tools and the calculus of fuzzy IF-THEN
rule provide a most useful paradigm for the automation and
implementation of an extensive body of human knowledge which are
not embodied in the quantitative modelling process
October 2005October 2005 260
• Fuzzification: definition of fuzzy sets, and determination of the degree of membership of crisp inputs in appropriate fuzzy sets.
• Inference: evaluation of fuzzy rules to produce an output for each rule.
• Composition: aggregation or combination of the outputs of all rules.
• Defuzzification: computation of crisp output
Operation of a fuzzy expert system:
October 2005October 2005 261
Recap
Example: Air Conditioner
Example: Cart Pole Problem
Case Study: Building a Fuzzy Expert System
Summary
Fuzzy Expert SystemsFuzzy Expert Systems
October 2005October 2005 262
Example: Air ConditionerExample: Air Conditioner
1a. Specify the problem
Air-conditioning involves the delivery of air, which can be warmed or cooled and have its humidity raised or lowered.
An air-conditioner is an apparatus for controlling, especially lowering, the temperature and humidity of an enclosed space. An air-conditioner typically has a fan which blows/cools/circulates fresh air and has a cooler. The cooler is controlled by a thermostat. Generally, the amount of air being compressed is proportional to the ambient temperature.
1b. Define linguistic variables• Ambient Temperature
• Air-conditioner Fan Speed
October 2005October 2005 263
Example: Air ConditionerExample: Air Conditioner
2. Determine Fuzzy Sets: Temperature
Temp Temp ((00C).C).
COLDCOLD COOLCOOL PLEASANTPLEASANT WARMWARM HOTHOT
00 Y*Y* NN NN NN NN
55 YY YY NN NN NN
1010 NN YY NN NN NN
12.512.5 NN Y*Y* NN NN NN
1515 NN YY NN NN NN
17.517.5 NN NN Y*Y* NN NN
2020 NN NN NN YY NN
22.522.5 NN NN NN Y*Y* NN
2525 NN NN NN YY NN
27.527.5 NN NN NN NN YY
3030 NN NN NN NN Y*Y*
Temp Temp ((00C).C).
COLDCOLD COOLCOOL PLEASANTPLEASANT WARMWARM HOTHOT
0< (T)<1
(T)=1
(T)=0
October 2005October 2005 264
Example: Air ConditionerExample: Air Conditioner
2. Determine Fuzzy Sets: Temperature
Temperature Fuzzy Sets
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
0 5 10 15 20 25 30
Temperature Degrees C
Tru
th V
alu
e
Cold
Cool
Pleasent
Warm
Hot
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
0 5 10 15 20 25 30
Cold
Cool
Pleasent
Warm
Hot
October 2005October 2005 265
Example: Air ConditionerExample: Air Conditioner
2. Determine Fuzzy Sets: Fan Speed
Rev/secRev/sec
(RPM)(RPM)
MINIMALMINIMAL SLOWSLOW MEDIUMMEDIUM FASTFAST BLASTBLAST
00 Y*Y* NN NN NN NN
1010 YY NN NN NN NN
2020 YY YY NN NN NN
3030 NN Y*Y* NN NN NN
4040 NN YY NN NN NN
5050 NN NN Y*Y* NN NN
6060 NN NN NN YY NN
7070 NN NN NN Y*Y* NN
8080 NN NN NN YY YY
9090 NN NN NN NN YY
100100 NN NN NN NN Y*Y*
October 2005October 2005 266
Example: Air ConditionerExample: Air Conditioner
2. Determine Fuzzy Sets: Fan Speed
Speed Fuzzy Sets
0
0.2
0.4
0.6
0.8
1
0 10 20 30 40 50 60 70 80 90 100
Speed
Tru
th V
alue
MINIMAL
SLOW
MEDIUM
FAST
BLAST
October 2005October 2005 267
Example: Air ConditionerExample: Air Conditioner
3. Elicit and construct fuzzy rules
RULE 1: IFRULE 1: IF temptemp is is coldcold THEN THEN speedspeed is is minimalminimalRULE 2: IF RULE 2: IF temptemp is is coolcool THEN THEN speedspeed is is slowslowRULE 3: IF RULE 3: IF temptemp is is pleasantpleasant THEN THEN speedspeed is is mediummediumRULE 4: IF RULE 4: IF temptemp is is warm warm THEN THEN speedspeed is is fastfastRULE 5: IF RULE 5: IF temptemp is is hothot THEN THEN speedspeed is is blastblast
October 2005October 2005 268
Example: Air ConditionerExample: Air Conditioner
3. Encode into an Expert System
4. Evaluate and tune the system
Consider a temperature of 16oC, use the system to compute the optimal fan speed.
Operation of a Fuzzy Expert System
• Fuzzification• Inference• Composition • Defuzzification
October 2005October 2005 269
Example: Air ConditionerExample: Air Conditioner
• Fuzzification
Affected fuzzy sets: COOL and PLEASANT
COOL(T) = – T / 5 + 3.5
= – 16 / 5 + 3.5
= 0.3
PLSNT(T) = T /2.5 - 6
= 16 /2.5 - 6
= 0.4
Temp=16 COLD COOL PLEASANT WARM HOT
0 0.3 0.4 0 0
October 2005October 2005 270
Example: Air ConditionerExample: Air Conditioner
• Inference
RULE 1: IFRULE 1: IF temptemp is is coldcold THEN THEN speedspeed is is minimalminimalRULE 2: IF RULE 2: IF temptemp is is coolcool THEN THEN speedspeed is is slowslowRULE 3: IF RULE 3: IF temptemp is is pleasantpleasant THEN THEN speedspeed is is mediummediumRULE 4: IF RULE 4: IF temptemp is is warm warm THEN THEN speedspeed is is fastfastRULE 5: IF RULE 5: IF temptemp is is hothot THEN THEN speedspeed is is blastblast
October 2005October 2005 271
Example: Air ConditionerExample: Air Conditioner
RULE 2: IF temp is cool (0.3) THEN speed is slow (0.3)
RULE 3: IF temp is pleasant (0.4) THEN speed is medium (0.4)
• Inference
October 2005October 2005 272
Example: Air ConditionerExample: Air Conditioner• Composition
speed is slow (0.3) speed is medium (0.4)+
October 2005October 2005 273
Example: Air ConditionerExample: Air Conditioner• Defuzzification
COG = 0.125(12.5) + 0.25(15) + 0.3(17.5+20+…+40+42.5) + 0.4(45+47.5+…+52.5+55) + 0.25(57.5) 0.125 + 0.25 + 0.3(11) + 0.4(5) + 0.25
= 45.54rpm
October 2005October 2005 274
Recap
Example: Air Conditioner
Example: Cart Pole Problem
Case Study: Building a Fuzzy Expert System
Summary
Fuzzy Expert SystemsFuzzy Expert Systems
October 2005October 2005 275
Example: Cart Pole ProblemExample: Cart Pole Problem
The problem is to balance an upright pole, with a mass m at its head and mass M at its base. A weightless shaft connects these two masses. The base can be moved on a horizontal axis. The task is to determine the FORCE (F) necessary to balance the pole. The calculation of the force F involves the measurement of the angle θ and the angular velocity, of the pole .
M
m
g
October 2005October 2005 276
nnbb nnmm nnss aazz ppss ppmm ppbb
nnbb ppss ppbb
nnmm ppmm
nnss nnmm nnss ppss
aazz nnbb nnmm nnss aazz ppss ppmm ppbb
ppss nnss ppss ppmm
ppmm nnmm
ppbb nnbb nnss
Example: Cart Pole ProblemExample: Cart Pole Problem
nb: negative big, nm: negative medium, ns: negative small az: approximately zerops: positive small, pm: positive medium, pb: positive big
IF is negative medium and is approximately zero THEN F is negative medium
October 2005October 2005 277
Example: Cart Pole ProblemExample: Cart Pole ProblemThe fuzzy sets for θ, and F are based on the linear equation μ(x)=ax + b, and are defined based on the following table:
if
if
if
October 2005October 2005 278
Example: Cart Pole ProblemExample: Cart Pole Problem
(b) Consider the case when the input variables are: θ = 50, = -5.
Use the rule base, execute each of the four tasks to compute the force F necessary to balance the pole using the Centre of Gravity in the Defuzzification task.
(a) Based on the fuzzy sets table draw three graphs showing the fuzzy sets (nb, nm, ns, az, ps, pm, pb) for each θ, and F individually.
October 2005October 2005 279
Example: Cart Pole ProblemExample: Cart Pole Problem
Fuzzification
i) Determine where θ and the angular velocity fall in the table θ: pm, pbaz
ii) Formulate possible rules from linguistic values obtained
IF θ is pm AND is az THEN F is pmIF θ is pb AND is az THEN F is pb
October 2005October 2005 280
Example: Cart Pole ProblemExample: Cart Pole ProblemFuzzification
iii) Compute membership functions
-11.25 -5 0 10
22.5 45 50 67.5
45 50 67.5
1 1 1/22.5 = /17.5
0.78θ: pm
θ: pb
67.55045
11/22.5 = /5
0.22
1
: az 1/11.25 = /6.25
0.56
October 2005October 2005 281
Example: Cart Pole ProblemExample: Cart Pole ProblemInference
The two premises in RULE 1 are conjunctive minimum of the two: min{0.78, 0.56}=0.56
1 IF θ is pm AND is az THEN F is pm
2 IF θ is pb AND is az THEN F is pb
The two premises in RULE 2 are conjunctive minimum of the two: min{0.22, 0.56}=0.22
October 2005October 2005 282
Example: Cart Pole ProblemExample: Cart Pole ProblemComposition
ps
pb
Defuzzification
3 0.2 (4 5 6) 0.56 (7 8) 0.225.30
0.2 0.56 0.56 0.56 0.22 0.22SoG
C
October 2005October 2005 283
Recap
Example: Air Conditioner
Example: Cart Pole Problem
Case Study: Building a Fuzzy Expert System
Summary
Fuzzy Expert SystemsFuzzy Expert Systems
October 2005October 2005 284
A service centre keeps spare parts and repairs failed ones. A customer A service centre keeps spare parts and repairs failed ones. A customer brings a failed item and receives a spare of the same type. Failed brings a failed item and receives a spare of the same type. Failed parts are repaired, placed on the shelf, and thus become spares. parts are repaired, placed on the shelf, and thus become spares.
The objective is to advise a manager of the service centre on certain The objective is to advise a manager of the service centre on certain decision policies to keep the customers satisfied.decision policies to keep the customers satisfied.
Case Study: Building a Fuzzy Case Study: Building a Fuzzy Expert SystemExpert System
Step 1: Specify the problem and define linguistic variables
There are four main There are four main linguistic variableslinguistic variables: average waiting time (mean : average waiting time (mean delay) delay) mm, repair utilisation factor of the service centre , repair utilisation factor of the service centre , number of , number of servers servers ss, and initial number of spare parts , and initial number of spare parts nn..
October 2005October 2005 285
Linguistic variables and their ranges
October 2005October 2005 286
Step 2: Determine fuzzy sets
Fuzzy sets can have a variety of shapes. Fuzzy sets can have a variety of shapes. However, a triangle or a trapezoid can often However, a triangle or a trapezoid can often provide an adequate representation of the expert provide an adequate representation of the expert knowledge, and at the same time, significantly knowledge, and at the same time, significantly simplifies the process of computation.simplifies the process of computation.
October 2005October 2005 287
Fuzzy sets of Fuzzy sets of Mean Delay mMean Delay m
0.10
1.0
0.0
0.2
0.4
0.6
0.8
0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1Mean Delay (normalised)
SVS M
Degree of Membership
October 2005October 2005 288
Fuzzy sets of Fuzzy sets of Number of Servers sNumber of Servers s
0.10
1.0
0.0
0.2
0.4
0.6
0.8
0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
M LS
Degree of Membership
Number of Servers (normalised)
October 2005October 2005 289
Fuzzy sets of Fuzzy sets of Repair Utilisation Factor Repair Utilisation Factor
0.10
1.0
0.0
0.2
0.4
0.6
0.8
0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1Repair Utilisation Factor
M HL
Degree of Membership
October 2005October 2005 290
Fuzzy sets of Fuzzy sets of Number of Spares nNumber of Spares n
0.10
1.0
0.0
0.2
0.4
0.6
0.8
0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
S RSVS M RL L VL
Degree of Membership
Number of Spares (normalised)
October 2005October 2005 291
Step 3: Elicit and construct fuzzy rules
To accomplish this task, we might ask the expert To accomplish this task, we might ask the expert to describe how the problem can be solved using to describe how the problem can be solved using the fuzzy linguistic variables defined previously.the fuzzy linguistic variables defined previously.
Required knowledge also can be collected from Required knowledge also can be collected from other sources such as books, computer other sources such as books, computer databases, flow diagrams and observed human databases, flow diagrams and observed human behaviour. behaviour.
October 2005October 2005 292
The square FAM representationThe square FAM representation
October 2005October 2005 293
The rule tableThe rule table
October 2005October 2005 294
Rule Base 1Rule Base 1
Fuzzy If-Then RulesFuzzy If-Then Rules
• Mamdani style
If pressure is high then volume is small
high small
• Sugeno style
If speed is medium then resistance = 5*speed
mediumresistance = 5*speed
1996 Asian Fuzzy Systems Symposium
297
By using fuzzy sets, we can formulate fuzzy if-then rules that are commonly
used in our daily expressions. Basically, we have two types of fuzzy rules.
For Mamdani style, for instance, if pressure is high then volume is small,
where high? and small are described by fuzzy sets
For Sugeno style, if the speed of a moving object is medium then the
resistance due to atmosphere is 5 times the speed. The basic difference
between these two rules is in their THEN part, where Madman style has a
fuzzy but Surgeon style has a linear equation. Madman style fuzzy rules
were first proposed in the literature; they are more appealing to human
intuition. Surgeon style fuzzy rules are proposed later, but they are more
suited for mathematical design and analysis.
In this, we concentrate on Surgeon style fuzzy if-then rules.
Mamdani Fuzzy SystemMamdani Fuzzy System
Graphics representation:A1 B1
A2 B2
T-norm
X
X
Y
Y
w1
w2
C1
C2
Z
Z
C’Z
X Yx is 4.5 y is 56.8 z is zCOA
Fuzzy Inference System (FIS)Fuzzy Inference System (FIS)
If speed is low then resistance = 2If speed is medium then resistance = 4*speedIf speed is high then resistance = 8*speed
Rule 1: w1 = .3; r1 = 2Rule 2: w2 = .8; r2 = 4*2Rule 3: w3 = .1; r3 = 8*2
Speed2
.3
.8
.1
low medium high
Resistance = (wi*ri) / wi = 7.12
MFs
TSK Fuzzy System page 81TSK Fuzzy System page 81
• Rule baseIf X is A1 and Y is B1 then Z = p1*x + q1*y + r1
If X is A2 and Y is B2 then Z = p2*x + q2*y + r2
• Fuzzy reasoning
A1 B1
A2 B2
x=3
X
X
Y
Yy=2
w1
w2
z1 =p1*x+q1*y+r1
z2 =p2*x+q2*y+r2
z =w1+w2
w1*z1+w2*z2
Tsukamoto Fuzzy SystemTsukamoto Fuzzy System
Graphics representation:A1 B1
A2 B2
T-norm
X
X
Y
Y
w1
w2
C1
C2
Z
Z
X Yx is 4.5 y is 56.8
z1
z2
z =w1+w2
w1*z1+w2*z2
Zhang-Kandel Fuzzy SystemZhang-Kandel Fuzzy System
Graphics representation:A1 B1
A2 B2
T-norm
X
X
Y
Y
w1
w2
C1
C2
Z
Z
X Yx is 4.5 y is 56.8
za
zd
z =w1+w2
w1*z1+w2*z2
zc
zb
Z1={Za, Zb} Z2={Zc, Zd}