Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Algorithms, Part II
- by Kevin Wayne, Robert Sedgewick
- Programming Assignment 1: WordNet | wordnet.zip
- Submission time Wed-24-Dec 21:28:41
- Raw Score 98.14 / 100.00
- Feedback See the Assessment Guide for information on how to read this report.
- Assessment Summary
- Compilation: PASSED
- Style: FAILED
- Findbugs: No potential bugs found.
- API: PASSED
- Correctness: 34/35 tests passed
- Memory: 4/4 tests passed
- Timing: 16/16 tests passed
- Aggregate score: 98.14% [Correctness: 65%, Memory: 10%, Timing: 25%, Style: 0%]
- Assessment Details
- The following files were submitted:
- ----------------------------------
- total 28K
- -rw-r--r-- 1 1.4K Dec 25 05:30 Outcast.java
- -rw-r--r-- 1 5.2K Dec 25 05:30 SAP.java
- -rw-r--r-- 1 5.0K Dec 25 05:30 WordNet.java
- -rw-r--r-- 1 4.7K Dec 25 05:30 studentSubmission.zip
- ******************************************************************************
- * compiling
- ******************************************************************************
- % javac SAP.java
- *-----------------------------------------------------------
- ================================================================
- % javac WordNet.java
- *-----------------------------------------------------------
- ================================================================
- % javac Outcast.java
- *-----------------------------------------------------------
- ================================================================
- % checkstyle *.java
- *-----------------------------------------------------------
- SAP.java:4:8: Unused import - java.util.Map.Entry.
- SAP.java:26:1: File contains tab characters (this is the first instance).
- SAP.java:43:39: Name '_this' must match pattern '^[a-z][a-zA-Z0-9]*$|^[A-Z][A-Z_0-9]*$'.
- SAP.java:44:32: Anonymous inner class length is 22 lines (max allowed is 20).
- SAP.java:54:51: 'item' hides a field.
- SAP.java:92:26: Name '_v' must match pattern '^[a-z][a-zA-Z0-9]*$|^[A-Z][A-Z_0-9]*$'.
- SAP.java:96:26: Name '_w' must match pattern '^[a-z][a-zA-Z0-9]*$|^[A-Z][A-Z_0-9]*$'.
- SAP.java:125:57: '?' is not preceded with whitespace.
- SAP.java:125:57: Avoid inline conditionals.
- SAP.java:131:56: '?' is not preceded with whitespace.
- SAP.java:131:56: Avoid inline conditionals.
- SAP.java:131:67: ':' is not preceded with whitespace.
- SAP.java:132:68: '?' is not preceded with whitespace.
- SAP.java:132:68: Avoid inline conditionals.
- SAP.java:132:72: ':' is not preceded with whitespace.
- SAP.java:138:45: Name '_l' must match pattern '^[a-z][a-zA-Z0-9]*$|^[A-Z][A-Z_0-9]*$'.
- WordNet.java:28:1: File contains tab characters (this is the first instance).
- WordNet.java:78:17: Catching 'Exception' is not allowed.
- WordNet.java:85:9: Constructor definition in wrong order.
- Outcast.java:1:8: Unused import - java.util.Map.Entry.
- Outcast.java:23:1: File contains tab characters (this is the first instance).
- Outcast.java:36:37: Name '_d' must match pattern '^[a-z][a-zA-Z0-9]*$|^[A-Z][A-Z_0-9]*$'.
- Outcast.java:44:26: Name '_d' must match pattern '^[a-z][a-zA-Z0-9]*$|^[A-Z][A-Z_0-9]*$'.
- ================================================================
- % findbugs *.class
- *-----------------------------------------------------------
- ================================================================
- Testing the APIs of your programs.
- *-----------------------------------------------------------
- SAP:
- WordNet:
- Outcast:
- ================================================================
- ******************************************************************************
- * correctness
- ******************************************************************************
- Testing methods in SAP
- *-----------------------------------------------------------
- Running 19 total tests.
- Test 1: test length() and ancestor() on fixed digraphs
- * digraph1.txt
- * digraph2.txt
- * digraph3.txt
- * digraph4.txt
- * digraph5.txt
- * digraph6.txt
- * digraph9.txt
- ==> passed
- Test 2: check length() and ancestor() on WordNet digraph
- * 100 random vertex pairs in digraph-wordnet.txt
- ==> passed
- Test 3: check length() and ancestor() on directed paths
- * 5
- * 10
- * 20
- * 50
- * 100
- ==> passed
- Test 4: check length() and ancestor() on directed cycles
- * 5
- * 10
- * 20
- * 50
- * 100
- ==> passed
- Test 5: check length() and ancestor() on complete graphs
- * 5
- * 10
- * 20
- * 50
- ==> passed
- Test 6: check length() and ancestor() on tournament digraphs
- * 5
- * 10
- * 20
- * 50
- ==> passed
- Test 7: check length() and ancestor() on complete binary trees
- * 5
- * 10
- * 20
- * 50
- * 100
- ==> passed
- Test 8: check length() and ancestor() on random DAGs
- * 5 vertices, 8 edges
- * 10 vertices, 40 edges
- * 20 vertices, 100 edges
- ==> passed
- Test 9: check length() and ancestor() on random rooted-in DAGs
- * 5 vertices, 8 edges
- * 10 vertices, 40 edges
- * 20 vertices, 100 edges
- ==> passed
- Test 10: check length() and ancestor() on random rooted-out DAGs
- * 5 vertices, 8 edges
- * 10 vertices, 40 edges
- * 20 vertices, 100 edges
- ==> passed
- Test 11: check length() and ancestor() on random rooted-in trees
- * 5 vertices
- * 10 vertices
- * 20 vertices
- ==> passed
- Test 12: check length() and ancestor() on random rooted-out trees
- * 5 vertices
- * 10 vertices
- * 20 vertices
- ==> passed
- Test 13: check length() and ancestor() on random simple digraphs
- * 5 vertices, 8 edges
- * 10 vertices, 40 edges
- * 20 vertices, 100 edges
- ==> passed
- Test 14: check whether two SAP objects can be created at the same time
- * digraph1.txt and digraph2.txt
- * digraph3.txt and digraph4.txt
- * digraph5.txt and digraph6.txt
- * digraph2.txt and digraph1.txt
- ==> passed
- Test 15: check whether SAP is immutable
- * digraph1.txt
- * digraph2.txt
- * digraph3.txt
- * digraph4.txt
- * digraph5.txt
- * digraph6.txt
- * digraph-ambiguous-ancestor.txt
- ==> passed
- Test 16: test invalid arguments to length() and ancestor() in digraph1.txt
- * v = -1, w = 0
- * v = 0, w = -1
- * v = 13, w = 0
- * v = 0, w = 13
- * v = -1 2 7 , w = 1 4 6 10 11
- * v = 2 7 , w = -1 1 4 6 10 11
- * v = 13 2 7 , w = 1 4 6 10 11
- * v = 2 7 , w = 13 1 4 6 10 11
- ==> passed
- Test 17: test length() and ancestor() with Iterable arguments
- * 100 random subsets of 1 and 1 vertices in digraph-wordnet.txt
- * 100 random subsets of 1 and 2 vertices in digraph-wordnet.txt
- * 100 random subsets of 2 and 1 vertices in digraph-wordnet.txt
- * 100 random subsets of 2 and 2 vertices in digraph-wordnet.txt
- * 100 random subsets of 3 and 11 vertices in digraph-wordnet.txt
- * 100 random subsets of 11 and 3 vertices in digraph-wordnet.txt
- * 100 random subsets of 0 and 5 vertices in digraph-wordnet.txt
- * 100 random subsets of 5 and 0 vertices in digraph-wordnet.txt
- * 100 random subsets of 0 and 0 vertices in digraph-wordnet.txt
- ==> passed
- Test 18: Check Iterable version of length() and ancestor() with null arguments
- ==> passed
- Test 19: random calls to length() and ancestor(), with probabilities
- p1 and p2, respectively
- * random calls in a random rooted DAG (20 vertices, 100 edges)
- (p1 = 0.5, p2 = 0.5)
- * random calls in a random digraph (20 vertices, 100 edges)
- (p1 = 0.5, p2 = 0.5)
- ==> passed
- Total: 19/19 tests passed!
- ================================================================
- ******************************************************************************
- * correctness (substituting reference SAP.java)
- ******************************************************************************
- Testing methods in WordNet
- *-----------------------------------------------------------
- Running 14 total tests.
- Test 1: test distance() of random noun pairs
- * 1000 pairs using synsets = synsets.txt; hypernyms = hypernyms.txt
- ==> passed
- Test 2: test distance() of all noun pairs
- * synsets = synsets15.txt; hypernyms = hypernyms15Path.txt
- * synsets = synsets15.txt; hypernyms = hypernyms15Tree.txt
- * synsets = synsets6.txt; hypernyms = hypernyms6TwoAncestors.txt
- * synsets = synsets11.txt; hypernyms = hypernyms11AmbiguousAncestor.txt
- * synsets = synsets8.txt; hypernyms = hypernyms8ModTree.txt
- * synsets = synsets8.txt; hypernyms = hypernyms8WrongBFS.txt
- * synsets = synsets11.txt; hypernyms = hypernyms11ManyPathsOneAncestor.txt
- * synsets = synsets8.txt; hypernyms = hypernyms8ManyAncestors.txt
- ==> passed
- Test 3: test distance() of random noun pairs
- * 1000 pairs using synsets = synsets100-subgraph.txt; hypernyms = hypernyms100-subgraph.txt
- * 1000 pairs using synsets = synsets500-subgraph.txt; hypernyms = hypernyms500-subgraph.txt
- * 1000 pairs using synsets = synsets1000-subgraph.txt; hypernyms = hypernyms1000-subgraph.txt
- ==> passed
- Test 4: test sap() of random noun pairs
- * 1000 pairs using synsets = synsets.txt; hypernyms = hypernyms.txt
- ==> passed
- Test 5: test sap() of all noun pairs
- * synsets = synsets15.txt; hypernyms = hypernyms15Path.txt
- * synsets = synsets15.txt; hypernyms = hypernyms15Tree.txt
- * synsets = synsets6.txt; hypernyms = hypernyms6TwoAncestors.txt
- * synsets = synsets11.txt; hypernyms = hypernyms11AmbiguousAncestor.txt
- * synsets = synsets8.txt; hypernyms = hypernyms8ModTree.txt
- * synsets = synsets8.txt; hypernyms = hypernyms8WrongBFS.txt
- * synsets = synsets11.txt; hypernyms = hypernyms11ManyPathsOneAncestor.txt
- * synsets = synsets8.txt; hypernyms = hypernyms8ManyAncestors.txt
- ==> passed
- Test 6: test sap() of random noun pairs
- * 1000 pairs using synsets = synsets100-subgraph.txt; hypernyms = hypernyms100-subgraph.txt
- * 1000 pairs using synsets = synsets500-subgraph.txt; hypernyms = hypernyms500-subgraph.txt
- * 1000 pairs using synsets = synsets1000-subgraph.txt; hypernyms = hypernyms1000-subgraph.txt
- ==> passed
- Test 7: check whether WordNet is immutable
- * synsets = synsets.txt; hypernyms = hypernyms.txt
- ==> passed
- Test 8: check that constructor throws an IllegalArgumentException when the input is not a rooted DAG
- * synsets3.txt, hypernyms3InvalidTwoRoots.txt
- - failed to throw a java.lang.IllegalArgumentException
- * synsets3.txt, hypernyms3InvalidCycle.txt
- - failed to throw a java.lang.IllegalArgumentException
- * synsets6.txt, hypernyms6InvalidTwoRoots.txt
- - failed to throw a java.lang.IllegalArgumentException
- * synsets6.txt, hypernyms6InvalidCycle.txt
- - failed to throw a java.lang.IllegalArgumentException
- * synsets6.txt, hypernyms6InvalidCycle+Path.txt
- - failed to throw a java.lang.IllegalArgumentException
- ==> FAILED
- Test 9: check that distance() and sap() throw an IllegalArgumentException
- when either argument is not a WordNet noun
- * synsets15.txt, hypernyms15Tree.txt, invalid noun = invalid
- * synsets15.txt, hypernyms15Tree.txt, invalid noun = b
- * synsets15.txt, hypernyms15Tree.txt, invalid noun = eleventeen
- * synsets15.txt, hypernyms15Tree.txt, invalid noun = INVALID
- ==> passed
- Test 10: check isNoun()
- * synsets = synsets.txt; hypernyms = hypernyms.txt
- * synsets = synsets15.txt; hypernyms = hypernyms15Path.txt
- * synsets = synsets8.txt; hypernyms = hypernyms8ModTree.txt
- ==> passed
- Test 11: check nouns()
- * synsets = synsets.txt; hypernyms = hypernyms.txt
- * synsets = synsets15.txt; hypernyms = hypernyms15Path.txt
- * synsets = synsets8.txt; hypernyms = hypernyms8ModTree.txt
- ==> passed
- Test 12: check whether two WordNet objects can be created at the same time
- * synsets1 = synsets15.txt; hypernyms1 = hypernyms15Tree.txt
- synsets2 = synsets15.txt; hypernyms2 = hypernyms15Path.txt
- * synsets1 = synsets.txt; hypernyms1 = hypernyms.txt
- synsets2 = synsets15.txt; hypernyms2 = hypernyms15Path.txt
- ==> passed
- Test 13: call distance(), sap(), and isNoun() with null arguments
- * synsets15.txt, hypernyms15Path.txt
- ==> passed
- Test 14: random calls to isNoun(), distance(), and sap(), with
- probabilities p1, p2, and p3, respectively
- * 100 random calls (p1 = 0.5, p2 = 0.5, p3 = 0.0)
- * 100 random calls (p1 = 0.5, p2 = 0.0, p3 = 0.5)
- * 100 random calls (p1 = 0.0, p2 = 0.5, p3 = 0.5)
- * 100 random calls (p1 = 0.2, p2 = 0.4, p3 = 0.4)
- ==> passed
- Total: 13/14 tests passed!
- ================================================================
- ******************************************************************************
- * correctness (substituting reference SAP.java and WordNet.java)
- ******************************************************************************
- Testing methods in Outcast
- *-----------------------------------------------------------
- Running 2 total tests.
- Test 1: test outcast() on WordNet digraph
- (synsets = synsets.txt; hypernyms = hypernyms.txt)
- * outcast2.txt
- * outcast3.txt
- * outcast4.txt
- * outcast5.txt
- * outcast5a.txt
- * outcast7.txt
- * outcast8.txt
- * outcast8a.txt
- * outcast8b.txt
- * outcast8c.txt
- * outcast9.txt
- * outcast9a.txt
- * outcast10.txt
- * outcast10a.txt
- * outcast11.txt
- * outcast12.txt
- * outcast12a.txt
- * outcast17.txt
- * outcast20.txt
- * outcast29.txt
- ==> passed
- Test 2: test outcast() on WordNet subgraph
- (synsets = synsets50000-subgraph.txt; hypernyms = hypernyms50000-subgraph.txt)
- * outcast2.txt
- * outcast3.txt
- * outcast5.txt
- * outcast5a.txt
- * outcast7.txt
- * outcast8.txt
- * outcast8b.txt
- * outcast8c.txt
- * outcast9.txt
- * outcast10.txt
- * outcast11.txt
- ==> passed
- Total: 2/2 tests passed!
- ================================================================
- ******************************************************************************
- * memory
- ******************************************************************************
- Computing memory of SAP
- *-----------------------------------------------------------
- Running 1 total tests.
- student memory = 8019944 bytes
- reference memory = 8019944 bytes
- ratio = 1.00
- maximum allowed ratio = 2.50
- vertices = 82192
- edges = 84505
- Total: 1/1 tests passed!
- ================================================================
- Computing memory of WordNet
- *-----------------------------------------------------------
- Running 3 total tests.
- Test 1a: test memory of WordNet object
- * synsets = synsets1000-subgraph.txt; hypernyms = hypernyms1000-subgraph.txt
- - student memory = 881048 bytes
- - reference memory = 1190720 bytes
- - number vertices = 1000
- - number of edges = 1008
- - student / reference ratio = 0.7
- - maximum allowed rato = 2.0
- ==> passed
- Test 1b: test memory of WordNet object
- * synsets = synsets5000-subgraph.txt; hypernyms = hypernyms5000-subgraph.txt
- - student memory = 4383648 bytes
- - reference memory = 5912456 bytes
- - number vertices = 5000
- - number of edges = 5059
- - student / reference ratio = 0.7
- - maximum allowed rato = 2.0
- ==> passed
- Test 1c: test memory of WordNet object
- * synsets = synsets10000-subgraph.txt; hypernyms = hypernyms10000-subgraph.txt
- - student memory = 10437736 bytes
- - reference memory = 13776128 bytes
- - number vertices = 10000
- - number of edges = 10087
- - student / reference ratio = 0.8
- - maximum allowed rato = 2.0
- ==> passed
- Total: 3/3 tests passed!
- ================================================================
- ******************************************************************************
- * timing
- ******************************************************************************
- Timing SAP
- *-----------------------------------------------------------
- Running 7 total tests.
- Test 1: time SAP constructor
- * digraph-wordnet.txt
- - student solution time = 0.10 seconds
- - maximum allowed time = 1.00 seconds
- ==> passed
- Test 2a-c: time length() and ancestor() with random pairs of vertices
- * digraph-wordnet.txt
- - reference solution calls per second: 182119.33
- - student solution calls per second: 202164.00
- - reference / student ratio: 0.90
- => passed student <= 25000x reference
- => passed student <= 2500x reference
- => passed student <= 250x reference
- => BONUS student <= 10.0x reference
- Test 3a-c: time length() and ancestor() with random sets of 5 vertices
- * digraph-wordnet.txt
- - reference solution calls per second: 40318.00
- - student solution calls per second: 55642.00
- - reference / student ratio: 0.72
- => passed student <= 10000x reference
- => passed student <= 1000x reference
- => passed student <= 100x reference
- => BONUS student <= 10.0x reference
- Total: 9/7 tests passed!
- ================================================================
- ******************************************************************************
- * timing (substituting reference SAP.java)
- ******************************************************************************
- Timing WordNet
- *-----------------------------------------------------------
- Running 8 total tests.
- Test 1: timing WordNet constructor
- * synsets = synsets.txt; hypernyms = hypernyms.txt
- - student constructor time = 1.90 seconds
- - maximum allowed time = 10.00 seconds
- ==> passed
- Test 2: check that exactly one SAP object created per WordNet object
- ==> passed
- Test 3a-c: timing sap() and distance() with random nouns
- * synsets = synsets.txt; hypernyms = hypernyms.txt
- - reference solution calls per second: 44430.60
- - student solution calls per second: 2004.40
- - reference / student ratio: 22.17
- => passed student <= 10000x reference
- => passed student <= 1000x reference
- => passed student <= 100x reference
- => FAILED student <= 10x reference
- => FAILED student <= 5x reference
- Test 4: timing isNoun() with random nouns
- * synsets = synsets.txt; hypernyms = hypernyms.txt
- - reference solution calls per second: 382927.00
- - student solution calls per second: 592821.00
- - reference / student ratio: 0.65
- - allowed ratio: 2.00
- ==> passed
- Total: 6/8 tests passed!
- ================================================================
- ******************************************************************************
- * timing (with reference SAP.java and WordNet.java)
- ******************************************************************************
- Timing Outcast
- *-----------------------------------------------------------
- Running 1 total tests.
- 2.86 seconds to build WordNet
- Computing time to find outcasts. Total time must not exceed 5 seconds.
- filename N time
- -----------------------------
- outcast4.txt 4 0.00
- outcast5.txt 5 0.01
- outcast5a.txt 5 0.01
- outcast5.txt 5 0.01
- outcast7.txt 7 0.00
- outcast8.txt 8 0.01
- outcast8a.txt 8 0.01
- outcast8b.txt 8 0.01
- outcast8c.txt 8 0.01
- outcast9.txt 9 0.01
- outcast9a.txt 9 0.01
- outcast10.txt 10 0.00
- outcast10a.txt 10 0.00
- outcast11.txt 11 0.00
- outcast12.txt 12 0.01
- outcast12a.txt 12 0.01
- outcast20.txt 20 0.02
- outcast29.txt 29 0.02
- => passed, total elapsed time: 0.16
- Total: 1/1 tests passed!
- ================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement