Advertisement
acgtyrant

Algorithom Programming Assignment 1

Sep 21st, 2014
315
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.92 KB | None | 0 0
  1. The following files were submitted:
  2. ----------------------------------
  3. total 12K
  4. -rw-r--r-- 1 1.5K Sep 22 03:17 Percolation.java
  5. -rw-r--r-- 1 1.4K Sep 22 03:17 PercolationStats.java
  6. -rw-r--r-- 1 1.4K Sep 22 03:17 studentSubmission.zip
  7.  
  8.  
  9. ******************************************************************************
  10. * compiling
  11. ******************************************************************************
  12.  
  13.  
  14. % javac Percolation.java
  15. *-----------------------------------------------------------
  16. ================================================================
  17.  
  18. % javac PercolationStats.java
  19. *-----------------------------------------------------------
  20. ================================================================
  21.  
  22.  
  23.  
  24. % checkstyle *.java
  25. *-----------------------------------------------------------
  26. ================================================================
  27.  
  28.  
  29. % findbugs *.class
  30. *-----------------------------------------------------------
  31. ================================================================
  32.  
  33.  
  34. Testing the APIs of your programs.
  35. *-----------------------------------------------------------
  36. Percolation:
  37.  
  38. PercolationStats:
  39.  
  40. ================================================================
  41.  
  42.  
  43. ******************************************************************************
  44. * executing
  45. ******************************************************************************
  46.  
  47. Testing methods in Percolation
  48. *-----------------------------------------------------------
  49. Running 14 total tests.
  50.  
  51. Tests 1 through 7 create a Percolation object using your code, then repeatedly
  52. open sites using open(i, j). After each call to open(), we check that isFull(),
  53. isOpen(), and percolates() return the correct values.
  54.  
  55. Test 1: Open predetermined list of sites using files
  56. * filename = input6.txt
  57. * filename = input8.txt
  58. * filename = input8-no.txt
  59. * filename = input10-no.txt
  60. * filename = greeting57.txt
  61. * filename = heart25.txt
  62. ==> passed
  63.  
  64. Test 2: Open random sites until system percolates (then test is terminated)
  65. * N = 3
  66. * N = 5
  67. * N = 10
  68. * N = 10
  69. * N = 20
  70. * N = 20
  71. * N = 50
  72. * N = 50
  73. ==> passed
  74.  
  75. Test 3: Opens predetermined sites for N = 1 and N = 2 (corner case test)
  76. * filename = input1.txt
  77. * filename = input1-no.txt
  78. * filename = input2.txt
  79. * filename = input2-no.txt
  80. ==> passed
  81.  
  82. Test 4: Check for backwash with predetermined sites
  83. * filename = input20.txt
  84. isFull(18, 1) returns wrong value [after 231 total calls to open()]
  85. - student = true
  86. - reference = false
  87. * filename = input10.txt
  88. isFull(9, 1) returns wrong value [after 56 total calls to open()]
  89. - student = true
  90. - reference = false
  91. * filename = input50.txt
  92. isFull(22, 28) returns wrong value [after 1412 total calls to open()]
  93. - student = true
  94. - reference = false
  95. * filename = sedgewick60.txt
  96. isFull(21, 59) returns wrong value [after 1577 total calls to open()]
  97. - student = true
  98. - reference = false
  99. * filename = michael61.txt
  100. isFull(25, 43) returns wrong value [after 1491 total calls to open()]
  101. - student = true
  102. - reference = false
  103. * filename = jerry47.txt
  104. isFull(11, 47) returns wrong value [after 1076 total calls to open()]
  105. - student = true
  106. - reference = false
  107. ==> FAILED
  108.  
  109. Test 5: Check for backwash with predetermined sites that have
  110. multiple percolating paths
  111. * filename = input3.txt
  112. isFull(3, 1) returns wrong value [after 4 total calls to open()]
  113. - student = true
  114. - reference = false
  115. * filename = input4.txt
  116. isFull(4, 4) returns wrong value [after 7 total calls to open()]
  117. - student = true
  118. - reference = false
  119. * filename = input7.txt
  120. isFull(6, 1) returns wrong value [after 12 total calls to open()]
  121. - student = true
  122. - reference = false
  123. ==> FAILED
  124.  
  125. Test 6: Predetermined sites with very long percolating path
  126. * filename = snake13.txt
  127. * filename = snake101.txt
  128. ==> passed
  129.  
  130. Test 7: Opens every site
  131. * filename = input5.txt
  132. ==> passed
  133.  
  134. Test 8: Check whether exception is called if (i, j) are out of bounds
  135. * N = 10, (i, j) = (0, 6)
  136. * N = 10, (i, j) = (12, 6)
  137. * N = 10, (i, j) = (11, 6)
  138. * N = 10, (i, j) = (6, 0)
  139. * N = 10, (i, j) = (6, 12)
  140. * N = 10, (i, j) = (6, 11)
  141. ==> passed
  142.  
  143. Test 9: Check that IllegalArgumentException is thrown if N <= 0 in constructor
  144. * N = -10
  145. * N = -1
  146. * N = 0
  147. ==> passed
  148.  
  149. Test 10: Create multiple Percolation objects at the same time
  150. (to make sure you didn't store data in static variables)
  151. ==> passed
  152.  
  153. Test 11: Open predetermined list of sites using file
  154. but change the order in which methods are called
  155. * filename = input8.txt; order = isFull(), isOpen(), percolates()
  156. * filename = input8.txt; order = isFull(), percolates(), isOpen()
  157. * filename = input8.txt; order = isOpen(), isFull(), percolates()
  158. * filename = input8.txt; order = isOpen(), percolates(), isFull()
  159. * filename = input8.txt; order = percolates(), isOpen(), isFull()
  160. * filename = input8.txt; order = percolates(), isFull(), isOpen()
  161. ==> passed
  162.  
  163. Test 12: Call all methods in random order until just before system percolates
  164. * N = 3
  165. * N = 5
  166. * N = 7
  167. * N = 10
  168. * N = 20
  169. * N = 50
  170. ==> passed
  171.  
  172. Test 13: Call all methods in random order with inputs not prone to backwash
  173. * N = 3
  174. * N = 5
  175. * N = 7
  176. * N = 10
  177. * N = 20
  178. * N = 50
  179. ==> passed
  180.  
  181. Test 14: Call all methods in random order until all sites are open
  182. * N = 3
  183. * N = 5
  184. * N = 7
  185. isFull(6, 3) returns wrong value [after 30 total calls to open()]
  186. - student = true
  187. - reference = false
  188. * N = 10
  189. isFull(5, 4) returns wrong value [after 53 total calls to open()]
  190. - student = true
  191. - reference = false
  192. * N = 20
  193. isFull(18, 12) returns wrong value [after 255 total calls to open()]
  194. - student = true
  195. - reference = false
  196. * N = 50
  197. isFull(50, 4) returns wrong value [after 1769 total calls to open()]
  198. - student = true
  199. - reference = false
  200. ==> FAILED
  201.  
  202.  
  203. Total: 11/14 tests passed!
  204.  
  205. ================================================================
  206.  
  207. ******************************************************************************
  208. * executing PercolationStats with reference Percolation
  209. ******************************************************************************
  210.  
  211. Testing methods in PercolationStats
  212. *-----------------------------------------------------------
  213. Running 10 total tests.
  214.  
  215. Test 1: Test that PercolateStats creates T Percolation objects, each of size N-by-N
  216. * N = 20, T = 10
  217. * N = 50, T = 20
  218. * N = 100, T = 50
  219. * N = 64, T = 150
  220. ==> passed
  221.  
  222. Test 2a: Test that PercolationStats calls open() until system percolates
  223. * N = 20, T = 10
  224. * N = 50, T = 20
  225. * N = 100, T = 50
  226. * N = 64, T = 150
  227. ==> passed
  228.  
  229. Test 2b: Test that PercolationStats does not call open() after system percolates
  230. * N = 20, T = 10
  231. * N = 50, T = 20
  232. * N = 100, T = 50
  233. * N = 64, T = 150
  234. ==> passed
  235.  
  236. Test 3: Test that mean() is consistent with the number of intercepted calls to open()
  237. on blocked sites
  238. * N = 20, T = 10
  239. * N = 50, T = 20
  240. * N = 100, T = 50
  241. * N = 64, T = 150
  242. ==> passed
  243.  
  244. Test 4: Test that stddev() is consistent with the number of intercepted calls to open()
  245. on blocked sites
  246. * N = 20, T = 10
  247. * N = 50, T = 20
  248. * N = 100, T = 50
  249. * N = 64, T = 150
  250. ==> passed
  251.  
  252. Test 5: Test that confidenceLo() and confidenceHigh() are consistent with mean() and stddev()
  253. * N = 20, T = 10
  254. * N = 50, T = 20
  255. * N = 100, T = 50
  256. * N = 64, T = 150
  257. ==> passed
  258.  
  259. Test 6: Check whether exception is thrown if either N or T is out of bounds
  260. * N = -23, T = 42
  261. * N = 23, T = 0
  262. * N = -42, T = 0
  263. * N = 42, T = -1
  264. ==> passed
  265.  
  266. Test 7: Create two PercolationStats objects at the same time and check mean()
  267. (to make sure you didn't store data in static variables)
  268. * N1 = 50, T1 = 10, N2 = 50, T2 = 5
  269. * N1 = 50, T1 = 5, N2 = 50, T2 = 10
  270. * N1 = 50, T1 = 10, N2 = 25, T2 = 10
  271. * N1 = 25, T1 = 10, N2 = 50, T2 = 10
  272. * N1 = 50, T1 = 10, N2 = 15, T2 = 100
  273. * N1 = 15, T1 = 100, N2 = 50, T2 = 10
  274. ==> passed
  275.  
  276. Test 8: Check that the methods return the same value, regardless of
  277. the order in which they are called
  278. * N = 20, T = 10
  279. * N = 50, T = 20
  280. * N = 100, T = 50
  281. * N = 64, T = 150
  282. ==> passed
  283.  
  284. Test 9: Check distribution of number of sites opened until percolation
  285. * N = 2, T = 100000
  286. * N = 3, T = 100000
  287. * N = 4, T = 100000
  288. ==> passed
  289.  
  290.  
  291. Total: 10/10 tests passed!
  292.  
  293. ================================================================
  294.  
  295. ******************************************************************************
  296. * memory usage
  297. ******************************************************************************
  298.  
  299. Computing memory of Percolation
  300. *-----------------------------------------------------------
  301. Running 4 total tests.
  302.  
  303. Test 1a-1d: Check that total memory <= 17 N^2 + 128 N + 1024 bytes
  304.  
  305. N bytes
  306. --------------------------------------------
  307. => passed 64 37032
  308. => passed 256 589992
  309. => passed 512 2359464
  310. => passed 1024 9437352
  311. ==> 4/4 tests passed
  312.  
  313.  
  314. Estimated student memory = 9.00 N^2 + 0.00 N + 168.00 (R^2 = 1.000)
  315.  
  316.  
  317. Test 2 (bonus): Check that total memory <= 11 N^2 + 128 N + 1024 bytes
  318. - bonus available only if solutions handles backwash
  319. ==> FAILED
  320.  
  321.  
  322. Total: 4/4 tests passed!
  323.  
  324. ================================================================
  325.  
  326.  
  327.  
  328. Computing memory of PercolationStats
  329. *-----------------------------------------------------------
  330. Running 4 total tests.
  331.  
  332. Test 1a-1d: Memory usage as a function of T for N = 100
  333. (max allowed: 8 T + 128 bytes)
  334.  
  335. T bytes
  336. --------------------------------------------
  337. => passed 16 184
  338. => passed 32 312
  339. => passed 64 568
  340. => passed 128 1080
  341. ==> 4/4 tests passed
  342.  
  343.  
  344. Estimated student memory = 8.00 T + 56.00 (R^2 = 1.000)
  345.  
  346. Total: 4/4 tests passed!
  347.  
  348. ================================================================
  349.  
  350.  
  351.  
  352. ******************************************************************************
  353. * timing
  354. ******************************************************************************
  355.  
  356. Timing Percolation
  357. *-----------------------------------------------------------
  358. Running 9 total tests.
  359.  
  360. Tests 1a-1e: Measuring runtime and counting calls to connected(), union() and
  361. find() in WeightedQuickUnionUF.
  362.  
  363.  
  364. For each N, a percolation object is generated and sites are randomly opened
  365. until the system percolates. If you do not pass the correctness tests, these
  366. results may be meaningless.
  367.  
  368. 2 * connected()
  369. N seconds union() + find() constructor
  370. ---------------------------------------------------------------------------------------------
  371. => passed 8 0.00 66 164 1
  372. => passed 32 0.00 760 1866 1
  373. => passed 128 0.03 11294 28834 1
  374. => passed 512 0.12 185343 474148 1
  375. => passed 1024 0.26 728916 1864838 1
  376. ==> 5/5 tests passed
  377.  
  378. Running time in seconds depends on the machine on which the script runs,
  379. and varies each time that you submit. If one of the values in the table
  380. violates the performance limits, the factor by which you failed the test
  381. appears in parentheses. For example, (9.6x) in the union() column
  382. indicates that it uses 9.6x too many calls.
  383.  
  384.  
  385. Tests 2a-2d: This test checks whether you use a constant number of calls to
  386. union(), connected(), and find() per call to open(), isFull(), and percolates().
  387. The table below shows max(union(), connected(), find()) calls made during a
  388. single call to open(), isFull(), and percolates().
  389.  
  390. N per open() per isOpen() per isFull() per percolates()
  391. ---------------------------------------------------------------------------------------------
  392. => passed 32 4 0 1 1
  393. => passed 128 4 0 1 1
  394. => passed 512 4 0 1 1
  395. => passed 1024 4 0 1 1
  396. ==> 4/4 tests passed
  397.  
  398. Total: 9/9 tests passed!
  399. ================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement