2010_2011 - School of Computer Science and Statistics

advertisement
UNIVERSITY OF DUBLIN
TRINITY COLLEGE
School of Computer Science and Statistics
Department of Computer Science
BA Mod. (Computer Science)
SS Examination
Trinity Term 2011
CS4001 Fuzzy Logic and Fuzzy Control Systems
Date
Location
Time: 3 Hours
Prof. Khurshid Ahmad
Instructions
(i)
A total of THREE questions out of FIVE must be answered for full marks.
(ii)
All questions carry equal marks.
(iii)
Use of non-programmable calculators and log tables is permitted.
You must note the make and model of your calculator on your answer
book.
Q1. This question is about fuzzy sets and systems
In biology, evolution of species is a dominant paradigm pioneered by
Charles Darwin. Darwin challenged the notion that species of organisms
are fixed. The case of four species: lampreys, sharks, salmon and lizards,
is often used in biological systematic, to describe how the present
members of apparently distinct species have had a common ancestor.
Here is a summary of these four species from Encyclopedia Britannica
Online:
 Lampreys are a primitive, fishlike, jawless organism. There are 43
species of lamprey, including the Pacific and Arctic lampreys.
 Lizards [..] are scaly-skinned reptiles which generally have legs,
movable eyelids etc, and thus distinguished from snakes. There are
some snake-like lizards have no eyelids (gecko).
 Sharks belong to the species of predatory cartilaginous fishes.
Sharks are usually distinguished according to their colours: gray to
cream, brown, yellow, slate, white, blue and lemon.
 Salmon, early literature describes what we now know as Atlantic
salmon, however there are six known species of Pacific salmon as
well.
The table below shows a time line of the evolution of these species.
Systematic biologists tell us that salmons and lizards have many traits in
common and perhaps have had a common ancestor (labelled ANCESTOR 1).
Some of these traits of ANCESTOR 1 are shared with the sharks and these
three species, in turn, have a common ancestor - ANCESTOR 2. Finally,
some of the traits of ANCESTOR 2 are also found in the lampreys – so the
great great-grandparent is labelled ANCESTOR 3. Lampreys appear to be
the least evolved and, salmons and lizards to be most evolved; sharks are
somewhere in the middle. We assume that the daughter species (e.g.
Pacific/Arctic salmon) are living in the present and what they have in
common are the properties of their parents.
Daughters
Parent
Pacific Arctic Blue White Atlantic Pacific Snake- Nonlike
snake
like
Salmon
Lizard
Lamprey
ANCESTOR 1
Shark
Grandparent
ANCESTOR 2
Great
grandparent
Great greatgrandparent
ANCESTOR 3
Q1 (a). Design fuzzy subsets for each of the four ancestors 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.
Hint: For computing membership function, you might like to use the
exponentiation of half the difference between the mnemonic of the
ancestor and the daughter species:
Sibling/Daughter Parent/Daughter
Distance
0
1
Belongingness
1.00
0.61
100 Marks [25 Marks for each species]
Q2. This question is about fuzzy knowledge based systems:
Q2 (a) In conventional knowledge based systems, relationships between
domain objects, say A and B, can be expressed as
(i) conditions like if A then B; or,
(ii) partonymies, or part-whole relationships, for example, A
is_a_part_of B, or,
(iii) ordered sequences of instructions comprising :
A:= 5
If A < 5 then B:=A+5.
The objects are in themselves described by statements like
(iv) A weighs 5kilo-grammes;
̅ or not (A) to denote that A is false
(v) 𝐀
̅ does not belong_to B
(vi) A belongs_to class B, so 𝐀
How will you express the relationships (i-iii) and statements (iv-vi) in a
fuzzy knowledge based systems?
[60 Marks]
Q2 (b) When anyone wishes to borrow money from a lender, the lender
carries out risk assessment on the borrower and uses the borrower’s
income as a basis for the computation of risk. There are two linguistic
variables in this transaction: income and risk. The membership functions
for the term sets, {EXCELLENT, GOOD, POOR} for the variable
{LOW, MEDIUM, HIGH} for the linguistic variable
RISK,
INCOME,
and
are given below:
Excellent
Excellent
 Income
( x)  0, x  90;  Income
( x)  1, x  120;
Good
Good
 Income
( x)  0, x  50 & x  100 ;  Income
( x)  1, x  75 ;
Poor
Poor
 Income
( x)  0, x  60 ;  Income
( x)  1, x  10.
Low
Low
 Risk
( x)  0, x  40% ;  Risk
( x)  1, x  20% ;
Medium
 Risk
( x)  0, x  20% & x  80% ;
Medium
 Risk
( x)  1, 40%  x  60% ;
High
High
 Risk
( x)  0, x  60%;  Risk
( x)  1, x  80% ;
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.
[40 Marks]
Q3. This question is about fuzzy control systems
In 1985, Takagi and Sugeno wrote a paper in which they argued that in
order to develop a generic and simple mathematical tool for computing
fuzzy implications, one needs to look at a fuzzy partition of fuzzy input
space. In each fuzzy subspace a linear input-output relation is formed.
The output of fuzzy reasoning is given by the values inferred by some
implications that were applied to an input.
Consider a two-rule Takagi-Sugeno-Kang fuzzy control system:
Rule 1 : IF
x is
1 ( x)
THEN y  p01  p11 x
Rule 2 : IF
x is
 2 ( x)
THEN y  p02  p12 x
where x is the input and y the output, and μ1(x) and μ2(x) are
membership functions. p01, p11, p02, p12, are four constants.
Q3 (a). Use the algebraic relationship between the input and the output,
for computing the value of the constants p01, p11, p02, p12.
[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.
[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
5
12
small
0.69
0.25
medium
0.37
0
big
critical
0
0.20
0.37
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]
Q4. This question is about Takagi-Sugeno-Kang controllers
Enda Martin is a clever motorcyclist and an expert at negotiating bends
at high speed without accelerating. A bend in a road is typically
enclosed by an inner and an outer barrier. He is not fussed about the
outer barrier. Enda is quick at computing the distance of his
motorcycle or bike: from the beginning of the bend (  1 ) and from the
inner barrier (  2 ). He can also compute the direction of his bike (  3).
Enda can rotate at considerable speeds (denoted by η). The distances
he can negotiate range between 0 and 150 cms and he can rotate
between -90˚ and +90˚. The respective domains of  1,  2 and  3,
will be referred to as X1, X2 and X3. The fuzzy partitions for each of
the domains are as follows:
Domain X1: Distance from the beginning of the bend (
 1): The designer of
Enda’s motorcycle, Micheal Kenny, has a three term set for the distance from
the beginning of the bend: SMALL, MEDIUM, LONGWAY:
x
 1;
50
x  60
1moderate ( x )  1 
30
x
1longway( x ) 
 1;
70
1sm all ( x )  
0  x  50;
30  x  90; x indicates the absolute value of x
70  x  140; 1longway( x )  1 for all x  140
Domain X2: Distances from the inner barrier (
 2):
Micheal has a two-term set
for the linguistic variable ‘distance from the inner barrier’: SMALL distance and
distances LONGWAY away from the barrier:
x
 1;
0  x  40
40
x 1
 2longway( x ) 
 ; 20  x  80;  2longway( x )  1 for all x  80
60 3
 2sm all ( x )  
Domain X3: Direction of Rotation (
 3):
For Enda there are three directions:
OUTWARDS, INWARDS AND FORWARDS..
 3outwards( )

 3inward ( )

 3forward ( )
 

40

30

30
1
 ;
2
 60     20 
 1;
30     60  ;  3inward ( x )  1 for all   60  ;
 1;
 30     30 .
SEE NEXT PAGE
The rules governing Enda’s behaviour are:
Rule 1: If χ1 is SMALL and χ2 is SMALL and χ3 is FORWARDS
then  = 0.25 - 0.02 χ1 + 0.06 χ2 -0.05 χ3
Rule 2: If χ1 is SMALL and χ2 is SMALL and χ3 is INWARDS
then  = - 0.025 χ1 + 0.07 χ2 -0.075 χ3
Rule 3: If χ1 is SMALL and χ2 is LONG WAY and χ3 is FORWARDS
‘then  = 3 - 0.02 χ1 -0.02 χ3
Rule 4: If χ1 is MODERATE and χ2 is SMALL and χ3 is OUTWARDS
then  = 3 –0.02 χ1 +0.01 χ2 -0.04 χ3
Rule 5: If χ1 is LONG WAY and χ2 is SMALL and χ3 is OUTWARDS
then  = 0.5 - 0.005 χ3
Compute Enda’s speed of rotation (η) for the following cases: Indicate
clearly all the processes of fuzzy inference in your computation.
Distance from the
beginning of the bend (cms)
Direction
inner barrier
(cms)
θ
9.95
30
0˚
65.1
30
-30˚
100 Marks [Each computation carries 50 Marks]
Q5. This question is about neuro-fuzzy systems
Neuro-fuzzy systems involve a rendering of a fuzzy rule base system as an
equivalent neural network. Neuro-fuzzy systems are trained using the so-called
supervised learning algorithm, especially the ubiquitous back-propagation
algorithm. The single layer perceptron was a precursor to the back-propagation
based neural computing systems.
Q5 a. Consider the following perceptron learning algorithm that can be used to
train the perceptron to learn the behaviour of two logic gates: AND & OR gates.
STEP
Description
Equations
1
Set initial weights w1 and w2
and the bias θ to set of
random numbers
Compute the weighted sum
(Σ)
Calculate the output using a δfunction
Σ =x1*w1+x2*w2+ θ
2
3
4
5 (a)
5 (b)
5 (c )
Compute the error (e) which is
the difference between the
actual output (y)and desired
output (ydesired)
IF the errors during a training
epoch are all zero THEN STOP
IF the errors during a training
epoch are not all zero THEN
UPDATE weights
GO TO STEP 2
y(i)= δ (x1*w1+x2*w2+ θ);
δ(x)=1, if x > 0;
δ(x)=0, if x ≤ 0
e(i)= ydesired - y(i)
wj(i+1)=wj(i)+ *xj*e(i), j=1,2;
i:=i+1;
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.
[60 Marks]
Q5 b. Consider the XOR gate:
X1
X2
Y
0
0
0
1
0
1
0
1
1
1
1
0
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?
[25 Marks]
Q5 c. Describe the architecture of an adaptive neuro-fuzzy system that
can learn the behaviour described in the above rule base.
[15 Marks]
Download