Learner's Name: Abhishek Yadav Learner's ID: 110101011 Date handed-in:
Plagiarism Statement
I declare that, apart from properly referenced quotations, this report is my own work and contains no plagiarism; it has not been submitted previously for any other assessed unit on this or other courses.
Learner's Signature: Date: Maze Search According to the question, the problem is to find a path through a maze from a given start state to a given goal state. The maze format is to be read from given text file. According to me the possible solution to this problem could be: using arrays or linked list to represent the maze nodes/boxes. I consider using linked list. There would be 6 objects associated with the node: value, status (0 if not traversed else 1), link_left, link_right, link_up, link_down. These links would be having the address of the neighboring node. We are considering a 7x7 matrix, so we will create 49 nodes and link them accordingly. We set the links to the nodes at the outer edge of the maze as NULL (setting the outer boundary). Now we are ready to read values from the file. We will read values from the file and place the values in the nodes serially. The values would be P for the starting position and . for the goal state. The walls would be represented with %. After reading values we will traverse all vertices and check for the walls (%). We will cut the link of other nodes attached to it (i.e. link_left, link_right, link_up, link_down of the nodes connected to it will be assigned NULL). As we will not be able to traverse through the walls, so we set the links to null. Finally, we have a tree and we can start traversing the tree accordingly and search for the goal state. For Depth First search: first we will traverse as deep as possible to the left of the root node or start node from one node to other (neighbor), and backtrack if the goal state/node is not found. And traverse and search o the right side of the root/start node by following the same process. Stop when the goal node is found. For Breadth First search: first we traverse level by level on both sides of the root/start node. i.e. first we traverse the node left to the root node then we traverse the node on the right of the root node, then we go to next level, and traverse all nodes on one side and then on the other side. We repeat this process until either all nodes have been traversed or the goal state/node is found. For Greedy Best First search: we need the heuristic value, i.e. the estimate cost from any node to goal should be known in order to choose which node to traverse. The value variable in node could be used to store these heuristic values. Of all the possible nodes where we could traverse, we choose the one with the least heuristic value, we repeat this process until goal node is found. For A* search: we need both- the heuristic value as well as the cost of travelling from one node to other. The evaluation function of A* search calculates the cost as the sum of the estimate cost from any node to goal node and the cost of travelling from one node to other. Here, the value variable of node could be used to store the estimate cost value. We are considering the cost of traversing one node as 1. The path to be chosen for traversal is defined by the evaluation function value and traversal can be done based on it by choosing the path with the lowest value.