Assignment 1
Assignment 1
Assignment 1
Due Date - 25th September EOD
Input
• First line describes the dictionary length K.
• Second line describes the start and end word separated by space. Do note
the second word belongs to the dictionary.
• Following K lines give the different words in the dictionary.
Output
• Every word in the transition separated by space.
• Do note that the last word should match with the target word.
Example
Input
5
sky sun
spy
soy
son
sun
1
sum
output
sky soy son sun
Input
• A 8x8 matrix of “.” and “#”, where “.” represents empty space, and “#”
represents obstacle.
Output
• Minimum travel time to reach (7, 7)
2
Example
Input
...... #.
..###.#.
..#.#.#.
..###.#.
..#.#.#.
..#.#.#.
...... #.
...... ..
Output
14
The terrain is represented as a grid, where each cell can be one of several terrain
types, each with an associated traversal cost. You have a specific starting point
and a goal point within the maze and you can move in four cardinal directions
(up, down, left, right) from one cell to another.
G D R G F
G R R D G
D G G R G
G R G G D
S G D R G
G - GRASS
D - DUST
R - ROCKS
S - START
F - FINISH
3
Find the path from the starting point to the goal point that minimizes the
total traversal cost while obeying the rules of movement (i.e., you cannot move
through walls or impassable terrain) using the following Informed searches.
1. A* Search
2. Weighted A* Search
Note : For each of the algorithms, mention the following details.
• State Representation : Define the state representation, which
includes the current position (cell) and the cumulative traversal
cost.
• Heuristic Function (h) : Develop a heuristic function that
estimates the cost from the current cell to the goal. A com-
mon choice might be the Euclidean distance or the Manhattan
distance between the two cells, weighted by the terrain type.
• Cost Function(g) : Define the cost function to keep track of
the cumulative traversal cost from the start to the current cell.
Input
• First line contains the dimension of the terrain, No. Of rows(N) and No. Of
columns(M)
• N lines follow, where each line has M characters, representing the cell
terrain.
Output
• The minimum cost form S(start) to F(Finish).
4
Q4. Robot Navigation [15 Marks]
Consider the problem of finding the shortest path between two points on a plane
that has convex polygonal obstacles (see Fig below). This is an idealization
of the problem a robot has to solve to navigate its way around in a crowded
environment. Based on this, answer the following questions.
1. Suppose the state space consists of all positions (x, y) in the plane. How
many states exist? How many paths are there to the goal?
2. We are interested in the shortest path to the goal. This runs along the
corners of the polygons and therefore consists of line segments that connect
the polygon’s corners. We formulate the state space to contain the corners
of all polygons as well as the start and goal coordinates. State the full
successor function for the states (1, 5) (start) and (3, 4) in the problem
figure given above.
3. We will now use hill-climbing in the same setting, that is, planar robot
5
navigation among polygonal obstacles. We assume that the obstacles do
not touch each other.
4. Explain how hill-climbing would work as a method of reaching a particular
end point. Is it guaranteed to find the path?
5. Show how non-convex obstacles can result in a local maximum for the
hill-climber, using an example