• 沒有找到結果。

Artificial Intelligence 2007 Spring Homework 2

N/A
N/A
Protected

Academic year: 2022

Share "Artificial Intelligence 2007 Spring Homework 2"

Copied!
7
0
0

加載中.... (立即查看全文)

全文

(1)

Artificial Intelligence 2007 Spring Homework 2

Due date: March 29, 2007 April 10, 2007

1. AIMA[4.1]

Trace the operation of the A* search algorithm applied to the problem of getting to Bucharest from Lugoj using the straight-line distance heuristic.

That is, show the sequence of nodes that the algorithm will consider and the f , g, and h score for each node.

Ans.

The steps using TREE-SEARCH are shown below as Figure 1 to Fig- ure 11. You can also use GRAPH-SEARCH in this problem if you show that the heuristic function here is consistent.

2. AIMA[4.8]

The traveling salesperson problem (TSP) can be solved via the minimum spanning tree (MST) heuristic, which is used to estimate the cost of com- pleting a tour, given that a partial tour has already been constructed. The MST cost of a set of cities is the smallest sum of the link costs of any tree that connects all the cities.

a. Show that this heuristic can be derived from a relaxed version of the TSP.

b. Show that MST heuristic dominates straight-line distance.

c. Write a problem generator for instances of the TSP where cities are represented by random points in the unit square.

d. Find an efficient algorithm in the literature for constructing the MST, and use it with an admissible search algorithm to solve instances of the TSP.

Ans.

(a) If we relax the constraint for TSP such that each city can be visited more than one time (that is, there may be some cities visited more than one time) and the cost for repeated edges are not count, we can get a solution for MST problem.

(b) MST dominates straight-line distance because the shortest dis- tance from any two cities u, v is their straight-line distance.

Moreover, let GM ST(V, ¯E) be the solution of MST problem given

(2)

the instance G. The cost from u to v for MST will be equal to the straight-line distance only if (u, v) ∈ ¯E. Thus MST heuristic dominates straight-line distance.

(c) A simple generator can be:

Generator(Integer N ums){

P OIN T S = nil N = 0

while(N < N ums){

(X, Y ) = (Random(0, 1), Random(0, 1)) if ((X, Y ) /∈ P OIN T S){

P OIN T S ← (X, Y ) N = N + 1

} }

return P OIN T S }

(d) Any MST algorithm is acceptable. You can use the MST algo- rithm as an oracle. The detailed description of MST algorithm can be omitted in this problem. Figure 12 is an instance for TSP, and Figure 13 to Figure 18 are the steps using A* algorithm with MST as its heuristic function.

Figure 1: Start from Lugoi Figure 2: Choose Mehadia

Figure 3: Lugoi here is obvious a wrong choice Figure 4: Return to Dobreta

(3)

Figure 5: Go to Craiova

Figure 6: Go back to Timisoara

Figure 7: Mehadia revisited

(4)

Figure 8: Another path to revisit Mehadia

Figure 9: Go back to Lugoi again

Figure 10: Finally reach Pitesti

(5)

Figure 11: Arrive at the goal

Figure 12: A TSP instance

(6)

S

b a

d 3

1

4

2 6

c 2

3

S->a:

F(a)=G(a)+H(a)=1+(3+2+3)=9 S->b:

F(b)=G(b)+H(b)=3+(1+2+3)=9

8

Figure 13: MST edges, after (s, a) is added into TSP path

S

b a

d 3

1

4

2 6

S->a->c:

F(c)=G(c)+H(c)=(1+2)+(2+3)=8 S->b:

F(b)=G(b)+H(b)=3+(1+2+3)=9 S->a->b:

can not construct a connected tree S->a->d:

can not construct a connected tree c

2

3 8

Figure 14: MST edges, after (s,a), (a,c) is added into TSP path

S

b a

d 3

1

4

2 6

c 2

3

S->b:

F(b)=G(b)+H(b)=3+(1+2+3)=9 S->a->c->d:

F(d)=G(d)+H(d)=(1+2+3)+(3)=9

8

Figure 15: MST edges, after (s,a), (a,c), (c,d) is added into TSP

(7)

S

b a

d 3

1

4

2 6

c 2

3

S->a->c->d:

F(d)=G(d)+H(d)=(1+2+3)+(3)=9 S->b->d->c:

F(c)=G(c)+H(c)=(3+2+3)+(2+1)=11 S->b->a:

can not construct a connected tree S->b->c:

can not construct a connected tree

8

Figure 16: Try another path

S

b a

d 3

1

4

2 6

c 2

3

S->a->c->d->b:

F(b)=G(b)+H(b)=(1+2+3+2)+(0)=8 S->b->d->c:

F(c)=G(c)+H(c)=(3+2+3)+(2+1)=11

8

Figure 17: Return to previous choise

S

b a

d 3

1

4

2 6

c 2

3 8

S->a->c->d->b->S: GOAL F(b)=G(b)+H(b)=(1+2+3+2+3)+(0)=11

Figure 18: A TSP solution is found

參考文獻

相關文件

32.Start from the definition of derivative, then find the tangent line equation.. 46.Find the product of their slopes at there

(12%) Among all planes that are tangent to the surface x 2 yz = 1, are there the ones that are nearest or farthest from the origin?. Find such tangent planes if

[r]

First Note that f (x) is an even function, hence symmetric with respect to the y-axis.. Therefore the two vertices of the rect- angle we are considering are f (x) and f (−x) for

39) The osmotic pressure of a solution containing 22.7 mg of an unknown protein in 50.0 mL of solution is 2.88 mmHg at 25 °C. Determine the molar mass of the protein.. Use 100°C as

The molal-freezing-point-depression constant (Kf) for ethanol is 1.99 °C/m. The density of the resulting solution is 0.974 g/mL.. 21) Which one of the following graphs shows the

Reading Task 6: Genre Structure and Language Features. • Now let’s look at how language features (e.g. sentence patterns) are connected to the structure

Dublin born Oscar Wilde (1854-1900) established himself as one of the leading lights of the London stage at the end of the nineteenth century?. A poet and prose writer as well, it