Question: write the C + + code for this program please. the optimal path is the one which has the shortest travel time. You will be
write the C code for this program please. the optimal path is the one which has the shortest travel time. You will be implementing the following four search algorithms: BreadthFirst Search BFS DepthFirst Search DFS Uniform Cost Search UCS and A Search. 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 CANewportCoastDr CANewportCoastDr ICA ICA II II II II II II II II II II StaplesCenter Here, each line indicates the current traveling time between two locations. For example, line indicates that it takes minutes to go from ICA to II Note that the location can be an intersection such as ICA Traveling time may not be the same for both directions. For example, II II indicates that it takes minutes to travel from II to II but II II indicates that it takes minutes in the other direction. Beside the live traffic information, you also have an idea of how long it takes on a trafficfree 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 CANewportCoastDr ICA II II II II StaplesCenter 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 CANewportCoastDr ICA II II StaplesCenter The full specification of input.txt and output.txt is shown on the next page. Full specification for input.txt: LIVE TRAFFIC LINES SUNDAY TRAFFIC LINES where: is the algorithm to use and will be one of the following: BFSDFSUCSA is a string with the name of the start location egHome is a string with the name of the goal location egStaplesCenter is the number of lines of live traffic information that follow. LIVE TRAFFIC LINES are lines of live traffic information in the format previously described, ie is the number of lines of Sunday traffic estimates that follow. SUNDAY TRAFFIC LINES are lines of Sunday traffic information in the format previously described, ie Full specification for output.txt: Any number of lines with the following format for each line: Important guidelines on next two pages Guidelines: Your program should not require any commandline argument. It should read a text file called inputtxt in the current directory that contains a problem definition. It should write a file called outputtxtin the current directory with your solution. Format for input.txt and output.txt is specified in the previous page. Samples of input and output are shown on the last few pages of this assignment description. The goal of the samples is to check that you can correctly parse the problem definitions, and generate a correctly formatted output. Your output should match the specified format exactly. It should not be assumed that if your program works on the samples it will work on all test cases.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
