Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

ICS 340 Programming Project, Deliverable D, v0 (80 pts) Sgecr'caon: Start with your Java program prog340 which implements Deliverables A, B, and C. Implement the

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed
ICS 340 Programming Project, Deliverable D, v0 (80 pts) Sgecr'caon: Start with your Java program "prog340\" which implements Deliverables A, B, and C. Implement the \"Folklore\" Algorithm of Chapter 25.1 of the Cormen textbook to solve the all- pairs-shortest-path problem. For each iteration, print both the table of minimum distances and the entire shortest path. If you nd a new route that is equal in distance to the previous shortest route, you should keep the previous one. Sample output for one graph is given below, and | show you my formatting code for printing. Examgle: On the next page are the shortest distance and full path tables for each iteration ofthe Folklore algorithm when run on the graph below. The shortest distances are on the left, and the full paths are on the right. Liis the table of minimum distances among all paths consisting of at most iedges, and Pi is the table of shortest paths that yield the minimum distances in the Li table. Don't Break Existing Functionality Note that three tests will be \"regression tests". That is, we will run Deliverable A, B, and C on your program. It should work. Administrative Details The \"progS40\" handout describes the format of the input le for this and all deliverables. As will always be the case in this class, the program must be written in Java and must run on the University Windows computer systems. To ensure this I strongly recommend that you: 1. Use only Oracle Java 8 SE and earlier constructs, and 2. Test it on the University systems before submission if you have any doubts about its ability to run on the University Windows. 3. As stated above. minimize disruption to the existing codebase. lnEut I will test with matrices F6, F8 (the graph from the Folklore algorithm Powerpoint slides), F9 (this graph), F10 (The graph from the Johnson's algorithm Powerpoint slides), and F11 (the graph from the Bellman-Ford homework problem in HWW8. \fFormatted Output L[1 ] IHOOD HHONE OINNO DC L [ 2 ] HHOOD NONW OUNNU B D ADC AD BA BDC BD CBA CE CBD DBA DCB DC L [3 ] NHOOD WHOOW HOrOn OHNNO A B C D ADCB ABDC AD BA BDC BD CBA CB CBD DCBA DCB DC Output Files Although output to both the console and a file is preferred, console output is adequate. Submit: Submit the Java source code to the open Deliverable D submission folder. Please submit all source code files for the entire program. Test Files: F6, F8, F9, F10, F11. Grading: 75 points total. . 50 points for passing the tests correctly. 2 points for getting the correct minimum distances for each iteration of each file (there are a total of 20 iterations among all the test files) = 40 points O 0.5 points for getting the correct complete path table for each iteration of each file (there are a total of 20 iterations among all the test files) = 10 points 15 points for regression testing (5 points each for successfully passing regression tests for Deliverables A, B, and C) 5 points for design 5 points for commentary. Due Dates: The program is due on Saturday, May 2nd, at noon for full credit in the D2L "Deliverable D" dropbox. For 80% of credit earned, you may (re)submit it by noon on Wednesday, May 6th; no late submissions for Deliverable D, submission #2 will be accepted. The time of submission is the time that D2L lists the file as submitted. Some Implementation ThoughtsNotice the grading. Most of the points are for getting the minimum distances correct. In fact, if your regression tests all work and your minimum distances are all correct, and your code is clean, you can get an A- on this program. This is not a very hard problem. Getting the correct paths for the Folklore Algorithm is tough. If you want an "A" on the program, you will need to work for it! Some Formatted Printing Code For what it's worth. Note that I created L and P matrices from the node abbreviations and edge lengths so that I could manipulate them more easily mathematically // Print the L matrix and the Pred matrix. public void printLandPred ( int n, int i ) System . out . print ("L[" + i + "] ") ; / Print header row for both L and P matrices for ( Node v : g. get NodeList () ){ System . out . printf (": 4s", v. getAbbrev () ) ; System. out . print (" for ( Node v : g. get NodeList () " ) ; // 12 spaces System . out . printf ("86s", v. getAbbrev () ) ; System . out . printIn () ; // Print L and P for each Node. int index = 0; for ( Node v : g. get NodeList () ) // Printing distances System . out . printf (":4s", v. getAbbrev () ) ; for ( int h = 0; h = 99 ) { System . out . printf (":4s", "~" ); else { System . out . printf (":4d", 1[index] [h] ) ; / / Printing predecessors System . out . printf (": 12s", v. getAbbrev () ); for ( int h = 0; h = 99 ) || ( ( index == h ) & & ( 1 [index] [h] == 0 ) ) ) { System. out . printf ("86s", "~" ) ; else { System. out . printf (":6s", plindex] [h] ) ; index++; System . out . printIn () ; System . out. printIn ()

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Programming questions