99-exercises

advertisement
Exercise Set 1, 1999
CSE2309/3309/CSC2091/3091 Artificial Intelligence 1999
Exercise Set 1: Agents and Problem Solving
The following questions are taken from Russell and Norvig (as indicated) or from previous
years' exam papers or exercise sheets (with modifications to reflect this year's syllabus)
Exercise 1.1 (Heuristic functions) (from R&N 4.2)
Come up with heuristics for the following problems. Explain whether they are admissible,
and whether the state spaces contain local maxima with your heuristic:
(a) The general case of the chain problem (i.e. with an arbitrary goal state) from Ex 3.5.
(b) Path planning in the plane with rectangular obstacles (see also Ex 4.13).
Exercise 1.2 (Non-admissible heuristic functions) (R&N 4.6)
Invent a heuristic function for the 8-puzzle that sometimes overestimates and show how it
can lead to a suboptimal solution on a particular problem.
Exercise 1.3 (A*)
Consider the travelling salesperson problem:
A salesperson must visit each of n cities. There is a road between each pair of cities. Starting
at city #1, find the route of minimal distance that visits each of the cities only once and
returns to city #1.
Propose two (non-zero) h heuristic functions for this problem. Is either of the these h
functions a lower bound on h* ? Apply the algorithm A with these h functions to the 5 city
problem below:
7
10
10
7
13
6
9
10
5
6
Exercise 1.4 (A*)
The evaluation function f(n) = d(n) + W(n), where d(n) is the cost of arriving at node n and
W(n) is the number of misplaced tiles, is used in conjunction with the A* algorithm to search
from the start node (left) to the goal node (right):
Exercise Set 1, 1999
Start
Goal
2
8
3
1
6
4
8
5
7
7
1
2
3
4
6
5
Yielding the following search tree:
2 8 3 Start
1 6 4
7
5
4
6
5
6
8 3
2 1 4
7 6 5
2 8 3
1 6 4
7 5
2 8 3
1 4
7 6 5
2 8 3
7 1 4
6 5
7
Goal
5
4
2 8 3
1
4
7 6 5
5
2
3
1 8 4
7 6 5
6
2 8 3
1 4
7 6 5
5
2 3
1 8 4
7 6 5
7
2 3
1 8 4
7 6 5
5
1 2 3
8 4
7 6 5
1 2 3
8
4
7 6 5
2 8 3
1 6 4
7 5
6
1 2 3
7 8 4
6 5
7
Use this evaluation function to search backward from the goal node to the start node. Where
would the backward search meet the forward search?
Exercise 1.5 (General Search)
Each of the following search trees has a distinctive structure and order of expansion which
can be produced by a particular search procedure. For each tree write the name of the search
procedure which can generate it. The possible names are: breadth first search, depth first
search and A (with non-zero g and h). Where applicable, the nodes are labelled with the
order in which they are expanded.
(a)
1
2
5
3
6
(b)
4
1
6
2
3
(c)
4
1
2
5
3
4
Exercise Set 1, 1999
Exercise 1.6 (A, DFS)
Each node in the search tree below contains the estimated cost of finding a solution from
that node. The nodes with zero cost are goal nodes.
A
25
C
26
B
13
E
12
D
27
H
12
I
5
J
29
G
19
F
16
K
33
L
0
M
2
N
0
P
12
(a) For each iteration of algorithm A, show the lists OPEN and CLOSED. OPEN must be
ordered.
(b) How many nodes are expanded until the solution is found? How many are generated?
(c) If DFS is used, how many nodes are expanded until the solution is found? How many are
generated? (Expansion is performed from left to right)
Exercise 1.7 (Hill Climbing)
The diagram below depicts the cost of travelling between cities.
5
2
A
B
3
G
7
4
4
S
4
C
2
D
(a) Draw the search tree generated by the Hill-climbing procedure to reach the goal G
starting from S. Use the function f = cheapest road. What is the path? What is its cost?
(b) Draw the search tree generated by the GraphSearch procedure to reach the goal G
starting from S, using the following estimate of the cost from each node to the goal as a
heuristic function:
S
A
B
C
D
G
10
6
1
4
3
0
Indicate clearly the values of g, h, and f at each node. Also, indicate the order of expansion of
the nodes. What is the generated path? What is its cost?
Exercise 1.8
The game nim is played as follows: Two players alternate in removing one, two or three
coins from a stack initially containing 5 coins. The player who picks up the last coin loses.
Exercise Set 1, 1999
Show by drawing the game graph, that the player who has the second move can always
win. Can you think of a simple characterisation of the winning strategy?
Exercise 1.9 ()
Consider a game tree with branching factor 2 and depth 5. Assume that it is turn to play,
and that the evaluation function at the leaf nodes is in increasing order from left to right,
such that its value for the leftmost node is 1, and for the rightmost node is 16 (the leaf nodes
are MAX nodes).
Conduct an search of this game tree, starting from leftmost-node-first. In your tree,
clearly indicate the propagation of the and  values, the performed cut-offs and the
inspected leaf nodes.
Upon completion of the search, state the final backed-up value of the root node and the
recommended move (Left or Right). Also state the number of and  cut-offs performed,
and the number of leaf nodes generated.
Exercise 1.10
Consider the following game tree, where MAX plays in the square positions and MIN plays
in the circles.
7
6
8
5
2
3
0
-2
6
2
5
8
9
2
(a) Conduct an search of this game tree, starting from leftmost-node to determine which
move should MAX make. Draw the resulting game tree so that only the visited nodes
appear in your diagram, i.e. without the nodes that are cut off. Indicate clearly the backed
up values of each node, the updates performed on the backed up values, the cut-offs and
the  cut-offs you have performed.
Question 1 1996 Exam. History and Agent Structure
(Total 12 marks)
(a)
Name two influential figures in the field of AI who attended the Dartmouth College
workshop in the summer of 1956.
(2 marks)
(b)
Choose a domain that you are familiar with and write a PAGE (percept, action, goal,
environment) description of an agent for the environment.
(4 marks)
(c)
Characterise the environment as being (i) accessible or not, (ii) deterministic or not.
Explain your answers briefly.
(4 marks)
Exercise Set 1, 1999
(d)
What agent architecture is best for this domain and why?
(Reflex, logical, goal-based, or utility-based.)
Question 1 1995 Exam
(2 marks)
(Total 10 marks)
(a)
What is the difference between a performance measure and a utility function?(4 marks)
(b)
While driving a motor car, which of the following is the best policy? (Explain your answer
in terms of cost and computational effort.)
(4 marks)
(i)
Always put your turning indicator blinker on before turning
(ii)
Never use your blinker
(iii) Look in your mirrors and use your indicator only if you observe a car that can
observe you.
(c)
What kind of reasoning did you need to arrive at this driving policy?
(Logical, goal-based, or utility-based.)
(1 mark)
(d)
What kind of agent is necessary to carry out this policy?
(Reflex, goal-based, or utility-based.)
(1 mark)
Question 1 1997 Exam. Short Answers
(a)
Name two Artificial Intelligence researchers and describe their contribution to AI (in no
more than two lines for each) .
(4 marks)
(b)
Consider the following grid environment, where S is the start state and G is the goal state.
The arrows show possible movements between states, and there is a “wall” blocking some
transitions. For the purposes of a hill-climbing search algorithm, the goal state G has value
0.
G
S
Exercise Set 1, 1999
(i) What is the estimated value of the start state using the Manhattan distance to the goal as
the metric?
(ii) What is the estimated value of the start state using the shortest distance to the goal as the
metric?
(iii) Why does this start state cause a problem for a hill-climbing algorithm using the
Manhattan distance as the metric?
(4 marks)
Question 3 1995 Exam Robbie's World.
(Total 10 marks)
Robbie the robot works in the kitchen. It can move from one location to another; it also can carry food
from one location to another. There are three locations: the table, the stove and the refrigerator. Right
now, Robbie is near the table, the soup is on the stove, and the orange juice is in the refrigerator. We
would like to have both the soup and the orange juice on the table.
This question involves describing a problem formulation for this cooking domain.
(a)
Give the initial state.
(1 mark)
(b)
Give the operators. (These should be descriptions of the actions in terms of which state
will be reached by carrying out the action in a particular state.) (4 marks)
(c)
Give the goal test.
(1 mark)
(d)
Give the path cost function.
(1 mark)
(e)
One heuristic for estimating the path cost is the cost of an exact solution to a relaxed
problem (one with less restrictions on the operators). Describe such a relaxed problem and
such a heuristic. Is this heuristic for the path cost of the full problem admissible?
(3 marks)
Question 3. 1996 Exam. Search
(a)
(Total 20 marks)
A farmer is trying to cross a river with a fox, a chicken and a sack of grain. She has a
rowboat that he can use to carry at most one item at a time (plus herself) across the river.
Only the farmer can row the boat so she has to be with the boat in each of its trips across
the river. The farmer's problem is that she can't leave the fox alone with the chicken, or the
chicken alone with the sack of grain, at any time. For this question, you are to design a
state-space search approach to this problem.
(i) Design and describe an appropriate representation for a state in this search problem.
Show the initial state under your representation.
(2 marks)
(ii) Under your chosen representation, what is a goal state for the search problem?
(1 marks)
(iii) Give the operators in terms of the legal successors that will be reached by carrying out
the operator in the initial state.
(3 marks)
Exercise Set 1, 1999
(iv) In general, what conditions need to be checked when generating the legal successors
of a state?
(2 marks)
(b)
Recall the 8-puzzle, which was described in lectures. (Take the goal state to be the one
where the blank is in the centre, the 1 in the top left, and the numbers increasing clockwise
around the square.) Here is an initial state of that puzzle:
1
8
7
3
6
4
2
5
In A* search, the evaluation function is f(n) = g(n)+h(n), where h(n) is a heuristic
evaluation function based on the number of tiles out of position
(i) What is g(n)?
(2 marks)
(ii) Draw the search graph starting from the above initial state, and finishing when the
goal state is selected for expansion.
For each node in your diagram, indicate the value f of that node. Also indicate on your
graph the order in which nodes are selected for expansion using a circled number. For
example, the initial state above will be labelled with f = 7 and is the first node selected, so
it will have a circled 1 next to it.
Ensure that your graph is a proper search graph (in particular, it should not contain
duplicate nodes, although it may contain multiple paths to a node).(10 marks)
Question 4 1995 Exam
(Total 15 marks)
Consider a hypothetical game with branching factor 2. It is MAX's turn to play. She is able to
evaluate a position 4 steps in advance. The following is a list of the value of the positions at the
bottom of the game tree, if they ever need to be evaluated.
node# 1
e(n)
2
3
4
5
6
7
8
9 10 11 12 13 14 15 16
13 8 14 11 5
7
4
2 20 6
0 13 8 10 16 15
(a)
Draw a game tree, as evaluated by MAX using the  procedure, starting at the left-most
node first, so that only the expanded nodes appear in your diagram (i.e. without the nodes
that are cut off). Indicate clearly the backed-up value of each node and the updates
performed on the backup values.
(11 marks)
(b)
How many cut-offs have been performed?
(1 mark)
(c)
How many cut-offs have been performed?
(1 mark)
(d)
What is the best move for MAX and what is its backed-up value?
(2 marks)
Exercise Set 1, 1999
1997 Exam Question 2. Search
(10 marks total)
Consider a hypothetical game with branching factor 2. It is MAX's turn to play. She is able to
evaluate a position 3 steps in advance. The following is a list of the value of the positions at the
bottom of the game tree, in case they ever need to be evaluated.
node# 1
e(n)
2
3
4
5
6
7
8
8 12 20 30 10 5 25 2
(a) Draw a game tree, as evaluated by MAX using the  procedure starting at the left-most
node first, so that only the expanded nodes appear in your diagram (i.e. draw your diagram
without the nodes that are cut off).
(b) Clearly indicate the backed-up value of each node and the updates performed on these
values, the cut-offs and the cut-offs.
(c) What is the best move for MAX and what is its backed-up value?
Exercise Set 2, 1999
CSE2309/3309/CSC2091/3091 Artificial Intelligence 1999
Exercise Set 2: Knowledge Representation and Reasoning
The following questions are taken from Russell and Norvig or from previous exam papers or
exercise sheets. Working through them should help you study for the exam.
Exercise 2.1 (R&N 6.5)
Given the following can you prove that the unicorn is mythical? how about magical?
horned?
If the unicorn is mythical, then it is immortal, but if it is not mythical, then it is a mortal
mammal. If the unicorn is either immortal or a mammal, then it is horned. The unicorn is
magical if it is horned.
Exercise 2.2 (R&N 7.2)
Represent the following sentences in first-order logic, using a consistent vocabulary (which
you must define):
(a) Not all students take both History and Biology.
(b) Only one student failed History.
(c) Only one student failed both History and Biology.
(e) Every person who dislikes all vegetarians is smart.
(f) No person likes a smart vegetarian.
(g) There is a woman who likes all men who are not vegetarians.
(j) Politicians can fool some of the people all the time, and they can fool all of the people
some of the time, but they can't fool all of the people all of the time.
Exercise 2.3 (R&N 7.9)
Formalize the blocks world using situation calculus. The predicates are: On(x,y,s),
ClearTop(x,s), Block(x), Table(x).The only action is PutOn(x,y), where x
must be a block whose top is clear of any other blocks and y can be either the table or a
different block with a clear top. The initial situation s0 has A on B on C on the table.
(a) Write an axiom or axioms describing PutOn.
(b) Describe the initial state s0, in which there is a stack of three blocks, A on B on C, where
C is on the table, T.
(c) Give the appropriate query that a theorem prover can solve to generate a plan to build a
stack where C is on top of B and B is on top of A. Write down the solution that the
theorem prover shoujld return. (Hint: The solution will be a situation described as the
result of doing some actions to s0.)
(d) Show formally that the solution facts follows from your description of the situation and
the axioms for PutOn.
Exercise Set 2, 1999
Exercise 2.4 (R&N 7.10)
Write sentences to define the effects of the Shoot action in the Wumpus world. As well as
describing its effects on the Wumpus, remember that shooting uses the agent's arrow.
Exercise 2.5
Use the following vocabulary to express the assertions in the following sentences:
- male(x) means that the object denoted by x is male.
- female(x) means that x is female.
- vegetarian(x) means that x is a vegetarian.
- butcher(x) means that x is a butcher.
(a) No woman is both a butcher and a vegetarian.
(b) All women except butchers like vegetarians.
(c) The only vegetarian butchers are men.
(d) No woman likes a man who is a vegetarian.
(e) No man likes a woman who does not like all vegetarians.
Exercise 2.6
Indicate by writing CORRECT or INCORRECT, whether the following First-Order Predicate
Calculus sentences are correct representations of the corresponding English sentences.
(a) Everybody has a mother.
[(x) person(x) [(y)mother(y,x)]]
(b) Fido is an old dog.
(old(dog(Fido))
(c) Fido is an old dog.
dog(Fido) old(Fido)
(d) All methematical theories are true.
(e) Aristotle told a lie.
x [math-theory(x) x]
s [aristotle-said(s)  true(s)]
(f) There are no vegetarian butchers. vb[butcher(b) vegetarian(v)]
(g) No butcher owns a dog.
vd butcher(b) dog(d) owns(b,d)
Exercise 2.7
Consider the following statements:
(1)
All children have a favourite toy.
(2)
Whoever sleeps with a doll or a soft animal is a child.
(3)
Fuzzy is a soft animal.
(4)
Tom sleeps with Fuzzy.
(a) Using only the predicates child, favourite-toy, sleeps-with, doll and softanimal, represent these sentences in predicate calculus well formed formulas (wffs).
(b) Convert these FOPC sentences into Conjunctive Normal Form clauses.
(c) Use resolution to prove that Tom has a favourite toy. Indicate clearly the substitutions
you make.
Exercise Set 2, 1999
Exercise 2.8
Consider the following statements:
(1)
John likes all food.
(2)
Anything that one eats and isn't killed by is food.
(3)
Bill eats peanuts.
(4)
Bill is still alive.
(a) Represent these sentences as predicate calculus formulas.
(b) Convert these FOPC sentences into Conjunctive Normal Form clauses.
(c) Use resolution to prove that John likes peanutes. Indicate clearly the substitutions you
make.
Exercise 2.9
Consider the following statements:
(1)
A student is successful if s/he has high grades..
(2)
Students who are bright and work hard have high grades.
(3)
Students who are not bright fail CS3091.
(4)
Students who do not work hard have lots of fun.
(5)
Mary is not having any fun.
(6)
Mary passed CS3091.
(a) Represent these sentences as predicate calculus formulas. Do not include student as a
predicate, as it complicates the solution.
(b) Convert these FOPC sentences into Conjunctive Normal Form clauses.
(c) Use resolution to prove that Mary is a successful student. Indicate clearly the
substitutions you make.
Question 1 (1997 Exam). Short Answers
(c) Resolution in First-Order Predicate Calculus is a sound and complete inference procedure.
What does this mean in terms of a knowledge base?
(4 marks)
Question 5 (1995 Exam).
(b)
(Total 10 marks)
Answer each part with 1 or 2 sentences
Note: Answers without a justification are not sufficient.
(i) What is the Frame Problem?
(ii) What inference rule is used by forward and backward chaining? When would you
prefer forward chaining to backward chaining and vice versa?
Exercise Set 2, 1999
(iii) Is it always the case that either KB |= P or KB |= P for any knowledge base KB and
predicate P?
Question 6. (1995 Exam)
(Total 20 marks)
Consider the following statements:
(1)
All who can read are literate.
(2)
Dolphins are not literate.
(3)
Some dolphins are intelligent.
(4)
Some who are intelligent cannot read.
(a)
Using only the predicates read, literate, dolphin and intelligent, represent these
sentences in FOPC sentences.
(6 marks)
(b)
Convert these FOPC sentences into Conjunctive Normal Form clauses.
(c)
Use resolution to prove that sentence (4) follows from sentences (1), (2) and (3). Indicate
clearly the substitutions you make.
(8 marks)
(6 marks)
Question 4 1996 Exam. (Total 28 marks)
Consider the following statements:
(1)
A dragon is happy if all its children can fly.
(2)
Green dragons can fly.
(3)
A dragon is green if at least one of its parents is green and is pink otherwise.
(4)
Green dragons are happy.
(a)
Using only the predicates dragon, happy, fly, child, green and pink, represent
these sentences in First Order Predicate Calculus (FOPC) sentences.(8 marks)
(b)
Convert these FOPC sentences into Conjunctive Normal Form (CNF) clauses. (8 marks)
(c)
The following represents a simple knowledge base:
prereq(csc2030,csc3091)
x, y,z (passed(x,y) prereq(z,y) passed(x,z))
x (graduated(x) passed(x,csc3091))
graduated(john)
Before performing resolution, this needs to be converted to CNF. The result of this
operation (where variable names are subscripted since we need different variables in each
clause) give the following clauses:
(1) prereq(csc2030,csc3091)
(2) passed(x1,y1) v prereq(z1,y1) v passed(x1,z1)
(3) graduated(x2) v passed(x2,csc3091)
(4) graduated(sally)
Exercise Set 2, 1999
Use resolution to prove that Sally must have passed csc2030. At each step of the refutation,
indicate the clause used for that step by writing down its number, and indicate clearly the
substitutions you make.
(10 marks)
Exercise Set 3
CSE2309/3309/CSC2091/3091 Artificial Intelligence 1999
Exercise Set 3: Planning; Uncertain Reasoning; Learning
The following questions are taken from Russell and Norvig or other texts (as indicated) or from
previous years' exam papers or exercise sheets (with modifications to reflect this year's
syllabus)
Exercise 3.1 (R&N 11.2)
Let us consider a version of the milk/banana/drill shopping problem in which money is
included, at least in a simple way.
(a) Let CC denote a credit card that the agent can use to buy any object. Modify the
description of buy so that the agent has to have its credit card in order to buy anything.
(b) Write a pickUp operator that enables the agent to have an object if it is portable and at
the same location as the agent.
(c) Assume that the credit card is at home, but have(CC) is initially false. Construct a
partially ordered plan that achieves the goal, showing both ordering constraints and
causal links.
(d) Explain in detail what happens during the planning process when the agent explores a
partial plan in which it leaves home without the card.
Exercise 3.2 (R&N 11.7)
Here is a version of Shakey's word consisting of four room lined up along a corridor, where each room has
a door and a light switch. Shakey can move from place to place, push moveable objects (such as boxes),
climb on and off of rigid objects (such as boxes), and turn light switches on and off.
Ls = lightswitch
Ls4
Room 4
Door 4
Ls3
Room 3
Door 3
Corridor
Ls2
Room 2
Bo x3
Room 1
Bo x4
Door 2
Bo x2
Ls1
Door 1
Bo x1
Exercise Set 3
Suppose that:
• There is a predicate at giving Shakey's current location, at(Shakey,x) where x is a
box, a light switch, a door.
• There is a predicate in(x, roomX) where x is a box, a light switch, or a door. Shakey
can move to somewhere that is in the same room. To allow Shakey to plan a route
from room to room, we will say that the door between two rooms is in both of them.
• There are constants for
the rooms (room1,room2,room3,room4),
the doors (door1,door2, door3,door4),
the boxes (box1,box2,box3,box4),
the floor,
the initial and final locations of box2 (box2start,box2end).
• There is a predicate on, and that it is a precondition of Shakey moving from the current
location to another location that Shakey is on the floor.
• Because Shakey is short, Shakey can only turn a light switch on or off if Shakey is on
top of a box that is at the light switch's location.
In this exercise, we will look at planning in Shakey's world.
(a) Describe Shakey's six actions in situation calculus notation.
(b) Translate them into the STRIPS language.
(c) Construct a plan for Shakey to get box2 into room2 from the starting configuration in the
following figure.
(d) Suppose Shakey has n boxes in a room and needs to move them all into another room.
What is the complexity of the planning process in terms of n?
Exercise 3.3 (R&N 14.3)
After your yearly check-up, the doctor has bad news and good news. The bad news is that
you tested positive for a serious disease, and that the test if 99% accurate (i.e., the
probability of testing positive given that you have the disease is 0.99, as is the probability of
testing negative given that you don't have the disease). The good news is that this is a rare
disease, striking only one in 10,000 people. Why is it good news that the disease is rare?
What are the chances that you actually have the disease?
Exercise 3.4 (R&N 14.12)
Three prisoners, A, B and C, are locked in their cells. It is common knowledge that one of
them will be executed the next day and the others pardoned. Only the governor knows
which one will be executed. Prisoner A asks the guard a favour: "Please ask the governor
who will be executed, and then take a message to one of my friends B and C to let him know
that he will be pardoned in the morning.' The guard agrees, and comes back later and tells A
that he gave the pardon message to B. What are A's chances of being executed, given this
information?
Exercise Set 3
Exercise 3.5 (R&N 15.1)
For 15.1(a) In case you don't know much about cars (I don't!) , assume that icy weather affects
the petrol (frozen fuel line) and the battery; the starter motor is what the battery causes to turn
over, which in turn results in ignition of the engine.
Exercise 3.6 (R&N 15.3)
Exercise 3.7
Suppose that a patient turns up with a cough. This cough can either be a symptom of bronchitis
or lung cancer. Factors which the doctor may take into account include the results of an x-ray (if
it is cancer, the x-ray will be positive 95% of the time, and if there is no cancer the x-ray will
always be negative), and whether or not the patient is a smoker or not (twice as many smokers
as non-smoker will have cancer). Model this diagnosis problem in a Belief network with
Boolean variables for smoker, cancer, +ve-Xray, bronchitis, and cough.
Exercise 3.8 (R&N 18.3)
Draw a decision tree for deciding whether or not to move forward at a road intersection given
that the light has just turned green?
Exercise Set 3
Exercise 3.9: Robot Cleaner Problem (taken from Dean, Allen and Aloimones "Artificial
Intelligence: Theory and Practice")
Suppose we have a cleaner robot that roams the top three floors of a university building
collecting trash and looking for recyclable materials. The robot is trying to learn which offices
have recycling bins. For a given office it might know the following information: the status of its
occupants; the floor that the office is located on; the department that its occupants are
associated with; the size of the office. The possible values of these attributes are as follows.
Attribute
Values
Status
{academic, general, student}
floor
{three, four, five)
department {ee, cs}
size
{large, medium, small}
Suppose we have the following training set.
Room#
status
floor
dept
307
academic three
ee
309
general
three
ee
408
academic four
cs
415
student
four
ee
509
general
five
cs
517
academic five
cs
316
student
three
ee
420
general
four
cs
size
large
small
medium
large
medium
large
small
medium
recycling bin?
no
no
yes
yes
no
yes
yes
no
(a) Develop a decision tree, D1, for the problem starting with the attributes size and
department. How useful is this for generalizing to new examples? For instance, what does
it tell us about medium-sized offices housing ee students?
(b) Develop a two-node decision tree, D2, for the problem (i.e. a decision tree that only uses 2 of
the 3 attributes) with the attributes status and department. Show the decision tree with
the examples at the leaves after the first attribute has been chosen, and then again after the
second attribute has been chosen. Finally, re-draw the decision tree with just the class names
at the leaves.
(c) Describe a test example for which both D1 and D2 give the correct classification. Can you
find a second test example for which one of the decision trees gives the correct classification
and one gives the wrong classification? Use the following format to describe your test
examples.
Test room status
floor
dept
size
recycling bin?
Exercise Set 3
Also: Russell and Norvig: 19.1, 19.3, 19.6
Exercise Set 3
1996 Question 5. Representation and Planning
(Total 30 marks)
A copier in an office building is not working and the robot is given the goal of fixing it. Suppose that the
only reasons for the copier not working are that (1) its paper storage tray is empty, (2) its replaceable
cartridge is spent, i.e. in need of replacement, or (3) it experienced some momentary hardware or software
problem and needs to be reset . The standard practice for fixing the copier is to fill the paper tray if it is
empty, replace the cartridge if necessary, and then reset the machine. To fill the paper tray, the tray must
be empty, the robot must be at the copier, and the robot must have some paper. To replace the cartridge,
the cartridge must be spent, the robot must be at the copier, and the robot must have a replacement
cartridge. To reset the machine, the paper tray must not be empty, and the cartridge must not be spent.
The vocabulary you will use includes the predicates emptyTray, atCopier, hasPaper,
spentCartridge, hasCartridge, and working. The actions are fill, replace, and
reset .
(a)
Describe the domain, in situation calculus notation, including the frame rules and the goal,
as well as the results of all 4 actions.
(10 marks)
(b)
Describe the domain using STRIPS operators, one for each action. (8 marks)
(c)
Suppose that the robot comes to repair the copier and finds that it is not working because
the tray is empty, but the cartridge is fine. Construct a plan to achieve the goal using these
STRIPS operators and a partial order planner. Show the causal and temporal links in the
final plan. Be sure to include the preconditions and effects in your diagram. For each
temporal link, describe the clobbering situation (causal link and clobberer) that it is
avoiding. Then redraw the plan, showing only the final execution partial order. Here is an
outline of the plan you will draw.
(8 marks)
Start
fill
replace
reset
Finish
(d)
Explain, in no more than 4 lines, the relative advantages and disadvantages of using
situation calculus and STRIPS for describing planning problems?
(4 marks)
Exercise Set 3
Question 3 1998 Exam. Planning
(Total 24 marks)
Consider the design of a robot that can service bicycles. Among the many different tasks the robot needs
to be able to carry out is servicing the chain. This mainly involves having to clean and oil the chain,
which may require it to be removed from the bike.
The following STRIPS planning operators are used for removing and re-attaching chains to and from
bikes:
OP(ACTION: remove(Y,X)
PRECOND: bike(X), chain(Y), attached(Y,X)
EFFECT: attached(Y,X), unattached(Y)
)
OP(ACTION: attach(Y,X)
PRECOND: bike(X), chain(Y), unattached(Y)
EFFECT: attached(Y,X), unattached(Y)
)
Further operators are required for clean and oil. There are a number of conditions these operators
must satisfy.
1.
2.
3.
4.
(a)
We should only clean a chain if it is dirty and if it is not attached to anything.
After cleaning a chain, it is wet and no longer dirty.
A chain is oiled while it is attached to the bike.
Before we oil a chain it must be both clean and dry (i.e. not dirty and not wet).
Write planning operators for the clean and oil actions, using the STRIPS notation. Besides the
predicates used in the remove and attach operators, you’ll probably find predicates such as
wet, dirty and oiled useful.
(6 marks)
(b)
Starting with the initial state:
{bike(b), chain(c), attached(c,b), dirty(c)}
show how a partial-order planner would construct a partial-order plan for oiling the chain. That
is, finishing with the goal state:
{bike(b), chain(c), oiled(c)}.
Here is an outline of the plan you will draw.
Start
remove(c,b)
clean(c)
oil(c)
attach(c,b)
Finish
(Question 3b continued on next page)
(i)
Draw the final plan showing the causal and temporal links. Be sure to include the
preconditions and effects in your diagram.
(10 marks)
(ii)
At some stage you will run into a problem that prevents you from constructing a
complete plan - what is this problem and what do you need to do to remove it? (Just
describe briefly, in a couple of lines, what is needed to fix the problem).(4 marks)
Exercise Set 3
(c)
Give a definition of the Frame Problem and describe briefly (in a few lines) how the STRIPS
planning system handles this problem.
(4 marks)
Question 1 1997 Exam. Short Answers
(e) Draw a diagram of a simple feed-forward neural network with hidden nodes. What are
networks without hidden units called?
(4 marks)
Question 5 1998 Exam. Learning
(Total 24 marks)
Suppose we have a group of 8 people who can be described by three attributes, height, hair colour and
eye colour. The possible values of these attributes are as follows.
Attribute
Height
Hair
Eye
Values
{tall, short}
{dark, red, fair)
{blue, brown}
The training set is as follows:
Example
X1
X2
X3
X4
X5
X6
X7
X8
Class
+
+
+
-
Height
short
tall
tall
short
tall
tall
tall
short
Hair
fair
fair
red
dark
dark
fair
dark
fair
Eyes
blue
brown
blue
blue
blue
blue
brown
brown
(d)
Develop a two-node decision tree, D, for the problem (i.e. a decision tree that only uses 2 of the
3 attributes). Choose the attributes carefully, since if you choose the wrong attribute as one of
the two attributes, you won’t be able to develop a two-node decision tree. Show the decision tree
with the examples at the leaves after the first attribute has been chosen, and then again after the
second attribute has been chosen. Finally, re-draw the decision tree with just the class names at
the leaves.
(18 marks)
(e)
Describe TWO new test examples, such that for one example, D gives the correct classification,
while for the second example, it gives the wrong. Use the following format to describe your test
examples. Note that Y1 should not be exactly the same as any of the X1 to X8original data items.
(6 marks)
Test
Examples
Y1
Y2
Class
Height
Hair
Eyes
D
correct?
YES
NO
Download