CS534 ARTIFICIAL INTELLIGENCE. SPRING 98
PROJECT 2
Motion Planning in the Presence of Obstacles

PROF. CAROLINA RUIZ
Department of Computer Science
Worcester Polytechnic Institute



PROJECT DESCRIPTION

This project consists of designing and implementing a rule-based system for motion planning in the presence of obstacles.

Assume that you are driving a vehicle in a 10x10 grid-like city and want to generate a plan to get from your present position to a goal position. The grid-city consists of streets and avenues . Streets run east-west and are denoted by numbers from 0 to 9 (0 being the southmost street and 9 being the northmost street). Avenues run north-south and are denoted by letters from A to J (A being the westmost avenue and J being the eastmost avenue). A position (x y) in this grid is the intersection of a street x and an avenue y. Since each segment of a street/avenue can be potentially traversed in two directions, for convenience we sometimes refer to a one-block segment of a street/avenue together with a direction simply as a dblock and use a triple (x y d), where x: street, y: avenue, d= s (south), n (north), e (east), or w (west), to denote it.. We'll say that a dblock is closed if it is (temporarily or permanently) closed to the traffic, and open otherwise.

Examples of dblocks are given below.

     A  B  C  D  E  F  G  H  I  J
 9   -- -- -- -- -- -- -- -- --  
     |  |  |  |  |  |  |  |  |  |  
 8    -- -- -- -- -- -- -- -- --  
     |  |  |  |  |  |  |  |  |  |
 7    -- -- <= => -- -- -- -- --              =>: (7 D e)  
     |  |  |  |  |  |  |  |  |  |             <=: (7 D w)
 6    -- -- -- -- -- -- -- -- --  
     |  |  |  |  |  |  |  |  |  |
 5    -- -- -- -- -- -- -- -- --  
     |  |  |  |  |  |  |  |  ^  |              ^: (4 I n)  
 4    -- -- -- -- -- -- -- -- --  
     |  |  |  |  |  |  |  |  v  |              v: (4 I s)
 3    -- -- -- -- -- -- -- -- --  
     |  |  |  |  |  |  |  |  |  |
 2    -- -- -- -- -- -- -- -- --  
     |  |  |  |  |  |  |  |  |  |
 1    -- -- -- -- -- -- -- -- --  
     |  |  |  |  |  |  |  |  |  |  
 0    -- -- -- -- -- -- -- -- --  
 
Note that (3 B e) and (3 C w) are two different dblocks which denote the 
same one-block segment but traversed in opposite directions.   
Given an initial position, e.g. (3 E), and a goal position, e.g.(7 B), your program should output a valid plan to get from the initial to the goal position, or an error message if no such plan exists. A plan
{(x_1 y_1 d_1) (x_2 y_2 d_2) .... (x_n y_n d_n)}
is valid if:
  1. (x_1 y_1) is the initial position,
  2. (x_n y_n) is the goal position,
  3. for each i, (x_i y_i d_i) is a city dblock, and
  4. for each i, the dblock (x_i y_i d_i) is open to traffic and leads to position (x_{i+1} y_{i+1}).
    Formally speaking, (x_i y_i d_i) leads to position (x_{i+1} y_{i+1}), if
            
            x_{i+1) = x_i + delta_x     and 
            y_{i+1) = y_i + delta_y,    where
            
                                | (1 0), if d = n
            (delta_x delta_y) = | (0 1), if d = e 
                                | (-1 0), if d = s
                                | (0 -1), if d = w
            
    for example, (3 B e) leads to position (3 C).

PROJECT ASSIGNMENT

The project assignment consists of the following:
  1. Implement a plan generator for this motion problem using a rule-based system. The rule-based system should satisfy the following requirements.

    • The rule base should contain a collection of rules of the form:
        IF   preconditions   THEN   action ; postconditions  
      that captures the knowledge needed to generate valid motion plans.

    • The inference engine should allow the user to select either forward or backward chaining.
      • Forward Chaining: selects and applies rules whose preconditions match the current state until the goal state is reached.
      • Backward Chaining: selects and applies rules whose postconditions match the current goal state until the initial state is encountered.
      You should implement a conflict resolution strategy to select just one rule for application when several rules are admissible.

  2. The execution of your program should consist of the following steps:
    1. Read the city's dblock configuration from the file city.cfg . This file contains the list of all closed dblocks in the city. You can assume that any dblock not in this file is open to traffic. The file consists of a list of tuples of the form (x y d) separated by spaces, where x is a number between 0 and 9, y is a letter between A and J, and d is a direction: n, e, s, or w.
    2. Repeat:
      • Ask the user for the initial position, goal position, and inference mode (forward or backward chaining)
      • Generate a valid plan
      • Output the plan AND display the path from the initial position to the goal position on a 10x10 grid.
      Until the user selects to stop.

  3. You can design the program-user interface as you like, but make sure that your program is easy to use (avoid having complicated input codes). Concisely state the interface conventions to the user at the beginning of the execution.

REPORT AND DUE DATE

Project 2 is due on Monday, March 9 at 3:30 pm. Code documentation should follow the
Departmental Documentation Standard.