CS4341 Introduction to Artificial Intelligence. D-2001
SOLUTIONS Exam 1 - April 5, 2001

Prof. Carolina Ruiz
Department of Computer Science
Worcester Polytechnic Institute

By Songting Chen, Greg Milette, Chris Shoemaker, and Carolina Ruiz

Instructions


See our grading notes for explanations on the grading codes we used.


Problem I. Search (30 points)

Suppose that you need to find a path between S and G in the following graph. The number attached to each edge in the graph represents the COST of traversing the edge.


Assume also that the ESTIMATED distances to the goal are given by the following table:

Node: S A C D F G H
Estimated Distance to G: 10 5 4 3 4 0 2

For EACH of the following search methods list the nodes in the order in which they are EXPANDED by the search method while looking for a solution. When everything else is equal, order the nodes in alphabetical order. As an illustration, the solution for Depth 1st search is provided below.

  1. Depth 1st Search

    List: [S, A, C, D, G]

              S
             / \ 
            A   F
           / \
          C   F
         / \
        D   G
            * goal
    
    

  2. (6 points) Breadth 1st Search

    List: [S, A, F, C, F, A, G]

                 S
             /        \ 
            A          F
          /   \      / | \
         C     F    A  G  H
        / \   / \      * 
       D   G G   H
    
    

  3. (6 points) Branch-and-Bound with Dynamic Programming (= Uniform Cost Search)

    List: [S, A, C, F, D, H, G]

                  S
             /          \ 
          2 A            F 7
          /   \        / | \
       6 C     F      A  G  H 
        / \   10     15 12  9  
     9 D   G   x      x  x
       |  11
       G   *
      12
       x
    
    

  4. (6 points) Greedy Search (= Best 1st Search)

    List: [S, F, G]

              S  10
    
            /   \ 
    
         5 A     F 4
    
               / | \
              A  G  H
              5  0  2
                 *
    
    

  5. (6 points) A*

    List: [S, A, C, F, G]

                  S
             /          \ 
          7 A            F 11
          /   \        / | \
      10 C     F      A  G  H 
        / \   14     20 12 11
       D   G   x      x  x
      12  11
           *
    
    

  6. (6 points) Hill-climbing

    List: [S, F, G]

              S  10
    
            /   \ 
    
         5 A     F 4
    
               / | \
              A  G  H
              5  0  2
                 *
    
    

Problem II. Search (10 points)

In this problem, you are asked to construct an example showing that greedy search is not an optimal search method.
  1. (4 points) Give an example of a net for which greedy search does not output an optimal path from S to G. Remember to provide the net, and all costs (if needed) and all estimated distances to goal.

    Same net as in Example 1:

    Node: S A C D F G H
    Estimated Distance to G: 10 5 4 3 4 0 2

  2. (3 points) Show the order in which the nodes are expanded by the greedy search.
    
    S,F,G
    
    
  3. (3 points) What is the path produced by greedy search? Explain why it is not an optimal path.
    
    Length of S,F,G = 12. However, there exists path S,A,C,G with length only 11.
    
    

Problem III. Game Playing (20 points)

Suppose you and a friend of yours are playing a board game. It is your turn to move, and the tree below represents your situation. The values of the evaluation function at the leaf nodes are shown in the tree.

  1. (10 points) Use the minimax procedure to select your next move. Show your work on the tree below.

  2. (10 points) Use the minimax procedure TOGETHER WITH ALPHA-BETA PRUNING to select your next move. Mark with an "X" the nodes that don't need to be evaluated. Show your work on the tree below and explain your answer.


Problem IV. Rule-Based Systems (20 points)

Consider the following set of rules for identifying animals.

The working memory contains the following assertions: Solve the following problems. Show your work.

  1. (10 points) Use backward chaining to determine whether or not hobbes is a tiger. Construct a tree showing the steps followed by backward chaining and show when and how the working memory is updated during the depth 1st search.
    
    BACKWARD CHAINING:
    
      hobbes is a tiger                ?x is a tiger
              |
              |  R4       
              |
      hobbes has black stripes         ?x has black stripes 
              |
              |  succeeds due to A1
              |
      hobbes is a carnivore            ?x is a carnivore 
              |
              |  R3 
              |
      hobbes eats meat                 ?x eats meat 
              |
              |  succeeds due to A2
              |
      hobbes is a mammal               ?x is a mammal 
              |
              |  R1 
              |
      hobbes gives milk                ?x gives milk 
    
                 succeeds due to A4
    
    
    hence the working memory is updated with:
       A6: hobbes is a mammal  
       A7: hobbes is a carnivore
       A8: hobbes is a tiger 
    
    

  2. (10 points) Use forward chaining to derive ALL assertions that are derivable from this knowledge base (that is, from the set of rules together with the assertions in the working memory). Construct all trees showing the steps followed by forward chaining and show when and how the working memory is updated during the process.
    
    FORWARD CHAINING:
    
    R1:  hobbes gives milk                      ?x gives milk 
             
                 succeeds due to A4
      
    
         WM := WM + {A6: hobbes is a mammal}    ?x is a mammal 
    
    
    R2:  tweety has feathers                    ?x has feathers 
              |
              |  succeeds due to A3
              |
         tweety flies                           ?x flies 
              |
              |  succeeds due to A5
              |
         tweety lays eggs                       ?x lays eggs 
    
                 fails
    
    
          hence rule R2 is not triggered.
    
    
    R3:   hobbes eats meat                      ?x eats meat 
              |
              |  succeeds due to A2
              |
          hobbes is a mammal                    ?x is a mammal 
               
                 succeeds due to A6
               
    
          WM:= WM + {A7: hobbes is a carnivore} ?x is a carnivore
    
    
    R4:   hobbes has black stripes              ?x has black stripes 
              |
              |  succeeds due to A1
              |
          hobbes is a carnivore                 ?x is a carnivore 
              
                 succeeds due to A7
              
    
          WM:= WM + {A8: hobbes is a tiger}     ?x is a tiger  
         
    
    Applying again R1, R2, R3, R4 does not yield any new assertions
    and so the forward chaining process stops.
    

Problem V. Constraint Satisfaction (20 points)

Consider the problem of scheduling a meeting that a number of people must attend. This problem can be seen as a constraint satisfaction problem under the following assumptions: Answer the following questions:
  1. (10 points) Construct a constraint net that represents the scheduling problem described above under the following assumptions:

    Draw the complete constraint net, including full constraint matrices.

  2. (10 points)Describe and follow in detail each of the steps of your problem solving strategy to find a convenient 1-hour slot for the meeting:

    1. Arc Consistency Check

      AFTER all the constraints have been entered into the binary constraint matrices, and BEFORE the search for a solution begins, we check all the rows and columns of the binary constraint matrices for time that has all zeros, and for which the variable domain for that person still contains this time (because it was not removed by entering any of the given constraints).  Such times are removed from the domain of those people, and then all binary constraint matrices for that person are updated to reflect the smaller domain.  After the arc consistency checking is done, only one value remains true in each binary constraint matrix.

    2. Depth First Search
      1. Selection of the 1st node

        Although all there is only value left for each binary constraint matrix, a general problem solving strategy would order the variables by how constrained they were.  The depth first search would begin with an assignment of the most constrained variable.

      2. Selection of each consecutive node

        Assignments would be made for each successive node, where the selection of the next successive node would be the most constrained of the remaining variables.  This would eventually lead to the discovery that the solution to the CSP is We10.