Docsity

Solutions to Homework 1 - Artificial Intelligence | CAP 4621, Assignments of Computer Science

Toggle sidebar
bg1
CAP 4621 – Solutions to HW 1
3.7 (d) Initial state: Any state where jug 1 has between 0 and 12 gallons of water, jug 2 has between 0
and 8 gallons of water, and jug 3 has between 0 and 3 gallons of water. One possible initial
state is that all 3 jugs are empty.
Goal test: One of the jugs has exactly one gallon of water.
Successor function: This returns states obtained by empty jug onto ground or pouring contents
of one jug into another or filling a jug
Path cost: The number of pouring operations performed
(You can also express the states in the form of a 3-tuple where the tuple attribute is the volume
of water in each jug and choose an appropriate formulation)
3.8 (a)
b) Breadth-first search: 1,2,3,4,5,6,7,8,9,10,11
Depth-limited search with limit=3: 1,2,4,8,9,5,10,11
Iterative deepening search: Limit 0: 1
Limit 1: 1,2,3
Limit 2: 1,2,4,5,3,6,7
Limit 3: 1,2,4,8,9,5,10,11
4.3 ) In order to prove that a search strategy reduces to another, it is enough to show that the
order in which nodes are expanded is the same, since the only difference between them
is the expansion order.
(a) Breadth-first search is a special case of uniform-cost search when all step costs are equal
or when step cost is an increasing function of depth.
(b) Special cases of best-first search:
Breadth-first search: h(n) = depth of the node
Depth-first search: h(n) = -depth of the node
1
2
3
4
5
6
7
8
9
10 11 12 13 14 15
pf2

Partial preview of the text

Download Solutions to Homework 1 - Artificial Intelligence | CAP 4621 and more Assignments Computer Science in PDF only on Docsity!

CAP 4621 – Solutions to HW 1

3.7 (d) Initial state: Any state where jug 1 has between 0 and 12 gallons of water, jug 2 has between 0 and 8 gallons of water, and jug 3 has between 0 and 3 gallons of water. One possible initial state is that all 3 jugs are empty. Goal test: One of the jugs has exactly one gallon of water. Successor function: This returns states obtained by empty jug onto ground or pouring contents of one jug into another or filling a jug Path cost: The number of pouring operations performed

(You can also express the states in the form of a 3-tuple where the tuple attribute is the volume of water in each jug and choose an appropriate formulation)

3.8 (a)

b) Breadth-first search: 1,2,3,4,5,6,7,8,9,10, Depth-limited search with limit=3: 1,2,4,8,9,5,10, Iterative deepening search: Limit 0: 1 Limit 1: 1,2, Limit 2: 1,2,4,5,3,6, Limit 3: 1,2,4,8,9,5,10,

4.3 ) In order to prove that a search strategy reduces to another, it is enough to show that the order in which nodes are expanded is the same, since the only difference between them is the expansion order.

(a) Breadth-first search is a special case of uniform-cost search when all step costs are equal or when step cost is an increasing function of depth.

(b) Special cases of best-first search: Breadth-first search: h(n) = depth of the node Depth-first search: h(n) = -depth of the node

Uniform-cost search: h(n) = cost of the path so far = g(n)

(c) Uniform-cost search is a special case of A* search when h(n)=0 or h(n)=g(n). Then, we have A* search reducing to f(n)=g(n) which is effectively a uniform-cost search.

Lemma: Proof by contradiction is as follows: Let n, n^1 be nodes and suppose A* encounters n first and that f(n)>f(n^1 ) (i.e. we have a situation in which A* expands nodes in decreasing order of f on a path).

This gives us

f(n) > f(n^1 ) f(n)=g(n) +h(n), f(n^1 )=g(n^1 ) +h(n^1 ) Therefore, we have g(n) +h(n) >g(n^1 ) +h(n^1 ) Also, by definition of g(n) we must have g(n^1 ) = g(n) + c(n, n^1 ) (c is the actual cost from n to n^1 ) g(n) +h(n) > g(n) + c(n, n^1 ) +h(n^1 ) h(n) > c(n, n^1 ) +h(n^1 )

This result here is a direct contradiction of consistency.