Logic Programming and Artifical Intelligence, Lecture Notes - Computer Science 8, Study notes of Computer Numerical Control

Logic programming and Artificial Intelligence

Typology: Study notes

2010/2011

Uploaded on 09/10/2011

myohmy
myohmy 🇬🇧

4.8

(10)

297 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Logic Programming and Artificial Intelligence
17 May 2011
Problem Sheet 8
Due: 17:15, 24 May 2011
1. [14 marks] (from Exercise 3.1 of Nilsson’s Principles of Artificial Intelligence) Consider a sliding
block puzzle with the following initial configuration:
B B B W W W E
There are three black tiles (B), three white tiles (W), and an empty cell (E). The puzzle has the
following moves:
A tile may move into an adjacent empty cell with unit cost.
A tile may hop over at most two other tiles into an empty cell with a cost equal to the number
of tiles hopped over.
The goal of the puzzle is to have all of the white tiles to the left of all of the black tiles (without
regard for the position of the blank cell).
We shall use the obvious representation for this problem: the states and operators of the represen-
tation correspond directly to the configurations and moves of the puzzle.
(a) [4 marks] Specify a heuristic function, h, for this problem.
(b) [8 marks] Show the search tree that is grown by Asearch using your heuristic function. Assume
that the algorithm halts when the first goal is found. Label each node in tree by its f,g, and
hvalues, and number the nodes to indicate the order in which they are removed from the list
of nodes. Do not include any cycles in your search tree. If your search tree does not fit on a
single sheet of paper, then your heuristic function is not good enough; find a better one.
(c) [2 marks] Argue convincingly either that your heuristic function is admissible or that it is not
admissible.
2. [4 marks] Consider the following search space, in which every state is shown as a box containing the
name of the state. To the right of every state nis shown the value of h(n), the estimated distance
from state nto the nearest goal. A is the initial state, and G and H are goal states.
[A]8
/ \
/ \
3/ \3
/ \
/ \
/ \
[C]5 [B]6
/ \ |
2/ \3 |2
/ \ |
/ \ |
[D]5 [E]2 [F]2
/ \ |
7/ \2 |5
/ \ |
/ \ |
[G]0 [J]1 [H]0
(a) [3 marks] Show how each of the following search methods finds a solution in search space by
writing down, in order, the names of the nodes removed from the list of states. Assume that
the search halts when a goal state is removed from the list.
(i) Uniform-cost search
(ii) Greedy best-first search
(iii) Asearch
(b) [1 mark] Name every node in the search space for which hproduces an overestimate.
1
pf2

Partial preview of the text

Download Logic Programming and Artifical Intelligence, Lecture Notes - Computer Science 8 and more Study notes Computer Numerical Control in PDF only on Docsity!

Logic Programming and Artificial Intelligence 17 May 2011 Problem Sheet 8 Due: 17:15, 24 May 2011

  1. [14 marks] (from Exercise 3.1 of Nilsson’s Principles of Artificial Intelligence) Consider a sliding block puzzle with the following initial configuration:

B B B W W W E

There are three black tiles (B), three white tiles (W), and an empty cell (E). The puzzle has the following moves:

  • A tile may move into an adjacent empty cell with unit cost.
  • A tile may hop over at most two other tiles into an empty cell with a cost equal to the number of tiles hopped over.

The goal of the puzzle is to have all of the white tiles to the left of all of the black tiles (without regard for the position of the blank cell). We shall use the obvious representation for this problem: the states and operators of the represen- tation correspond directly to the configurations and moves of the puzzle.

(a) [4 marks] Specify a heuristic function, h, for this problem. (b) [8 marks] Show the search tree that is grown by A∗^ search using your heuristic function. Assume that the algorithm halts when the first goal is found. Label each node in tree by its f , g, and h values, and number the nodes to indicate the order in which they are removed from the list of nodes. Do not include any cycles in your search tree. If your search tree does not fit on a single sheet of paper, then your heuristic function is not good enough; find a better one. (c) [2 marks] Argue convincingly either that your heuristic function is admissible or that it is not admissible.

  1. [4 marks] Consider the following search space, in which every state is shown as a box containing the name of the state. To the right of every state n is shown the value of h(n), the estimated distance from state n to the nearest goal. A is the initial state, and G and H are goal states. [A] /
    /
    3/
    /
    /
    /
    [C]5 [B] / \ | 2/ \3 | / \ | / \ | [D]5 [E]2 [F] / \ | 7/ \2 | / \ | / \ | [G]0 [J]1 [H]

(a) [3 marks] Show how each of the following search methods finds a solution in search space by writing down, in order, the names of the nodes removed from the list of states. Assume that the search halts when a goal state is removed from the list. (i) Uniform-cost search (ii) Greedy best-first search (iii) A∗^ search (b) [1 mark] Name every node in the search space for which h produces an overestimate.

  1. [3 marks]

(a) [1 mark] Let C be a constraint on three variables, each of which is associated with a finite domain. Define precisely what it means for C to be (generalized) arc-consistent? (b) [2 marks] The constraint alldifferent applied to a list of variables is satisfied if and only if every variable in the list is assigned a different value. Consider three variables: X with do- main {a, b, c}, Y with domain {b, c} and Z with domain {b, c}. What, if any, values must be pruned from the domains of X, Y and Z in order to make the constraint alldifferent([X, Y, Z]) (generalized) arc-consistent?

  1. [6 marks]

(a) [1 mark] Define precisely what it means for a set of constraints to be (generalized) arc- consistent? (b) [2 marks] Consider a finite domain constraint satisfaction problem in which there are four variables—X,Y , W and Z—each of which has the domain { 1 , 2 , 3 }, and the following con- straints: a) X + Y + Z ≤ 6 b) X + W = 3 c) X 6 = Y d) W 6 = Z e) odd(W ) Show the domains of the variables after making this problem node consistent. (c) [3 marks] Now take this node-consistent problem, make it arc-consistent, and show the resulting domains of the variables.

  1. Consider the cryptarithmetic problem of assigning a distinct digit (i.e., 0 through 9) to each of the eight letters, S, E, N, D, M, O, R and Y, so that R is assigned 8 and the following addition is correct.

S E N D

  • M O R E

M O N E Y

It is assumed that the leftmost digits (S and M) are not 0, otherwise they would not be written.

(a) [4 marks] Formulate this puzzle as a constraint satisfaction. problem. (Hint: give the variables, their domains, and the constraints.) (b) [1 marks] Now change the domains of the variables to make the problem formulation node consistent. (c) [4 marks] Using the node-consistent formulation, change the domains of the variables to make the problem formulation arc consistent. (d) Now consider using forward checking to solve this node and arc consistent problem. i. [2 marks] Choose the variable ordering method that you will use and briefly justify your choice. ii. [2 marks] Choose the value ordering method that you will use and briefly justify your choice. iii. [8 marks] Show the part of the search space that forward checking generates before finding a solution. At each node show the domains of all uninstantiated variables. (You can stop if the search space grows too large to fit on a page.)