Different Searches Part 2-Artificial Intelligence-Quiz, Exercises of Artificial Intelligence

Madam Amrita Ahuja took this quiz in class of Artificial Intelligence at Central University of Jammu and Kashmir. This quiz involves: Tree, Search, Arc, Lengths, Sequence, Breadth, Progressive, Search, Graph, Simulate, State, Heuristics, Optimal

Typology: Exercises

2011/2012

Uploaded on 07/31/2012

shaina_44kin
shaina_44kin 🇮🇳

3.9

(9)

64 documents

1 / 25

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
6.034 Quiz 1, Spring 2004 Solutions
Open Book, Open Notes
1 Tree Search (12 points)
Consider the tree shown below. The numbers on the arcs are the arc lengths.
Assume that the nodes are expanded in alphabetical order when no other order is specified
by the search, and that the goal is state G. No visited or expanded lists are used. What
order would the states be expanded by each type of search? Stop when you expand G. Write
only the sequence of states expanded by each search.
Search Type List of states
Breadth First ABCDEG
Depth First ABDFKLECG
Progressive Deepening Search AABCABDECG
Uniform Cost Search ABDECFG
1
docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19

Partial preview of the text

Download Different Searches Part 2-Artificial Intelligence-Quiz and more Exercises Artificial Intelligence in PDF only on Docsity!

6.034 Quiz 1, Spring 2004 — Solutions

Open Book, Open Notes

1 Tree Search (12 points)

Consider the tree shown below. The numbers on the arcs are the arc lengths.

Assume that the nodes are expanded in alphabetical order when no other order is specified by the search, and that the goal is state G. No visited or expanded lists are used. What order would the states be expanded by each type of search? Stop when you expand G. Write only the sequence of states expanded by each search. Search Type List of states Breadth First A B C D E G

Depth First A B D F K L E C G

Progressive Deepening Search A A B C A B D E C G

Uniform Cost Search A B D E C F G

2 Graph Search (10 points)

Consider the graph shown below where the numbers on the links are link costs and the numbers next to the states are heuristic estimates. Note that the arcs are undirected. Let A be the start state and G be the goal state.

Simulate A* search with a strict expanded list on this graph. At each step, show the path to the state of the node that’s being expanded, the length of that path, the total estimated cost of the path (actual + heuristic), and the current value of the expanded list (as a list of states). You are welcome to use scratch paper or the back of the exam pages to simulate the search. However, please transcribe (only) the information requested into the table given below. Path to State Expanded Length of Path Total Estimated Cost Expanded List A 0 5 (A) C-A 3 4 (C A) B-A 1 5 (B C A) H-C-A 5 6 (H B C A) G-H-C-A 6 6 (G H B C A)

4 Search problem formulation (10 points)

A Mars rover has to leave the lander, collect rock samples from three places (in any order) and return to the lander. Assume that it has a navigation module that can take it directly from any place of interest to any other place of interest. So it has primitive actions go-to-lander, go-to-rock-1, go-to-rock-2, and go-to-rock-3. We know the time it takes to traverse between each pair of special locations. Our goal is to find a sequence of actions that will perform this task in the shortest amount of time.

  1. Formulate this problem as a search problem by specifying the state space, initial state, path-cost function, and goal test. Try to be sure that the state space is detailed enough to support solving the problem, but not redundant. - States: 〈 current-location, have-rock1?, have-rock2?, have-rock3? 〉 These are state variables. The variable current-location ranges over the set {lander, rock1, rock2, rock3 }. The other variables are binary. - Initial state: 〈 lander, no, no, no 〉 - Path cost: sum of arc costs; arc cost = distance between locations - Goal test: 〈 lander, yes, yes, yes 〉
  2. Say what search technique would be most appropriate, and why. We want a shortest path, so we need UCS or A. We might as well use A, since it will probably be faster and there’s a reasonable heuristic available.
  3. One possible heuristic evaluation function for a state would be the distance back to the lander from the location of the state; this is clearly admissible. What would be a more powerful, but still admissible, heuristic for this problem? (Don’t worry about whether it’s consistent or not.) This should have read “One possible heuristic evaluation function for a state would be the amount of time required for the robot to go back to the lander from the location of the state...” So, because of the typo, we gave everyone a free two points on this problem. The answer we had in mind was the maximum, over uncollected rocks r, of the time to get from the current location to r, and the time to get from r to the lander.

5 CSP (17 points)

Let’s look at the problem of scheduling programs on a set of computers as a constraint satisfaction problem. We have a set of programs (jobs) Ji to schedule on a set of computers (machines) Mj. Each job has a maximum running time Ri. We will assume that jobs (on any machines) can only be started at some pre-specified times Tk. Also, there’s a Tmax time by which all the jobs must be finished running; that is, start time + running time is less than or equal to max time. For now, we assume that any machine can execute any job. Let’s assume that we attack the problem by using the jobs as variables and using values that are each a pair (Mj , Tk ). Here is a simple example.

  • Running time of J 1 is R 1 = 2
  • Running time of J 2 is R 2 = 4
  • Running time of J 3 is R 2 = 3
  • Running time of J 4 is R 4 = 3
  • Starting times Tk = { 1 , 2 , 3 , 4 , 5 }
  • Two available machines M 1 and M 2.
  • The max time is Tmax = 7.
  • An assignment would look like J 1 = (M 2 , 2), that is, run job J 1 on machine M 2 starting at time 2.
  1. What are the constraints for this type of CSP problem? Write a boolean expression (using logical connectives and arithmetic operations) that must be satisfied by the assignments to each pair of variables. In particular:
  • Ji with value (Mj , Tk )
  • Jm with value (Mn, Tp)

There is a unary constraint on legal values for a single variable: Tk + Ri ≤ Tmax. This is not a binary constraint on pairs of values. The binary constraint is the one that says that jobs on the same machines must not overlap in time. It can be expressed as:

Mj = Mn → Tk + Ri ≤ Tp ∨ Tp + Rm ≤ Tk

So, either the machines are different or the times don’t overlap.

  1. We could have formulated this problem using the machines Mj as the variables. What would the values be in this formulation, assuming you have N machines and have K jobs to schedule? A value would be a complete schedule for each machine, that is, a list of all the jobs to run on the machine. One could also specify the starting times of each job but that’s redundant, since the running time could be used.
  2. What are some disadvantages of this formulation (using machines as variables)? There would be an very large number of possible values in the domain of each variable (every way of splitting K jobs among M machines so that the sum of the running times is less than Tmax).

6 Game Search (10 points)

Consider the game tree shown below. The top node is a max node. The labels on the arcs are the moves. The numbers in the bottom layer are the values of the different outcomes of the game to the max player.

  1. What is the value of the game to the max player? 4
  2. What first move should the max player make? R
  3. Assuming the max player makes that move, what is the best next move for the min player, assuming that this is the entire game tree? L
  4. Using alpha-beta pruning, consider the nodes from right to left, which nodes are cut off? Circle the nodes that are not examined.

The nodes that are not examined are the left-most node labeled “2” and the node labeled “1.”

2 Graph Search (8 points)

Consider the graph shown below. Note that the arcs are undirected. Let A be the start state and G be the goal state.

A

C

B

G

2 5

(^6 )

2

Simulate uniform cost search with a strict expanded list on this graph. At each step, show the state of the node that’s being expanded, the length of that path, and the current value of the expanded list (as a list of states).

State Expanded Length of Path Expanded List A 0 (A)

B 2 (B A)

C 4 (C B A)

G 6 (G C B A)

3 A∗ Algorithm (12 points)

  1. Let’s consider three elements in the design of the A∗ algorithm:
    • The heuristic, where the choices are:
      • arbitrary heuristic
      • admissible heuristic
      • consistent heuristic
    • History:
      • none
      • visited list
      • strict expanded list
      • non-strict expanded list
    • Pathmax
      • Use pathmax
      • Don’t use pathmax

In the table below, indicate all the combinations that guarantee that A∗ will find an optimal path. Not all rows have to be filled. If multiple values works for any of Heuristic, History and Pathmax, independent of the other choices, you can write the multiple values in one row. So Heuristic History Pathmax A,B C D,E can be used to represent all of: A,C,D; A,C,E; B,C,D; and B,C,E.

Heuristic History Pathmax Admissible None, Non-Strict Use, Don’t Use

Consistent None, Non-Strict, Strict Use, Don’t Use

4 Game Search (5 points)

Consider the game tree shown below. Assume the top node is a max node. The labels on the arcs are the moves. The numbers in the bottom layer are the values of the different outcomes of the game to the max player.

1 3 2 -1 4 -2 1 -

L (^) R

L R L R

L R (^) L R L (^) R L^ R

Max

Max

Min

  1. What is the value of the game to the max player? 2
  2. What first move should the max player make? L
  3. Assuming the max player makes that move, what is the best next move for the min player, assuming that this is the entire game tree? R

5 Alpha-Beta Pruning (5 points)

In the following game tree, are there any alpha-beta cutoffs?

8 2 6 8

Max

Min

Max

  • Consider the nodes from left to right, which nodes are cutoff? Circle the nodes that are not examined and label them with L. None.
  • Consider the nodes from right to left, which nodes are cutoff? Circle the nodes that are not examined and label them with R. The leftmost 8 node.

6 CSP Methods (15 points)

Let’s consider some combinations of CSP methods. For each of the combinations described below say very briefly whether:

  1. It would be well-defined to combine them, in the sense that none of the implementa- tion assumptions of the methods as we defined them are violated in the combination.
  2. It could be useful, that is, one would expect improved performance (over using only the first method mentioned), at least in some problems. Improved performance could be either from being better able to solve problems or improved efficiency (indicate which).

In each case, circle Yes or No for each of Well-Defined? and Useful? and give a very brief explanation of your answers. Warning: Please pay careful attention to the definition of the methods being combined, we are refering to the original definition of the methods – in isola- tion. Almost any idea can be made to work with any other idea with sufficient creativity - but that’s not what we are looking for in this problem.

  • Full constraint propagation (CP) followed by pure backtracking (BT).
    1. Well-Defined? Yes No
    2. Useful? Yes No After full CP, there may still be multiple solutions, and BT will choose one.
  • Full constraint propagation (CP) combined with forward checking (FC).
    1. Well-Defined? Yes No
    2. Useful? Yes No This doesn’t make sense; you still need to do some kind of search. Having done CP, FC won’t rule out any more options, and you’re may be left with multiple possible solutions.

Problem 1 – Search (30 points)

Below is a graph to be searched (starting at S and ending at G). Link/edge costs are shown as well as heuristic estimates at the states. You may not need all the information for every search.

h= 5 S

1 3

h=2 B A

2 2 3 1

G C

h=

h= 0 h=

Draw the complete search tree for this graph. Label each node in the tree with the cost of the path to that node and the heuristic cost at that node. When you need to refer to a node, use the name of the corresponding state and the length of the path to that node. (5 points)

C is path cost, h is heuristic S C=0, h=

C=3, h=2 A^ B C=1, h=

C=5, h= C G (^) C=5, h=0 C

C=6, h=3 (^) B A C=4, h=

C=2, h=

G (^) C=6, h=

S

For each of the searches below, just give a list of node names (state name, length of path) drawn from the tree above. Break ties using alphabetical order. (2 points each)

  1. Perform a depth-first search using a visited list. Assume children of a state are ordered in alphabetical order. Show the sequence of nodes that are expanded by the search.

S0, A3, C5, G5 note that B6 is not expanded because B is on visited list (placed there when S0 was expanded).

  1. Perform a best-first (greedy search) without a visited or expanded list. Show the sequence of nodes that are expanded by the search.

S0 (h=5), A3(h=2), G5(h=0)

  1. Perform a Uniform Cost Search without a visited or expanded list. Show the sequence of nodes that are expanded by the search.

S0, B1, C2, A3, A4, C5, G5 note that nodes are ordered first by cost then alphabetically when tied for cost.

  1. Perform an A* search (no pathmax) without an expanded list. Show the sequence of nodes that are expanded by the search.

S0(0+5), B1(1+3), C2(2+2), A3(3+2), G5(5+0)

Is the heuristic in this example

  1. admissible? Yes
  2. consistent? No Justify your answer, briefly. (3 points)

All the h values are less than or equal to actual path cost to the goal and so the heuristic is admissible. The heuristic drops from 5 at S to 3 at B while the path cost between S and B is only 1, and so the heuristic is not consistent.

Problem 1: Search (25 points)

S

A 2 1 B

C D

G

A. Construct the search tree for the graph above, indicate the path length to each node.

The numbers shown above are link lengths. Pay careful attention to the arrows; some are bi-directional (shown thick) while some are uni-directional.

S

1 A^ B 2

2 C^ D^3 C^3

4 B^ G 5

5 C^ C^8

B. Using the following search tree, perform the searches indicated below (always from S

to G). Each node shows both the total path cost to the node as well as the heuristic value for the corresponding state.

S^ C=0 h=

A C=2 h=3^ B C=3 h=2^ C C=4 h=

B C (^) C=3 h=3 G C=7 h=0 (^) D C=6 h=

C=4 h=

D (^) C=5 h=1 D C=8 h=1 (^) G C=7 h=

G (^) C=6 h=

For each of the searches below, write the sequence of nodes expanded by the search. Specify a node by writing the name of the state and the length of the path (C above), e.g. S0, B3, etc. Break ties using alphabetical order.

  1. Depth First Search (no visited list)

S0, A2, B4, C3, D5, G

  1. Breadth First Search (with visited list)

S0, A2, B3, C4, G

  1. Uniform Cost Search (with strict expanded list)

S0, A2, B3, C3, D5, G

  1. A* (without expanded list)

S0(+5), A2(+3), B3(+2), B4(+2), C3(+3), D5(+1), G6(+0)