0% found this document useful (0 votes)
18 views19 pages

2010 2011 Session Questions and Model Answers

The document discusses fuzzy logic and fuzzy control systems. It provides solutions to exam questions about designing fuzzy subsets to represent evolutionary relationships between species. It also covers fuzzy rules, membership functions, and determining constants in algebraic relationships between fuzzy system inputs and outputs.

Uploaded by

sd
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views19 pages

2010 2011 Session Questions and Model Answers

The document discusses fuzzy logic and fuzzy control systems. It provides solutions to exam questions about designing fuzzy subsets to represent evolutionary relationships between species. It also covers fuzzy rules, membership functions, and determining constants in algebraic relationships between fuzzy system inputs and outputs.

Uploaded by

sd
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

BA Mod.

(Computer Science) Trinity Term 2011


SS Examination

Solutions to
CS4001 Fuzzy Logic and Fuzzy Control Systems

Prof. Khurshid Ahmad


Q1 (a). Design fuzzy subsets, for each of the three ancestors and the
parent, that have the term set comprising the following daughter species:

{Pacific Lamprey, Arctic Lamprey, Atlantic Salmon, Pacific Salmon, Blue


Shark, White Shark, Non-snake Lizard, Snake-like Lizards}

Use the fuzzy subset notation of ordered pairs {(x, µA(x))} where x∈X, X
being the universe of discourse and A is a fuzzy (sub)-set of X:.

µA : X → [0, 1] the membership function of A

µA(x) ∈ [0, 1] is grade of membership of x in A.

Answer 1a: In evolution of species there is continuous change of


properties of an organism. So the there I have assumed that the
membership function of a fuzzy set can be computed using an ‘inter-
generational distance’- the distance between immediate successor
generations is assumed to be one and use the inverse of the exponential
of half the distance as the membership function.

Parent/ Grandparent/ Great Great


Daughter Daughter Grandparent/ great-grandparent/
Daughter Daughter
Distance 1 2 3 4
Belongingness 0.61 0.37 0.22 0.14
Agreat-great-grandparents ={0.14/Pacific Lamprey, 0.14/Arctic Lamprey,
0.14/Atlantic Salmon, 0.14/Pacific Salmon, 0.14/Blue Shark,
0.14/White Shark, 0.14/Non-snake Lizard, 0.14/Snake-like Lizards }

Agreat-grandparents ={0.22/Atlantic Salmon, 0.22/Pacific Salmon, 0.22/Blue


Shark, 0.22/White Shark, 0.22/Non-snake Lizard, 0.22/Snake-like
Lizards }

Agrandparent-daughter ={0.37/Atlantic Salmon, 0.37/Pacific Salmon,


0.37/Non-snake Lizard, 0.37/Snake-like Lizards }

Asalmon-daughter ={0.61/Atlantic Salmon, 0.61/Pacific Salmon}

Alizard-daughter ={0.61/Non-snake Lizard, 0.61/Snake-like Lizards }


[70 Marks]

Q1 (b) Compute the core, support and cardinality of the fuzzy sub-set of
the three ancestors and the two parents.

Answer 1b

(i) Core of all these fuzzy sets is the null set φ, as no members have the membership function
value equal to unity.

[10 Marks]

(ii) Support of all the fuzzy sets comprises all the listed members as members with zero
belongingness have been omitted.

[10 Marks]

(iii) The cardinality of the sets is as follows:

Card(Agreat-great-grandparents) = 8*0.14= 1.12

Card(Agreat-grandparents) = 6 *0.22 = 1.32

Card(Agrandparent-daughter) =4 *0.37 = 1.28


Card (Asalmon-daughter) =2 * 0.61= 1.32

Card(Alizard-daughter)= =2 * 0.61= 1.32


[10 Marks]
Q2 (a) In conventional knowledge based systems, relationships between
domain objects, say A and B, can be expressed as

Answer 2(a)

Relationships

Simple or Conditional and Complex or Ordered sequences of


Relational Statements instructions comprising
between domain objects A, B:

Crisp Statements IF A THEN B; A=5;

A is-a-part-of B IF A < 5 THEN B=A+5


………
A weighs 5KG

Fuzzy Statements IF A (Ψ ) THEN B (Ψ ) A IS-SMALL; Ψ (5)=1;


A B small
Ψ (x)=0  x<4, or x>6.
small
A is a sub-set of B, i.e. For all
x, Ψ (x) ≤Ψ (x) IF A (Ψ ) IS_SMALL THEN B =
A B
A
A+5
A weighs about 5KG

[40 Marks]

Q2 (b)

Construct a fuzzy rule-base, where income and risk are in a conditional


relationship with income as antecedent and risk as consequent, by
creating fuzzy patches.

The student is expected to discuss the Cartesian product of two fuzzy subsets – income and risk:

The 5artesian or cross product of fuzzy subsets A and B, of sets X and Y respectively is denoted as

A×B

This cross product relationship T on the set X × Y is denoted as

T=A×B

This will lead to

µT ( x, y ) = MIN [(µ A ( x), µ B ( y ))]


The fuzzy sets can be derived from the following definitions:

µ Income
Excellent
( x ) = 0, ∀x ≤ 90; µ Income
Excellent
( x ) = 1, x ≥ 120;
µ Income
Good
( x ) = 0, ∀x ≤ 50 & ∀x ≥ 100 ; µ Income
Good
( x ) = 1, x = 75 ;
µ Income
Poor
( x ) = 0, ∀x ≥ 60 ; µ Income
Poor
( x ) = 1, x ≤ 10.

µ Risk
Low
( x ) = 0, ∀x ≥ 40 % ; µ Risk
Low
( x ) = 1, x ≤ 20% ;
µ Risk
Medium
( x ) = 0, ∀x ≤ 20% & ∀x ≥ 80% ; µ Risk
Medium
( x ) = 1, 40 % ≤ x ≤ 60% ;
µ Risk
High
( x ) = 0, ∀x ≤ 60 %; µ Risk
High
( x ) = 1, x ≥ 80 % ;

Answer 2(b)

The computation of the fuzzy membership functions for terms (sub-)set


{Excellent, Poor} for the linguistic variable income can be calculated
using a linear function with a threshold value; similarly for the two terms
{Low, High} of the risk variable. The membership function for the term
Good Income can be computed using a triangular membership function:

  x − a c − x  
trim f ( x ; a , b , c ) = m a x  m in  ,  ,0
  b − a c − b  
,

where a=20, b=40 and c=80.

And, the term Medium Risk can be computed using a trapezoidal


membership function:

  x − a d − x  
tra p m f ( x ; a , b , c , d ) = m a x  m in  ,1 ,  ,0
  b − a d − c  
,

where the value of the constants is as follows:

a=20%, b=40%, c=60% and d=80%

The student is expected to draw the two graphs:


1.0
0.9
0.8
0.7
0.6
0.5 Low
0.4
Medium
0.3
High
0.2
0.1
0.0
0% 20% 40% 60% 80% 100%

Risk

And

1
0.9
0.8
0.7
0.6
0.5 Poor
0.4
Good
0.3
Excellent
0.2
0.1
0
0 50 100 150

Income (K Euros)
Then the fuzzy patches can be drawn as follows:

[60 Marks]
Q3 (a). Use the algebraic relationship between the input and the output,
for computing the value of the constants p01, p11, p02, p12.

Rule1 : x is µ1 ( x) THEN y = p01 + p11 x


Rule2 : x is µ 2 ( x) THEN y = p02 + p12 x

Answer 3a

The composition phase of fuzzy inference will yield:

COMPOSITION
µ1 ( x) * [ p01 + p11 x] + µ 2 ( x) * [ p 02 + p12 x]
y=
µ1 ( x ) + µ 2 ( x )
µ1 ( x )
µˆ 1 ( x) =
µ1 ( x ) + µ 2 ( x )
µ 2 ( x)
µˆ 2 ( x) =
µ1 ( x ) + µ 2 ( x )
∴ y = µˆ 1 ( x) * [ p 01 + p11 x] + µˆ 2 ( x) * [ p 02 + p12 x]

y = µˆ1 ( x) *[ p01 + p11 x] + µˆ 2 ( x) *[ p02 + p12 x]


Four values of x = x1 , x2 , x3 , x4 and for each x, will haveavalue
y1 = µˆ1 ( x1 ) * p01 + µˆ 2 ( x1 ) * p02 + µˆ1 ( x1 ) * x1 * p11 + µˆ 2 ( x1 ) * x1 * p11
 y1   µˆ1 ( x1 ) µˆ 2 ( x1 ) µˆ 2 ( x1 ) µˆ1 ( x1 ) * x1 + µˆ 2 ( x1 ) * x1   p01 
 y   µˆ ( x )
 2 =  1 2 µˆ 2 ( x2 ) µˆ 2 ( x2 ) µˆ1 ( x2 ) * x1 + µˆ 2 ( x2 ) * x2   p02 
 y3   µˆ1 ( x3 ) µˆ 2 ( x3 ) µˆ 2 ( x3 ) µˆ1 ( x3 ) * x3 + µˆ 2 ( x3 ) * x3   p11 
    
 y4   µˆ1 ( x4 ) µˆ 2 ( x4 ) µˆ 2 ( x4 ) µˆ1 ( x4 ) * x4 + µˆ 2 ( x4 ) * x4   p21 

[30 Marks]

Q3 (b) Describe in your own words the importance of Takagi and


Sugeno’s insight in using the algebraic relationship in being able to derive
a fuzzy control system’s parameter.

Answer 3(b)

In order to determine the values of the parameters p in the consequents,


one solves the LINEAR system of algebraic equations and tries to
minimize the difference between the ACTUAL output of the system (Y)
and the simulation [X]T[P] :
[Y ] − [X ]T [P ] ≤ ε
where ε is the error term.

This result suggests that the parameters, p, in the consequent can be


derived from a subset of input-output relationships: Takagi and Sugeno
claimed that ‘this method of identification enables us to obtain just the
same parameters as the original system, if we have a sufficient number of
noiseless output data for identification’.

What is equally important here is that Takagi and Sugeno have method to
an n-rule, m-parameter system.

[20 Marks]

Q3 (c) Consider the following fuzzy implications (or rules) R1, R2, and R3
used in the design of a Takagi-Sugeno controller:

R1  If x1 is small & x2 is medium then y = x1+x2

R2 If x1 is big then y = 2x1

R3 If x2 is critical then y = 3x2

where y (i) refers to the consequent variable for each rule labelled Ri and
x1 and x2 refer to the input variables that appear in premise of the rules.

The membership functions are defined as follows:

x small medium big critical


5 0.69 0.37 0 0.37
12 0.25 0 0.20 1

Compute the output of the 3-rule TS controller for input values 5 and 12.
Show all three steps of the computation, fuzzification, inference, and
composition for each of the input values.

50 Marks [25 marks for each of the two inputs]


Answer 3(c) The student should breakdown his/her calculation in the
three stages of computation in a Takagi-Sigeno fuzzy knowledge based
system:

FUZZUFICATION: We have the following values of the membership


functions for the two values x1 = 12 & x2 = 5:

Membership Functions
Small Medium Big Critical
x1=5 0.69 0.37 0 0.37
x2=12 0.25 0 0.2 1

INFERENCE & CONSEQUENCE

Rule Premise 1 Premise 2 Consequence Truth Value


(Min(Premise1 &
Premise 2)
R1 small(x1)=0.25 medium y=x1+x2=12+5=17 min(0.25,0.37)=0.25
(x2)=0.37
R2 big(x1)=0.2 y=2 * x1=24 0.2
R3 critical(x2)=0.37 Y=3* x2=15 0.37

AGGREGATION (& DEFUZZIFICATION)

The aggregation can be performed by using a centre of area computation:

∑ y=y
i =1, 3
(i )
* y (i )
=
∑ y=y
i =1, 3
(i )

0.25 *17 + 0.2 * 24 + 0.375 *15


y = = 17.8
0.25 + 0.2 + 0.375

The system output is 17.8 which is quite close to the arithmetic


average of the three outputs {17,24,15}, 18.6.

[50 Marks]
Q4

Compute Enda’s speed of rotation (η) for the following cases: Indicate
clearly all the processes of fuzzy inference in your computation.

Distance from the Direction

beginning of the bend (cms) inner barrier θ


(cms)

9.95 30 0˚
65.1 30 -30˚

ANSWER 4.

FUZZIFICATION:

Input Variables: χ1= 10; χ2 = 30; and χ3= 0

Linguistic Distance from the Distance from the Direction of Rotation


Variable beginning of the inner bend
bend

Small 10 30 NOT APPLICABLE


χ 1small (10) = − +1 χ 2small (30) = − +1
50 40
4 1
= = 0.8 = = 0.25
5 4

Moderate 0 NOT APPLICABLE NOT APPLICABLE

Longway 0 30 1 NOT APPLICABLE


χ 2longway (30) = −
60 3
1 1
= − = 0.16
2 3

Forward NOT APPLICABLE NOT APPLICABLE 0


χ 3forward (0) = − +1
30
=1

Inward NOT APPLICABLE NOT APPLICABLE 0

Outward NOT APPLICABLE NOT APPLICABLE 0

[20 Marks]
Answer 4 (Continued)

FUZZIFICATION:

Input Variables: χ1= 65; χ2 = 30; and χ3=-30


Linguistic Distance from the Distance from the Direction of Rotation
Variable beginning of the inner bend
bend

Small 30 NOT APPLICABLE


χ 2small (30) = − +1
40
1
= = 0.25
4

Moderate x NOT APPLICABLE NOT APPLICABLE


χ 1mod erate ( x ) = − +3
30
65
=− +3
30
5
= = 0.83
6

Longway 0 30 1 NOT APPLICABLE


χ 2longway (30) = −
60 3
1 1
= − = 0.16
2 3

Forward NOT APPLICABLE NOT APPLICABLE 0

Inward NOT APPLICABLE NOT APPLICABLE 0

Outward NOT APPLICABLE NOT APPLICABLE ( −30) 1


χ 3outwards ( −30) = − −
40 2
3 1 1
= − =
4 2 4

[20 Marks]
Answer 4 (Continued)

Composition (and Defuzzification)

Input Variables: χ1= 10; χ2 = 30; and χ3=0

η ( χ1 , χ 2 , χ 3 ) ≡
5

∑α i *η i
0.0.8
η (10,30,0) = i =1
5
= = 2.2298 deg/ sec
0.4166
∑αi =1
i

[30 Marks]
Answer 4 (Concluded)

Input Variables: χ1= 65.1; χ2 = 30; and χ3=-30

η (χ1 , χ 2 , χ 3 ) ≡
5

∑α i *η i
0 .8
η (65.1,30,−30) = i =1
5
= = 3.198 deg/ sec
0.250
∑αi =1
i
[30 Marks]
Q5

Q5(a). Consider the OR-gate with two inputs and one output:

X1 X2 Y
0 0 0
1 0 1
0 1 1
1 1 1

You are expected to train a perceptron, with two inputs and one output, to learn
to behave like an OR gate. Assume that the learning constant α=0.2, bias θ=-0.3
and input weights are w1=0.3 and w2=-0.1. Train the perceptron for at least 4
epochs. Tabulate the inputs and outputs (actual and desired) together with
weight changes.

Answer 5a The training shows convergence in Epoch 4.

Epoch 1

X1 X2 d w1 w2 sum out err w1 w2

0 0 0 0.3 -0.1 -0.3 0 0 0.3 -0.1

1 0 1 0.3 -0.1 0 0 1 0.5 -0.1

0 1 1 0.5 -0.1 -0.4 0 1 0.5 0.1

1 1 1 0.5 0.1 0.3 1 0 0.5 0.1

Epoch 2

X1 X2 d w1 w2 sum out err w1 w2


0 0 0 0.5 0.1 -0.3 0 0 0.5 0.1

1 0 1 0.5 0.1 0.2 1 0 0.5 0.1

0 1 1 0.5 0.1 -0.2 0 1 0.5 0.3

1 1 1 0.5 0.3 0.5 1 0 0.5 0.3

Epoch 3

X1 X2 d w1 w2 sum out err w1 w2

0 0 0 0.5 0.3 -0.3 0 0 0.5 0.3

1 0 1 0.5 0.3 0.2 1 0 0.5 0.3

0 1 1 0.5 0.3 0 0 1 0.5 0.5

1 1 1 0.5 0.5 0.7 1 0 0.5 0.5

Epoch 4

X1 X2 d w1 w2 sum out err w1 w2

0 0 0 0.5 0.5 -0.3 0 0 0.5 0.5

1 0 1 0.5 0.5 0.2 1 0 0.5 0.5

0 1 1 0.5 0.5 0.2 1 0 0.5 0.5

1 1 1 0.5 0.5 0.7 1 0 0.5 0.5

[60 Marks]

Q5 (b) Can you use the perceptron learning algorithm for learning the behaviour
of an XOR gate? Give your reasons as to whether you can or cannot?

ANSWER 5(b)

Answer 5b. XOR gate cannot be modelled by simple perceptron since it doesn’t
belong to the set of linearly separable problems. Single perceptron can represent
a line in an input space where all inputs below this line have one output value
and all inputs above this line have another value. Since input space of XOR
problem cannot be divided by line to get all inputs related to 0 outputs on the
one side and all inputs related to 1 outputs to the other side of the line, single
perceptron can never model a XOR gate.
Q5 c. Describe the architecture of an adaptive neuro-fuzzy system that
can learn the behaviour described in the above rule base governing the
operation of an XOR gate.

ANSWER 5(c)

Answer 5c. In order to model XOR gate we need to design a neuro-


fuzzy system with one hidden layer. In this system, first layer would
comprise inputs x1 and x2 and a bias. Two input nodes together with
bias would all be connected to one neuron in the hidden layer. Another
neuron in the hidden layer would be the bias. All neurons from the
hidden layer are connected to the one neuron in the output layer.

-1.5 -0.5
1 -9.0 1

1
x1 Σ ƒ x1 Σ ƒ
1
1
1
x2 x2

You might also like