Homework 1 Solution | Artificial Intelligence | CPSC 625, Assignments of Computer Science

Material Type: Assignment; Professor: Choe; Class: ARTIFICIAL INTELLIGNCE; Subject: COMPUTER SCIENCE; University: Texas A&M University; Term: Unknown 1989;

Typology: Assignments

Pre 2010

Uploaded on 02/10/2009

koofers-user-st8
koofers-user-st8 🇺🇸

10 documents

1 / 6

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CPSC 625-600 Homework #1 Solution
October 8, 2007
Yoonsuck Choe
October 9, 2007
1 Uninformed Search
B
EA C D
(a) Tree 1 (b) Tree 2 (c) Tree 3
Figure 1: Search Trees.
Consider the three search trees in Figure 1. Suppose the branching factor is band the tree is full. Suppose
branches are visited from the left to the right. Nodes A, B, C, D, and E the goal nodes in the trees. Assume
that nodes A, C, D, and E are at depth n; and A and C are the k-th node of their parents (i.e., they are
children of the left-most node at depth n1). Node B is at depth m(< n). Node D is the last node to the
right at depth n. Depth nis the last level of all the trees. Further assume that the exploration of each depth
level proceeds from the left to the right.
Question 1 (4 pts): If n > 2b, which one shows a case where both depth-first and breadth-first have
identical time complexity? (Tree 1, 2, 3, none, or any combination of the three)
Tree 1: DFS will visit n+k1nodes to reach node A. BFS will visit 1 + b+b2+... +bm
nodes to reach node B. If n+k1 = 1 + b+b2+... +bm, the answer is the time complexity
of DFS=BFS. In most cases, it will not be the case. Tree 3: DFS and BFS have the same time
complexity.
Question 2 (4 pts): Which one shows a case where depth-first can be complete but non-optimal? (Tree 1,
2, 3, none, or any combination of the three) Explain why.
Tree 1 is the only answer, becasue DFS finds (A) at depth n(thus it is complete, since it found
a goal), while there is a goal (B) at depth m < n, thus it is suboptimal.
Question 3 (4 pts): Assume b= 5,k= 2, and n= 7. What is the number of nodes visited in case of
Tree 2 for depth-first (and breadth-first)? Note that the “number of node visited” is defined as the number’
of goal checks.
1
pf3
pf4
pf5

Partial preview of the text

Download Homework 1 Solution | Artificial Intelligence | CPSC 625 and more Assignments Computer Science in PDF only on Docsity!

CPSC 625-600 Homework #1 Solution

October 8, 2007

Yoonsuck Choe

October 9, 2007

1 Uninformed Search

B

A C E D

(a) Tree 1 (b) Tree 2 (c) Tree 3

Figure 1: Search Trees.

Consider the three search trees in Figure 1. Suppose the branching factor is b and the tree is full. Suppose branches are visited from the left to the right. Nodes A, B, C, D, and E the goal nodes in the trees. Assume that nodes A, C, D, and E are at depth n; and A and C are the k-th node of their parents (i.e., they are children of the left-most node at depth n − 1 ). Node B is at depth m (< n). Node D is the last node to the right at depth n. Depth n is the last level of all the trees. Further assume that the exploration of each depth level proceeds from the left to the right.

Question 1 (4 pts): If n > 2 b, which one shows a case where both depth-first and breadth-first have identical time complexity? (Tree 1, 2, 3, none, or any combination of the three)

Tree 1: DFS will visit n + k − 1 nodes to reach node A. BFS will visit 1 + b + b^2 + ... + bm nodes to reach node B. If n + k − 1 = 1 + b + b^2 + ... + bm, the answer is the time complexity of DFS=BFS. In most cases, it will not be the case. Tree 3: DFS and BFS have the same time complexity.

Question 2 (4 pts): Which one shows a case where depth-first can be complete but non-optimal? (Tree 1, 2, 3, none, or any combination of the three) Explain why.

Tree 1 is the only answer, becasue DFS finds (A) at depth n (thus it is complete, since it found a goal), while there is a goal (B) at depth m < n, thus it is suboptimal.

Question 3 (4 pts): Assume b = 5, k = 2, and n = 7. What is the number of nodes visited in case of Tree 2 for depth-first (and breadth-first)? Note that the “number of node visited” is defined as the number’ of goal checks.

DFS = 7 − 1 + 2 = 6 + 2 = 8. BFS = 1 + 5 + 5^2 + ... + 5^6 + 2 = 19533.

Question 4 (4 pts): Assume b = 10, k = 3, m = 4, and n = 20. In which case does depth-first outperform breadth-first in terms of time complexity (= nodes visited)? (Tree 1, 2, 3, none, or any combination of the three)

Tree 1 and Tree 2.

  • Tree 1: DFS = 20 − 1 + 3 < BFS = 1 + 10 + ... + 10^3 + 3.
  • Tree 2: DFS = 20 − 1 + 3 < BFS = 1 + 10 + 10^2 + ... + 10^6 + 3.

2 Informed Search

Answer the following questions regarding informed search strategies.

A

b c

d e^ f

g h i

j k

l

m n

o

p

q

h=

h=

h=3 h=

h=

h=

h=

h=

h=

h=

h=

h=

h=

h=

h=

h=

h=

Figure 2: Search tree. An example search tree is shown with path cost on each edge and heuristic function value next to each node. The leaf nodes are goal states.

Question 1 (6 pts): Is the heuristic admissible? Explain why.

Yes, because at each node n, h(n) is less than the actual cost from n to the nearest goal (i.e. the sum of path cost from n to any of the closest goals).

Question 2 (6 pts): Given the search tree in figure 2, calculate the f (n) value for each node (A to q).

f (A) = 2, f (b) = 2 + 2 = 4, f (c) = 4 + 1.4 = 5. 4 , f (d) = 2 + 2 + 2 = 6, f (e) = 3 + 1.4 + 1 = 5. 4 , f (f ) = 6 + 1.4 + 2 = 9. 4 , f (g) = 4 + 2 + 2 + 1.4 = 9. 4 ,

3.2 α − β pruning

Question 1 (5 pts): Using the following figure 4, for each node, indicate the final utility value.

Question 2 (9 pts): For each cut that happens, draw a line to cross out that subtree.

MIN

MAX

MIN

MAX

MIN MIN

MAX MAX 10 6 −2^1

5

4

3 9

6

7

5 7

[−inf,inf] [−inf,inf]

[5,inf]

[5,6] [5,6]

[5,inf/6]

[−inf/5,inf]

[−inf,inf/5] [5,inf/6/−2]

[5/7,6]

[5,6] [5,inf]

[5,6]

[5,6]

[5,6]

[5,6] [5,6]

[5,6]

[alpha,beta]

to y, and then to z

x/y/z means x got updated

NOTATIONS

Figure 4: Game Tree. Solve using α − β pruning. This tree is the same as figure 3.

See figure 4.

4 Propositional Logic

4.1 Normal forms

In all of the problems in this section, show each step of the derivation and indicate which axioms (or other rules) you used: For example, distributive law, definition, etc.

Question 1 (4 pts): Convert ¬(P → ¬S) ∨ (¬(Q → R) ∧ S) into conjunctive normal form.

  1. ¬(¬P ∨ ¬S) ∨ (¬(¬Q ∨ R) ∧ S) : remove implication
  2. (P ∧ S) ∨ ((Q ∧ ¬R) ∧ S) : De Morgan
  3. (P ∨ (Q ∧ ¬R)) ∧ S: Distributive (in reverse)
  4. ((P ∨ Q) ∧ (P ∨ ¬R)) ∧ S: Distributive
  5. (P ∨ Q) ∧ (P ∨ ¬R) ∧ S: Associative

Question 2 (4 pts): Convert ¬T → (R ∧ (S → (P ∧ Q))) into disjunctive normal form.

  1. T ∨ (R ∧ (¬S ∨ (P ∧ Q))): remove implication
  2. T ∨ (R ∧ ¬S) ∨ (R ∧ P ∧ Q): distributive, and associative

Question 3 (4 pts): Convert (R ∧ S) → (Q → ¬(P ∧ ¬T )) into horn normal form. After that, show the equivalent expression with a single implication (→) and some conjunctions (∧).

  1. ¬(R ∧ S) ∨ (¬Q ∨ ¬(P ∧ ¬T )): remove implication
  2. (¬R ∨ ¬S) ∨ (¬Q ∨ (¬P ∨ T )): De Morgan
  3. ¬R ∨ ¬S ∨ ¬Q ∨ ¬P ∨ T : Associative
  4. (R ∧ S ∧ Q ∧ P ) → T : implication

4.2 Valid vs. inconsistent

Question 1 (5 pts): Show that (P ∧ Q) ∨ ¬(R ∧ ¬(P → ¬Q)) is valid.

  1. (P ∧ Q) ∨ (¬R ∨ (¬P ∨ ¬Q)): implication and De Morgan
  2. (P ∧ Q) ∨ (¬R ∨ ¬(P ∧ Q)): De Morgan
  3. (P ∧ Q) ∨ ¬R ∨ ¬(P ∧ Q): Associative
  4. ((P ∧ Q) ∨ ¬(P ∧ Q)) ∨ ¬R: Associative
  5. T rue ∨ ¬R = T rue

Question 2 (5 pts): Show that (P ∨ Q) ∧ ¬(¬Q → P ) is inconsistent.

  1. (P ∨ Q) ∧ ¬(Q ∨ P ) : implication
  2. (P ∨ Q) ∧ ¬(P ∨ Q) : commutative
  3. F alse

4.3 Theorem proving

Given:

  1. S ∨ ¬P
  2. ¬S ∨ R
  3. R → T
  4. (R ∧ S ∧ T ) → Q

show that P → Q is a logical consequence of the above using resolution. Precisely follow the steps below.

Question 1 (5 pts): Convert the above problem into a form that is suitable for resolution. This may involve converting some expressions into CNF, and other steps such as including the conclusion part (P → Q).

Negate conclusion: ¬(¬P ∨ Q) = P ∧ ¬Q

  1. S ∨ ¬P
  2. ¬S ∨ R
  3. ¬R ∨ T