Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Any help with this would be greatly appreciated, Im not too sure how to start this, preferably in Python or C++ code, thank you for
Any help with this would be greatly appreciated, Im not too sure how to start this, preferably in Python or C++ code, thank you for your time.
For this lab assignment, you are given a starting location and goal location (or destination), and must find a path to the goal location. In this problem, the optimal path is the one which has the shortest travel time. You will be implementing the following four search algorithms: Breadth- First Search (BFS), Depth-First Search (DFS), Uniform Cost Search (UCS), and A* Search. You are required to follow the algorithm definitions/pseudocode which we have covered during lecture (please see the lecture slides on Blackboard). Your program will read an input.txt file. The input.txt file will specify one of the four searching algorithms, as well as starting and goal locations. In addition, the input.txt file will contain live traffic information, which is a list of current traveling times in minutes) between different locations. For example, suppose the starting location is your home and the destination is Staples Center. An example of live traffic data is as follows: Home CA73/Newport Coast Dr 5 CA73/NewportCoast Dr 1405/CA73 10 1405/CA73 1110/1405 25 I110/1405 110/1110 20 110/1110 1110/1405 30 110/1110 110/1405 9 1105/1110 110/1110 7 110/1110 StaplesCenter 3 Here, each line indicates the current traveling time between two locations. For example, line 3 indicates that it takes 25 minutes to go from 1405/CA73 to 1110/1405. Note that the location can be an intersection (such as 1405/CA73). Traveling time may not be the same for both directions. For example, 1110/1405 110/1110 20 indicates that it takes 20 minutes to travel from 1110/1405 to 110/1110, but 110/1110 1110/1405 30 indicates that it takes 30 minutes in the other direction. Beside the live traffic information, you also have an idea of how long it takes on a traffic-free Sunday from each location to your goal location. Hence, the input.txt file will also contain the Sunday traffic estimate of traveling time from each location listed in the file to your destination. For the example above, the Sunday traffic data may look like this: Home 55 CA73/NewportCoast Dr 50 1405/CA73 40 1110/1405 28 110/1110 8 110/1405 39 1105/1110 23 StaplesCenter 0 Your program should write, in an output.txt file, the list of locations traveled over in your solution path (including the starting and goal locations) and the accumulated time from start to each location, in order of travel. The following is an example of output.txt: Home 0 CA73/NewportCoastDr 5 1405/CA73 15 1110/1405 40 110/1110 60 StaplesCenter 63 The full specification of input.txt and output.txt is shown on the next page. Full specification for input.txt:
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started