CSE 473: Introduction to Artificial Intelligence

Autumn 2007


Hw Assignment 5 (Program): Due Sunday, October 28, at 11:59 pm (30 pts)

Turn In Here

The above picture shows the Trilobot Mobile Robot from Arrick Robotics, advertised to be intended for AI research and education, so I chose him to represent this assignment. He can move around his environment and pick up things, and he uses informed search, as opposed to a blind search.

This homework assignment is to program a heuristic search (A* or simulated annealing) to allow an agent to compute the shortest path from a start point to a goal point that goes around obstacles. The scenario of this problem is that the agent is located at point A and he needs to get to point C. He can move to any of a finite set of points in his environment. However, there are also a set of obstacles, so he cannot move directly from A to C, but must instead avoid the obstacles. The points in the space have real coordinates (x,y) and are just the vertices of the obstacles. To make the problem a little computationally simpler, we will limit the obstacles to be rectangles.

The agent wants to plan a path from A to C that does not cut across any of the obstacles. A move must be from some vertex I to another vertex J (the robot will never be at a point other than a vertex, unless it is moving from one vertext to another). I and J may be on the same rectangle or on two different ones. He is allowed to move along an edge of an obstacle, just not through it.

For the A* algorithm, you will need an Open list and a Closed list. The Open list contains states that have been generated and not yet expanded. The Closed list contains states that have already been expanded. Each state contains at least the following:

The possible operators at each state are just the moves to any of the other states. Many of them will be illegal, because the line from the current state to the other state intersects a rectangle. Therefore, you will need to code a utility function that determines if a given line segment intersects a given rectangle. The heuristic function h should use the straight line distance from the current vertex to the goal vertex, which can never overestimate the true distance.

For simulated annealing use the same node structure, but no Open or Closed list. You will need an annealing schedule. Besides the algorithm in the text, take a look at slide 21 of Informed Search 2. It gives a potential annealing schedule and also tells you to try multiple moves at each temperature, not just one.

Testing

Your program should read the input data from a file. The format of the file is as follows.
  1. The first line contains 2 (real) numbers separated by spaces. These are the X and Y coordinates of the start state.
  2. The second line contains 2 (real) numbers separated by spaces. This is the goal state.
  3. The third line contains 1 (integer) number. This is the number of obstacles.
  4. Each of the remaining lines gives the position of an obstacle. The line contains 8 numbers, representing the X and Y coordinates of each corner of the obstacle (which is rectangular) in clockwise order.
Two samples are provided - A simple dataset (annotated with comments, picture), and a more difficult one (annotated with comments, picture). First try the very simple one and then the more difficult one plus at least one test data set that you design. You may share your dataset with the class if it is an interesting one.

Results

Your solution will be the minimal path from the start state to the goal state that does not intersect the obstacles. You should output both the path and its cost. The path can be found by following the parent pointers backward from the goal state. Note that because of possible floating point differences, the costs you get may vary according to what machine and language you use. Note also that simulated annealing is not guaranteed to find the best path; you should adjust your schedule if it is doing poorly.

Turn-in

Program source code and listing showing the input to and output from each of the three data sets (my 2 and yours). Source code must be well-commented, ie. explain the purpose of and parameters to each method and comment each important section of code. A sample solution for the simple data set could be:

(0,0)(4,0)(9,6) cost=11.81

The length of the shortest parth for the more difficult data set is approximately 47.2.