PRIFYSGOL ABERYSTWYTH - ABERYSTWYTH UNIVERSITY
DEGREE EXAMINATIONS 2009-2010 SEMESTER 2
FACULTY OF SCIENCE
Computer Science, CS26210: The Artiﬁcial Intelligence Toolbox -
Part II: Programming in An Uncertain World , SPECIAL PAPER
Time allowed: 2 hours
Calculators are permitted, provided they are silent, self-powered, without
communications facilities, and incapable of holding text or other material that
could be used to give the candidate an unfair advantage. They must be made
available on request for inspection by invigilators, who are authorised to remove
any suspect calculators.
Answer THREE from FIVE questions.
Answer ONE question from Section A, ONE question from Section B.
All questions carry equal marks.
Answer at least ONE from TWO questions
1. This question is about the Prolog language.
a) Given the following Prolog facts, in this order,
state the ﬁrst answer that Prolog would give to each of these queries:
?- parent(’Ethel’, ’Chuffy’).
?- parent(X, ’Axel’).
?- parent(’Ethel’, X).
?- parent(X, Y).
b) Assuming that you use the ’;’ method of getting further answers until
failure, what would the full answers for part (a) be, in order? 
c) Given the extra fact,
write down a grandchild() relation and explain how you could use it to
ask Prolog about the relationships between Gubby and the people deﬁned
in part (a) of this question. 
Page 1 of 6 Turn over
d) Using recursion, deﬁne a relation called younger() that is true when a
person X is a younger descendant of a person Y. Explain how you intend
recursion to work in this context, and how Prolog would fully answer the
question, ?- younger(X,Y). for the facts in parts (a) and (c) above. 
e) Discuss whether this is the most eﬃcient way of searching for younger
family members. 
Page 2 of 6 Turn over
2. This question is about using Prolog to implement a basic AI concept, and
requires two short essay answers. The following code is taken from Bratko’s
book. It is a program for traversal of a tree by depth-ﬁrst search.
solve(Node, Solution) :-
depthfirst(, Node, Solution).
depthfirst(Path, Node, [Node|Path]) :-
depthfirst(Path, Node, Solution) :-
depthfirst([Node|Path], Node1, Solution).
edge(1, 2). % 1
edge(1, 3). % / \
edge(2, 4). % 2 3
edge(3,5). % | |
edge(5,6). % 4 5
goal(6). % |
% 6 <- goal
?- solve(1, Solution).
Solution = [6, 5, 3, 1]
a) Describe, in appropriate detail, how the program works, including a full
trace of the edges/nodes through which the program passes. Be sure to
explain the recursive nature of this program. 
b) The simple form of depth-ﬁrst search has a known problem that can be
illustrated as follows. If we were to add two new edge facts, ‘edge(5,4)’
and ‘edge(4,3)’, in that order, immediately before the ‘edge(5,6)’ fact,
what would happen when we tried to run the code, and how does this
illustrate the problem with depth-ﬁrst search? Explain, problem and
solution to the problem with both code and description, and show what
the results of your approach would be. 
Page 3 of 6 Turn over
Answer at least ONE from THREE questions
3. This question explores your understanding of knowledge representation and
a) (i) Discuss the purpose of knowledge representation in AI, and the
diﬀerent assumptions you are making about the world when you
deﬁne crisp, fuzzy and probabilistic representations of a problem. 
(ii) Explain the advantages and disadvantages of each type of
representation in part (i) of this question. 
(iii) Discuss, in appropriate detail, whether or not it would be a good idea
to combine all three representation approaches in part (i) of this
question, in some uniﬁed way, so that we could always use that
representation, whatever the problem. 
b) Imagine that you have just had a medical test for a nasty disease. The
doctor tells you that the test result indicates you have the disease. Test
always detects the disease when it is present, but falsely reports it is
present with an error rate of 1 in 20. Does this error rate mean that you
have a 95% chance of having the disease? Brieﬂy explain your answer. 
c) If the doctor then tells you that of the people tested only 1% actually have
the disease. Use this information to estimate your chance of having the
d) Suppose high temperatures are caused by the disease in 50% of cases, the
chance of getting the disease is 1 in 50,000, and the chance of getting a
high temperature is 1 in 20. Use Bayes rule to calculate the chance of
having the disease if you have a high temperature. Bayes rule is:
p(B|A) = p(A|B)p(B)/p(A)
Page 4 of 6 Turn over
4. The medical expert system MYCIN employs a method of inference based on
certainty factors (CFs).
a) Given the fact that you will develop a medical expert system, will you
adopt the certain factor theory to deal with the uncertain reasoning in
your medical expert system? Explain your answer. 
b) What is the domain of the certainty factor? What conclusion can we draw
about a hypothesis when its certainty factor approaches the extremes and
centre of the certainty factor’s domain? 
c) The following table (Table c) lists some uncertain terms and their
corresponding certainty factors. A fact is given about the description of
the sky. A rule is given about the association of the weather forecast and
the sky description. Both the rules and facts are expressed using uncertain
terms in the table.
Table c: Uncertain terms and their interpretation
Term Certainty factor
Deﬁnitely not -1.0
Almost certainly not -0.8
Probably not -0.6
Maybe not -0.4
Unknown -0.2 to +0.2
Almost certainly +0.8
RULE: IF the sky is clear, THEN the forecast is almost certainly sunny.
FACT: The sky is probably clear.
Answer the following questions:
(i) Represent the given rule and fact in the style that MYCIN uses. To
answer this question, you may need to consult the given table
(Table c) describing the uncertain terms and their corresponding
certainty factors. 
(ii) Given the above rule and fact, use the certainty factor theory to
calculate the certainty factor of the conclusion “the forecast is sunny”.
(iii) If the conclusion “the forecast is sunny ” derived in the question (ii)
above is presented using the uncertain terms described in Table c,
then what is the ﬁnal weather forecast? 
(iv) Discuss what beneﬁts Table c brings in the process of inferring the
weather forecast above. 
(v) If the premise of a rule consists of a conjunction of a large number of
diﬀerent facts, then what happens to the ﬁnal certainty factor of the
premise of the rule? How would you avoid this problem in certainty
factory theory? 
Page 5 of 6 Turn over
5. This question is about fuzzy sets and logic theory.
a) Consider the following two facts describing an income (high and low), and
two rules concluding the degree of risk in issuing a credit card to a
customer by a bank:
1. IF income is high, THEN risk is low
2. IF income is low, THEN risk is high
The following ﬁgure (Figure a) depicts the fuzzy sets about low income,
high income, low risk, and high risk. Assuming a customer has an income
of 22.5k, answer the following questions. Reading values oﬀ the graphs can
be approximate. Show the steps leading to the ﬁnal results.
0.5 Low High 0.5 Low High
0 5 10 15 20 25 30 35 40 Income(k) −15 20 40 60 80 100 Risk(%)
Figure a : Membership functions for diﬀerent fuzzy sets.
(i) What is the membership value of an income 22.5k relative to the fuzzy
sets low income and high income respectively? 
(ii) What is the membership value of an income 22.5k that belongs to
both the fuzzy sets low income and high income? 
(iii) What is the membership value of an income 22.5k that does not
belong to the fuzzy set low income? 
(iv) What risk (%) will the bank take if it issues a credit card to the
(v) If the risk is higher than 65%, then the bank will not issue the credit
card to any customer. In this case, will the bank issue a credit card to
a customer with an income of 22.5k? Explain your answer. 
b) What main strengths do fuzzy sets and logic theory have for solving
c) Brieﬂy discuss the main diﬀerence between certainty factory theory on the
one hand and fuzzy sets and logic theory on the other. Include and
explanation of how they represent the facts and rules in knowledge based
Page 6 of 6