26
DCP 1172, Homework 2 1 Homework 2 for DCP-1172 (2004.10.26) This time, we have 3 different homework assignments. Homework assignment 2-1 (50%, Ch3 & Ch4.) Homework assignment 2-2 (25%, Ch5.) Homework assignment 2-3 (25%, Ch6.) It is due on Nov. 12.

DCP 1172, Homework 2 1 Homework 2 for DCP-1172 (2004.10.26) This time, we have 3 different homework assignments. Homework assignment 2-1 (50%, Ch3 &

  • View
    220

  • Download
    0

Embed Size (px)

Citation preview

Page 1: DCP 1172, Homework 2 1 Homework 2 for DCP-1172 (2004.10.26) This time, we have 3 different homework assignments.  Homework assignment 2-1 (50%, Ch3 &

DCP 1172, Homework 2 1

Homework 2 for DCP-1172 (2004.10.26)

• This time, we have 3 different homework assignments. Homework assignment 2-1 (50%, Ch3 & Ch4.) Homework assignment 2-2 (25%, Ch5.) Homework assignment 2-3 (25%, Ch6.)

It is due on Nov. 12.

Page 2: DCP 1172, Homework 2 1 Homework 2 for DCP-1172 (2004.10.26) This time, we have 3 different homework assignments.  Homework assignment 2-1 (50%, Ch3 &

DCP 1172, Homework 2 2

Homework 2-1 : Search Algorithms (AIMA-ch3&4)

The following figure shows a portion of a partially expanded search tree. Each arc between nodes is labeled with the cost of the corresponding operator, and the leaves are labeled with the value of the heuristic function, h.

Which node (use the node’s letter) will be expanded next by each of the following search algorithms?

(a) Depth-first search

(b) Breadth-first search

(c) Uniform-cost search

(d) Greedy search

(e) A* search

5

D

5

A

C

54

19

6

3

h=15

B

F GE

h=8h=12h=10 h=10

h=18

H

h=20

h=14

Page 3: DCP 1172, Homework 2 1 Homework 2 for DCP-1172 (2004.10.26) This time, we have 3 different homework assignments.  Homework assignment 2-1 (50%, Ch3 &

DCP 1172, Homework 2 3

Homework 2-2a: Constraint Satisfaction Problems (AIMA-ch5, Ex.5-13)

• Consider the following logic puzzle: In five houses, each with a different color, live 5 persons of different

nationalities, each of whom prefer a different brand of cigarette, a different drink, and a different pet.

• Give the following facts, the question to answer is: “Where does the zebra live, and in which house do they drink water “▪ The Englishman lives in the red house.

▪ The Spaniard owns the dog.

▪ The Norwegian lives in the first house on the left.

▪ Kools are smoked in the yellow house.

▪ The man who smokes Chesterfields lives in the house next to the man with the fox.

▪ The Norwegian lives next to the blue house.

Page 4: DCP 1172, Homework 2 1 Homework 2 for DCP-1172 (2004.10.26) This time, we have 3 different homework assignments.  Homework assignment 2-1 (50%, Ch3 &

DCP 1172, Homework 2 4

Homework 2-2b: Constraint Satisfaction Problems (cont., AIMA-ch5, Ex.5-13)

▪ The Winston smoker owns snails.

▪ The Lucky Strike smoker drinks orange juice.

▪ The Ukrainian drinks tea.

▪ The Japanese smokes Parliaments.

▪ Kools are smoked I the house next to the house where the horse is kept.

▪ Coffee is drunk in the green house.

▪ The Green house is immediately to the right (your right) of the ivory house.

▪ Milk is drunk in the middle house.

• Discuss different representations of the problem as a CSP. Why would one prefer one representation over another ?

Page 5: DCP 1172, Homework 2 1 Homework 2 for DCP-1172 (2004.10.26) This time, we have 3 different homework assignments.  Homework assignment 2-1 (50%, Ch3 &

DCP 1172, Homework 2 5

Homework 2-3 : Adversarial Search (AIMA-ch6)

(a) Compute the backed-up values computed by the minimax algorithm. Show your answer by writing values at the appropriate nodes in the above tree.

(b) Compute the backed-up values computed by the alpha-beta algorithm. What nodes will not be examined by the alpha-beta pruning algorithm?

(c) What move should Max choose once the values have been backed-up all the way?

A

B C D

E F G H I J K

L M N O P Q R S T U V W YX

2 3 8 5 7 6 0 1 5 2 8 4 210

Max

Max

Min

Min

Consider the following game tree in which the evaluation function values are shown below each leaf node. Assume that the root node corresponds to the maximizing player. Assume the search always visits children left-to-right.

Page 6: DCP 1172, Homework 2 1 Homework 2 for DCP-1172 (2004.10.26) This time, we have 3 different homework assignments.  Homework assignment 2-1 (50%, Ch3 &

DCP 1172, Homework 2 6

Answer Sections

• Homework 2-1 • Page 7-26

• Homework 2-2• Homework 2-3

Page 7: DCP 1172, Homework 2 1 Homework 2 for DCP-1172 (2004.10.26) This time, we have 3 different homework assignments.  Homework assignment 2-1 (50%, Ch3 &

DCP 1172, Homework 2 7

HW#2-1: Depth-first search

Node queue: initialization

# state depth path cost parent #

1 A 0 0 --

Page 8: DCP 1172, Homework 2 1 Homework 2 for DCP-1172 (2004.10.26) This time, we have 3 different homework assignments.  Homework assignment 2-1 (50%, Ch3 &

DCP 1172, Homework 2 8

HW#2-1: Depth-first search

Node queue: add successors to queue front; empty queue from top

# state depth path cost parent #

2 B 1 3 13 C 1 19 14 D 1 5 11 A 0 0 --

Page 9: DCP 1172, Homework 2 1 Homework 2 for DCP-1172 (2004.10.26) This time, we have 3 different homework assignments.  Homework assignment 2-1 (50%, Ch3 &

DCP 1172, Homework 2 9

HW#2-1: Depth-first search

Node queue: add successors to queue front; empty queue from top

# state depth path cost parent #

5 E 2 7 26 F 2 8 27 G 2 8 28 H 2 9 22 B 1 3 13 C 1 19 14 D 1 5 11 A 0 0 --

Page 10: DCP 1172, Homework 2 1 Homework 2 for DCP-1172 (2004.10.26) This time, we have 3 different homework assignments.  Homework assignment 2-1 (50%, Ch3 &

DCP 1172, Homework 2 10

HW#2-1: Depth-first search

Node queue: add successors to queue front; empty queue from top

# state depth path cost parent #

5 E 2 7 26 F 2 8 27 G 2 8 28 H 2 9 22 B 1 3 13 C 1 19 14 D 1 5 11 A 0 0 --

Page 11: DCP 1172, Homework 2 1 Homework 2 for DCP-1172 (2004.10.26) This time, we have 3 different homework assignments.  Homework assignment 2-1 (50%, Ch3 &

DCP 1172, Homework 2 11

HW#2-1: Breadth-first search

Node queue: initialization

# state depth path cost parent #

1 A 0 0 --

Page 12: DCP 1172, Homework 2 1 Homework 2 for DCP-1172 (2004.10.26) This time, we have 3 different homework assignments.  Homework assignment 2-1 (50%, Ch3 &

DCP 1172, Homework 2 12

HW#2-1: Breadth-first search

Node queue: add successors to queue end; empty queue from top

# state depth path cost parent #

1 A 0 0 --2 B 1 3 13 C 1 19 14 D 1 5 1

Page 13: DCP 1172, Homework 2 1 Homework 2 for DCP-1172 (2004.10.26) This time, we have 3 different homework assignments.  Homework assignment 2-1 (50%, Ch3 &

DCP 1172, Homework 2 13

HW#2-1: Breadth-first search

Node queue: add successors to queue end; empty queue from top

# state depth path cost parent #

1 A 0 0 --2 B 1 3 13 C 1 19 14 D 1 5 15 E 2 7 26 F 2 8 27 G 2 8 28 H 2 9 2

Page 14: DCP 1172, Homework 2 1 Homework 2 for DCP-1172 (2004.10.26) This time, we have 3 different homework assignments.  Homework assignment 2-1 (50%, Ch3 &

DCP 1172, Homework 2 14

HW#2-1: Breadth-first search

Node queue: add successors to queue end; empty queue from top

# state depth path cost parent #

1 A 0 0 --2 B 1 3 13 C 1 19 14 D 1 5 15 E 2 7 26 F 2 8 27 G 2 8 28 H 2 9 2

Page 15: DCP 1172, Homework 2 1 Homework 2 for DCP-1172 (2004.10.26) This time, we have 3 different homework assignments.  Homework assignment 2-1 (50%, Ch3 &

DCP 1172, Homework 2 15

HW#2-1: Uniform-cost search

Node queue: initialization

# state depth path cost parent #

1 A 0 0 --

Page 16: DCP 1172, Homework 2 1 Homework 2 for DCP-1172 (2004.10.26) This time, we have 3 different homework assignments.  Homework assignment 2-1 (50%, Ch3 &

DCP 1172, Homework 2 16

HW#2-1: Uniform-cost search

Node queue: add successors to queue so that entire queue is sorted by path cost so far; empty queue from top

# state depth path cost parent #

1 A 0 0 --2 B 1 3 13 D 1 5 14 C 1 19 1

Page 17: DCP 1172, Homework 2 1 Homework 2 for DCP-1172 (2004.10.26) This time, we have 3 different homework assignments.  Homework assignment 2-1 (50%, Ch3 &

DCP 1172, Homework 2 17

HW#2-1: Uniform-cost search

Node queue: add successors to queue so that entire queue is sorted by path cost so far; empty queue from top

# state depth path cost parent #

1 A 0 0 --2 B 1 3 13 D 1 5 15 E 2 7 26 F 2 8 27 G 2 8 28 H 2 9 24 C 1 19 1

Page 18: DCP 1172, Homework 2 1 Homework 2 for DCP-1172 (2004.10.26) This time, we have 3 different homework assignments.  Homework assignment 2-1 (50%, Ch3 &

DCP 1172, Homework 2 18

HW#2-1: Uniform-cost search

Node queue: add successors to queue so that entire queue is sorted by path cost so far; empty queue from top

# state depth path cost parent #

1 A 0 0 --2 B 1 3 13 D 1 5 15 E 2 7 26 F 2 8 27 G 2 8 28 H 2 9 24 C 1 19 1

Page 19: DCP 1172, Homework 2 1 Homework 2 for DCP-1172 (2004.10.26) This time, we have 3 different homework assignments.  Homework assignment 2-1 (50%, Ch3 &

DCP 1172, Homework 2 19

HW#2-1: Greedy search

Node queue: initialization

# state depth path cost total parent #cost to goalcost

1 A 0 0 20 20 --

Page 20: DCP 1172, Homework 2 1 Homework 2 for DCP-1172 (2004.10.26) This time, we have 3 different homework assignments.  Homework assignment 2-1 (50%, Ch3 &

DCP 1172, Homework 2 20

HW#2-1: Greedy search

Node queue: Add successors to queue, sorted by cost to goal.

# state depth path cost total parent #cost to goalcost

1 A 0 0 20 20 --2 B 1 3 14 17 13 D 1 5 15 20 14 C 1 19 18 37 1

Sort key

Page 21: DCP 1172, Homework 2 1 Homework 2 for DCP-1172 (2004.10.26) This time, we have 3 different homework assignments.  Homework assignment 2-1 (50%, Ch3 &

DCP 1172, Homework 2 21

HW#2-1: Greedy search

Node queue: Add successors to queue, sorted by cost to goal.

# state depth path cost total parent #cost to goalcost

1 A 0 0 20 20 --2 B 1 3 14 17 15 G 2 8 8 16 27 E 2 7 10 17 26 H 2 9 10 19 28 F 2 8 12 20 23 D 1 5 15 20 14 C 1 19 18 37 1

Page 22: DCP 1172, Homework 2 1 Homework 2 for DCP-1172 (2004.10.26) This time, we have 3 different homework assignments.  Homework assignment 2-1 (50%, Ch3 &

DCP 1172, Homework 2 22

HW#2-1: Greedy search

Node queue: Add successors to queue, sorted by cost to goal.

# state depth path cost total parent #cost to goalcost

1 A 0 0 20 20 --2 B 1 3 14 17 15 G 2 8 8 16 27 E 2 7 10 17 26 H 2 9 10 19 28 F 2 8 12 20 23 D 1 5 15 20 14 C 1 19 18 37 1

Page 23: DCP 1172, Homework 2 1 Homework 2 for DCP-1172 (2004.10.26) This time, we have 3 different homework assignments.  Homework assignment 2-1 (50%, Ch3 &

DCP 1172, Homework 2 23

HW#2-1: A* search

Node queue: initialization

# state depth path cost total parent #cost to goalcost

1 A 0 0 20 20 --

Page 24: DCP 1172, Homework 2 1 Homework 2 for DCP-1172 (2004.10.26) This time, we have 3 different homework assignments.  Homework assignment 2-1 (50%, Ch3 &

DCP 1172, Homework 2 24

HW#2-1: A* search

Node queue: Add successors to queue, sorted by total cost.

# state depth path cost total parent #cost to goalcost

1 A 0 0 20 20 --2 B 1 3 14 17 13 D 1 5 15 20 14 C 1 19 18 37 1

Sort key

Page 25: DCP 1172, Homework 2 1 Homework 2 for DCP-1172 (2004.10.26) This time, we have 3 different homework assignments.  Homework assignment 2-1 (50%, Ch3 &

DCP 1172, Homework 2 25

HW#2-1: A* search

Node queue: Add successors to queue front, sorted by total cost.

# state depth path cost total parent #cost to goalcost

1 A 0 0 20 20 --2 B 1 3 14 17 15 G 2 8 8 16 26 E 2 7 10 17 27 H 2 9 10 19 23 D 1 5 15 20 18 F 2 8 12 20 24 C 1 19 18 37 1

Page 26: DCP 1172, Homework 2 1 Homework 2 for DCP-1172 (2004.10.26) This time, we have 3 different homework assignments.  Homework assignment 2-1 (50%, Ch3 &

DCP 1172, Homework 2 26

HW#2-1: A* search

Node queue: Add successors to queue front, sorted by total cost.

# state depth path cost total parent #cost to goalcost

1 A 0 0 20 20 --2 B 1 3 14 17 15 G 2 8 8 16 26 E 2 7 10 17 27 H 2 9 10 19 23 D 1 5 15 20 18 F 2 8 12 20 24 C 1 19 18 37 1