Docsity

Logic Programming and Artificial Intelligence: Solutions to Problem Sheet 1, Study notes of Computer Numerical Control

Toggle sidebar
bg1
Logic Programming and Artificial Intelligence
27 January 2010
Solutions to LPA Problem Sheet 1
1. (a) The following procedure takes two parameters: G, the graph to be coloured and
K, the number of colours. It tries to colour the graph using as colours the integers
1..K.
Procedure COLOUR(G,K)
if all nodes of G are coloured then return TRUE
let V be any uncoloured vertex of G
for C := 1 to K do
if no neighbor of V is coloured with C
then begin
colour V with C
if COLOUR(G,K) then return TRUE
end
return FALSE
(b) O(kn), where nis the number of edges in the graph
(c) The graph-colouring problem is one of the best-known NP-complete problems; see,
for example, the algorithms book by Cormen, Leiserson and Rivest. Therefore, no
polynomial-time algorithm is known. One exists if and only if P=NP.
2. Consider the following truth table:
row l e n u l ⇒e n ⇒u(l⇒e)∧
(n⇒u)
l⇒u n ⇒e(l⇒u)∨
(n⇒e)
entire
sentence
1 F F F F T T T T T T T
2 F F F T T T T T T T T
3 F F T F T F F T F T T
4 F F T T T T T T F T T
5 F T F F T T T T T T T
6 F T F T T T T T F T T
7 F T T F T F F T T T T
8 F T T T T T T T T T T
9 T F F F F T F F T T T
10 T F F T F T F T T T T
11 T F T F F F F F F F T
12 T F T T F T F T F T T
13 T T F F T T T F T T T
14 T T F T T T T T T T T
15 T T T F T F F F T T T
16 T T T T T T T T T T T
The formula is true in every assignment, so it is a tautology.
3. (a) Performance measure: number of successful tackles, number of goals scored,
number of successful passes, -(number of cards), etc.
Environment: football pitch, football players, referee, ball
Actuators: body. Depending on robot design this may be legs or wheels, arms,
head, motors, etc.
Sensors: camera(s), touch sensor.
(b) The environment is
•partially observable (you can only see one part of the pitch at a time)
•stochastic (other players and the ball move around)
•episodic from game to game (unless you are playing in a tournament or league),
and sequential within a game
1
pf2

Partial preview of the text

Download Logic Programming and Artificial Intelligence: Solutions to Problem Sheet 1 and more Study notes Computer Numerical Control in PDF only on Docsity!

Logic Programming and Artificial Intelligence

27 January 2010

Solutions to LPA Problem Sheet 1

1. (a) The following procedure takes two parameters: G, the graph to be coloured and

K, the number of colours. It tries to colour the graph using as colours the integers

1..K.

Procedure COLOUR(G,K)

if all nodes of G are coloured then return TRUE

let V be any uncoloured vertex of G

for C := 1 to K do

if no neighbor of V is coloured with C

then begin

colour V with C

if COLOUR(G,K) then return TRUE

end

return FALSE

(b) O(kn), where n is the number of edges in the graph

(c) The graph-colouring problem is one of the best-known NP-complete problems; see,

for example, the algorithms book by Cormen, Leiserson and Rivest. Therefore, no

polynomial-time algorithm is known. One exists if and only if P=NP.

2. Consider the following truth table:

row l e n u l ⇒ e n ⇒ u (l ⇒ e)∧ (n ⇒ u)

l ⇒ u n ⇒ e (l ⇒ u)∨ (n ⇒ e)

entire sentence 1 F F F F T T T T T T T 2 F F F T T T T T T T T 3 F F T F T F F T F T T 4 F F T T T T T T F T T 5 F T F F T T T T T T T 6 F T F T T T T T F T T 7 F T T F T F F T T T T 8 F T T T T T T T T T T 9 T F F F F T F F T T T 10 T F F T F T F T T T T 11 T F T F F F F F F F T 12 T F T T F T F T F T T 13 T T F F T T T F T T T 14 T T F T T T T T T T T 15 T T T F T F F F T T T 16 T T T T T T T T T T T

The formula is true in every assignment, so it is a tautology.

3. (a) Performance measure: number of successful tackles, number of goals scored,

number of successful passes, -(number of cards), etc.

Environment: football pitch, football players, referee, ball

Actuators: body. Depending on robot design this may be legs or wheels, arms,

head, motors, etc.

Sensors: camera(s), touch sensor.

(b) The environment is

• partially observable (you can only see one part of the pitch at a time)

• stochastic (other players and the ball move around)

• episodic from game to game (unless you are playing in a tournament or league),

and sequential within a game

• dynamic (the ball may move while the agent is deliberating)

• continuous

• multi-agent (there are other players)

4. Stuart Russell studied physics at Oxford.