ST Xaviers College Artificial Intelligence Dynamic Programming Project

User Generated

zvpunrynyyra

Computer Science

Description

1.

Consider the problem of finding a path in the grid shown in Figure 3.14 from the position ss to the position gg. A piece can move on the grid horizontally or vertically, one square at a time. No step may be made into a forbidden shaded area.

Figure 3.14: A grid-searching problem

(a)

On the grid shown in Figure 3.14, number the nodes expanded (in order) for a depth-first search from ss to gg, given that the order of the operators is up, left, right, and down. Assume there is cycle pruning. What is the first path found?

(b)

On a copy of the same grid, number the nodes expanded, in order, for a greedy best-first search from ss to gg. Manhattan distance should be used as the evaluation function. The Manhattan distance between two points is the distance in the xx-direction plus the distance in the yy-direction. It corresponds to the distance traveled along city streets arranged in a grid. Assume multiple-path pruning. What is the first path found?

(c)

On a copy of the same grid, number the nodes expanded, in order, for a heuristic depth-first search from ss to gg, given Manhattan distance as the evaluation function. Assume cycle pruning. What is the path found?

(d)

Number the nodes in order for an A∗A* search, with multiple-path pruning, for the same grid. What is the path found?

(e)

Show how to solve the same problem using dynamic programming. Give the cost_to_goal value for each node, and show which path is found.

(f)

Based on this experience, discuss which algorithms are best suited for this problem.

(g)

Suppose that the grid extended infinitely in all directions. That is, there is no boundary, but ss, gg, and the blocks are in the same positions relative to each other. Which methods would no longer find a path? Which would be the best method, and why?

2.

This question investigates using graph searching to design video presentations. Suppose there exists a database of video segments, together with their length in seconds and the topics covered, set up as follows:

Segment

Length

Topics covered

seg0

10

[welcome]

seg1

30

[skiing, views]

seg2

50

[welcome, artificial_intelligence, robots]

seg3

40

[graphics, dragons]

seg4

50

[skiing, robots]

Represent a node as a pair:

⟨To_Cover,Segs⟩,⟨T⁢o⁢_⁢C⁢o⁢v⁢e⁢r,S⁢e⁢g⁢s⟩,

where SegsS⁢e⁢g⁢s is a list of segments that must be in the presentation, and To_CoverT⁢o⁢_⁢C⁢o⁢v⁢e⁢r is a list of topics that also must be covered. Assume that none of the segments in SegsS⁢e⁢g⁢s cover any of the topics in To_CoverT⁢o⁢_⁢C⁢o⁢v⁢e⁢r.

The neighbors of a node are obtained by first selecting a topic from To_CoverT⁢o⁢_⁢C⁢o⁢v⁢e⁢r. There is a neighbor for each segment that covers the selected topic. [Part of this exercise is to think about the exact structure of these neighbors.]

For example, given the aforementioned database of segments, the neighbors of the node ⟨[welcome,robots],[]⟩⟨[w⁢e⁢l⁢c⁢o⁢m⁢e,r⁢o⁢b⁢o⁢t⁢s],[]⟩, assuming that welcomew⁢e⁢l⁢c⁢o⁢m⁢e was selected, are ⟨[],[seg2]⟩⟨[],[s⁢e⁢g⁢2]⟩ and ⟨[robots],[seg0]⟩⟨[r⁢o⁢b⁢o⁢t⁢s],[s⁢e⁢g⁢0]⟩.

Thus, each arc adds exactly one segment but can cover one or more topics. Suppose that the cost of the arc is equal to the time of the segment added.

The goal is to design a presentation that covers all of the topics in MustCoverM⁢u⁢s⁢t⁢C⁢o⁢v⁢e⁢r. The starting node is ⟨MustCover,[]⟩⟨M⁢u⁢s⁢t⁢C⁢o⁢v⁢e⁢r,[]⟩, and the goal nodes are of the form ⟨[],Presentation⟩⟨[],P⁢r⁢e⁢s⁢e⁢n⁢t⁢a⁢t⁢i⁢o⁢n⟩. The cost of the path from a start node to a goal node is the time of the presentation. Thus, an optimal presentation is a shortest presentation that covers all of the topics in MustCoverM⁢u⁢s⁢t⁢C⁢o⁢v⁢e⁢r.

(a)

Suppose that the goal is to cover the topics [welcome,skiing,robots][w⁢e⁢l⁢c⁢o⁢m⁢e,s⁢k⁢i⁢i⁢n⁢g,r⁢o⁢b⁢o⁢t⁢s] and the algorithm always select the leftmost topic to find the neighbors for each node. Draw the search space expanded for a lowest-cost-first search until the first solution is found. This should show all nodes expanded, which node is a goal node, and the frontier when the goal was found.

(b)

Give a non-trivial heuristic function hh that is admissible. [Note that h(n)=0h⁢(n)=0 for all nn is the trivial heuristic function.] Does it satisfy the monotone restriction for a heuristic function?

Unformatted Attachment Preview

1. Consider the problem of finding a path in the grid shown in Figure 3.14 from the position ss to the position gg. A piece can move on the grid horizontally or vertically, one square at a time. No step may be made into a forbidden shaded area. Figure 3.14: A grid-searching problem (a) On the grid shown in Figure 3.14, number the nodes expanded (in order) for a depth-first search from ss to gg, given that the order of the operators is up, left, right, and down. Assume there is cycle pruning. What is the first path found? (b) On a copy of the same grid, number the nodes expanded, in order, for a greedy best-first search from ss to gg. Manhattan distance should be used as the evaluation function. The Manhattan distance between two points is the distance in the distance in the xx-direction plus the yy-direction. It corresponds to the distance traveled along city streets arranged in a grid. Assume multiple-path pruning. What is the first path found? (c) On a copy of the same grid, number the nodes expanded, in order, for a heuristic depth-first search from ss to gg, given Manhattan distance as the evaluation function. Assume cycle pruning. What is the path found? (d) Number the nodes in order for an A∗A* search, with multiple-path pruning, for the same grid. What is the path found? (e) Show how to solve the same problem using dynamic programming. Give the cost_to_goal value for each node, and show which path is found. (f) Based on this experience, discuss which algorithms are best suited for this problem. (g) Suppose that the grid extended infinitely in all directions. That is, there is no boundary, but ss, gg, and the blocks are in the same positions relative to each other. Which methods would no longer find a path? Which would be the best method, and why? 2. This question investigates using graph searching to design video presentations. Suppose there exists a database of video segments, together with their length in seconds and the topics covered, set up as follows: Segment Length Topics covered seg0 10 [welcome] seg1 30 [skiing, views] seg2 50 [welcome, artificial_intelligence, robots] seg3 40 [graphics, dragons] seg4 50 [skiing, robots] Represent a node as a pair: ⟨To_Cover,Segs⟩,⟨T⁢o⁢_⁢C⁢o⁢v⁢e⁢r,S⁢e⁢g⁢s⟩, where SegsS⁢e⁢g⁢s is a list of segments that must be in the presentation, and To_CoverT⁢o⁢_⁢C⁢o⁢v⁢e⁢r is a list of topics that also must be covered. Assume that none of the segments in SegsS⁢e⁢g⁢s cover any of the topics in To_CoverT⁢o⁢_⁢C⁢o⁢v⁢e⁢r. The neighbors of a node are obtained by first selecting a topic from To_CoverT⁢o⁢_⁢C⁢o⁢v⁢e⁢r. There is a neighbor for each segment that covers the selected topic. [Part of this exercise is to think about the exact structure of these neighbors.] For example, given the aforementioned database of segments, the neighbors of the node ⟨[welcome,robots],[]⟩⟨[w⁢e⁢l⁢c⁢o⁢m⁢e,r⁢o⁢b⁢o⁢t⁢s],[]⟩, assuming that are welcomew⁢e⁢l⁢c⁢o⁢m⁢e was selected, ⟨[],[seg2]⟩⟨[],[s⁢e⁢g⁢2]⟩ and ⟨[robots],[seg0]⟩⟨[r⁢o⁢b⁢o⁢t⁢s],[ s⁢e⁢g⁢0]⟩. Thus, each arc adds exactly one segment but can cover one or more topics. Suppose that the cost of the arc is equal to the time of the segment added. The goal is to design a presentation that covers all of the topics in MustCoverM⁢u⁢s⁢t⁢C⁢o⁢v⁢e⁢r. The starting node is ⟨MustCover,[]⟩⟨M⁢u⁢s⁢t⁢C⁢o⁢v⁢e⁢r,[]⟩, and the goal nodes are of the form ⟨[],Presentation⟩⟨[],P⁢r⁢e⁢s⁢e⁢n⁢t⁢a⁢t⁢i⁢o⁢n⟩. The cost of the path from a start node to a goal node is the time of the presentation. Thus, an optimal presentation is a shortest presentation that covers all of the topics in MustCoverM⁢u⁢s⁢t⁢C⁢o⁢v⁢e⁢r. (a) Suppose that the goal is to cover the topics [welcome,skiing,robots][w⁢e⁢l⁢c⁢o⁢m⁢e,s⁢k⁢i⁢i⁢n ⁢g,r⁢o⁢b⁢o⁢t⁢s] and the algorithm always select the leftmost topic to find the neighbors for each node. Draw the search space expanded for a lowest-cost-first search until the first solution is found. This should show all nodes expanded, which node is a goal node, and the frontier when the goal was found. (b) Give a non-trivial heuristic function that hh that is admissible. [Note h(n)=0h⁢(n)=0 for all nn is the trivial heuristic function.] Does it satisfy the monotone restriction for a heuristic function?
Purchase answer to see full attachment
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Explanation & Answer

HI, here is your assignment ;). Let me know if you need another help okay ; )

Artificial Intelligence
Exercise 3.

Figure 3.14: A grid-searching problem
Part A:
Depth-first search

Here, we have the marked the first path

Part B:
A∗ search:
Here, assuming that those f -vale is same which been the last added to the
used queue.

Green (upper) numbers are the order and the purple (lower) numbers are
the f-vale.

Part C:
Dynamic Programming

The path fo...

Related Tags