Solution to Assignment 1

Codes

Part A
Part B
Part C

Score for Sample Grid with 30 Moves

Starting Position Agent A Agent B Agent C
3,5 3.2
Click for Complete Output
6.4
Click for Complete Output
7.4
Click for Complete Output
7,1 2.8
Click for Complete Output
3.3
Click for Complete Output
5.5
Click for Complete Output

Part D

  1. A simple reflex agent is perfectly rational in an completely observable environment.
  2. No the robot in part B is not deterministic because in the event that two neighbouring squares have the same dirt value, the robot moves randomly which(on an average) will be different in different runs.
  3. Let us consider an environment where the value of dirt is positive along a joined path and zero everywhere else (i.e. the grid squares having dirt>0 have only two adjacent squares with non-zero dirt value, except at boundaries where it has 1). In this environment the randomized agent will perform badly because the rational choice is to go from the current square to adjacent square having highest value of dirt, the probability of which would be 1/4 in a randomized agent. Moreover the probability of it following the perfectly rational choice of path is (0.25)^n where n is the length of path which is very less.
    Sample Grid:
    0.2 0.0 0.0 0.0
    0.5 0.3 0.2 0.0
    0.0 0.0 0.7 0.8
    0.0 0.0 0.0 0.7
    0.0 0.0 0.0 0.6
  4. The behaviour of the agent will not change if its sensors are noisy as there is equal probability of data being faulty at all steps. However the agent's state in terms of the dirt sucked would be uncertain by atmost 20%.
  5. If the probability of cleaned squares getting dirty again is a Guassian Curve, the agent must additionally store a uncertainity matrix of the squares it has cleaned. The value of squares in this matrix would be the number of moves it has made since it cleaned that square(i,j).
    Now calculating, summation(1 to no. of moves since cleaning the square) f(x)
    f(x)=(1/10.root(2*pie))e^-(x-20 / 10)^2
    We can define a threshold probability p and corresponding number of moves n s.t. after n moves the value of dirt in grid square(i,j) is considered unknown instead of 0.

Part E

The assumptions I have made in the following part is that the robot always cleans the current grid before processing the image received by it. And that the camera is 30cm above ground in the center of the grid. Also that the floor is more or less uniform(in colour/texture). Moreover it would be conivinient to choose a small size for grid squares. The field of view is determined by the following relation: 2* atan(width/height of grid)
  1. To determine the floor: First we do a histogram equalisation to adjust for lighting factors. Then, with the above assumptions we say that the bottom part of the image would give us the color of a clean grid. We then do a localised search for neighbouring pixels having the same color(with margin for error), to find floor. Patches of non-floor surrounded by floor on all sides are filled to accomodate the deviation due to dirt. To find the walls we can apply an algorithm which tries to find trapeziums int the image based on same colour. Of these, the ones being almost straight in the y direction are assumed to be walls.
  2. One we find the floor color and the floor span, we take deviation on floor span from floor colour tp be dirt.
  3. Yes, in this case a value of 0-1 can map the dirt effectively, as we have assumed that floor is of uniform in colour.
  4. If we take the above assumption that a robot is always in the middle of a grid of uniform size, then if it is the grid square just next to a wall (right, left or forward) it will see the edge of a trapezium(wall) at a constant place in the image, which will have three values, one for left, one for right and one for forward. We can calibrate it and henceforth if the robot encounters similiar situation, we can say that it has reached a wall.