Advertisement
olemis

Coursera algs4partII-004 - Assignment 2

Dec 25th, 2014
386
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.26 KB | None | 0 0
  1.  
  2. Algorithms, Part II
  3. by Kevin Wayne, Robert Sedgewick
  4. Programming Assignment 2: Seam Carving | seamCarving.zip Help Submission
  5.  
  6. Submission time Fri-14-Nov 15:42:52
  7. Raw Score 100.00 / 100.00
  8. Feedback See the Assessment Guide for information on how to read this report.
  9. Assessment Summary
  10. Compilation: PASSED
  11. Style: FAILED
  12. Findbugs: No potential bugs found.
  13. API: PASSED
  14.  
  15. Correctness: 19/19 tests passed
  16. Memory: 7/7 tests passed
  17. Timing: 6/6 tests passed
  18.  
  19. Aggregate score: 100.00% [Correctness: 65%, Memory: 10%, Timing: 25%, Style: 0%]
  20. Assessment Details
  21. The following files were submitted:
  22. ----------------------------------
  23. total 12K
  24. -rw-r--r-- 1 6.4K Nov 14 23:43 SeamCarver.java
  25. -rw-r--r-- 1 1.9K Nov 14 23:43 studentSubmission.zip
  26.  
  27.  
  28. ******************************************************************************
  29. * compiling
  30. ******************************************************************************
  31.  
  32.  
  33. % javac SeamCarver.java
  34. *-----------------------------------------------------------
  35. ================================================================
  36.  
  37.  
  38.  
  39. % checkstyle *.java
  40. *-----------------------------------------------------------
  41. SeamCarver.java:20:1: File contains tab characters (this is the first instance).
  42. SeamCarver.java:78:78: '||' should be on a new line.
  43. SeamCarver.java:95:33: Name '_globalpred' must match pattern '^[a-z][a-zA-Z0-9]*$|^[A-Z][A-Z_0-9]*$'.
  44. SeamCarver.java:99:32: Name '_globalmin' must match pattern '^[a-z][a-zA-Z0-9]*$|^[A-Z][A-Z_0-9]*$'.
  45. SeamCarver.java:103:40: Name '_mincost' must match pattern '^[a-z][a-zA-Z0-9]*$|^[A-Z][A-Z_0-9]*$'.
  46. SeamCarver.java:104:49: Name '_cost' must match pattern '^[a-z][a-zA-Z0-9]*$|^[A-Z][A-Z_0-9]*$'.
  47. SeamCarver.java:105:37: Name '_pred' must match pattern '^[a-z][a-zA-Z0-9]*$|^[A-Z][A-Z_0-9]*$'.
  48. SeamCarver.java:148:33: Name '_globalpred' must match pattern '^[a-z][a-zA-Z0-9]*$|^[A-Z][A-Z_0-9]*$'.
  49. SeamCarver.java:152:32: Name '_globalmin' must match pattern '^[a-z][a-zA-Z0-9]*$|^[A-Z][A-Z_0-9]*$'.
  50. SeamCarver.java:156:40: Name '_mincost' must match pattern '^[a-z][a-zA-Z0-9]*$|^[A-Z][A-Z_0-9]*$'.
  51. SeamCarver.java:157:49: Name '_cost' must match pattern '^[a-z][a-zA-Z0-9]*$|^[A-Z][A-Z_0-9]*$'.
  52. SeamCarver.java:158:37: Name '_pred' must match pattern '^[a-z][a-zA-Z0-9]*$|^[A-Z][A-Z_0-9]*$'.
  53. SeamCarver.java:190:40: Array brackets at illegal position.
  54. SeamCarver.java:194:67: '?' is not preceded with whitespace.
  55. SeamCarver.java:194:67: Avoid inline conditionals.
  56. SeamCarver.java:197:71: '||' should be on a new line.
  57. SeamCarver.java:202:75: '?' is not preceded with whitespace.
  58. SeamCarver.java:202:75: Avoid inline conditionals.
  59. SeamCarver.java:203:75: '?' is not preceded with whitespace.
  60. SeamCarver.java:203:75: Avoid inline conditionals.
  61. SeamCarver.java:205:61: '||' should be on a new line.
  62. SeamCarver.java:209:67: '?' is not preceded with whitespace.
  63. SeamCarver.java:209:67: Avoid inline conditionals.
  64. ================================================================
  65.  
  66.  
  67. % findbugs *.class
  68. *-----------------------------------------------------------
  69. ================================================================
  70.  
  71.  
  72. Testing the APIs of your programs.
  73. *-----------------------------------------------------------
  74. SeamCarver:
  75.  
  76. ================================================================
  77.  
  78.  
  79. ******************************************************************************
  80. * correctness
  81. ******************************************************************************
  82.  
  83. Testing methods in SeamCarver
  84. *-----------------------------------------------------------
  85. Running 19 total tests.
  86.  
  87. Test 1: Test energy() with file inputs
  88. * 6x5.png
  89. * 4x6.png
  90. ==> passed
  91.  
  92. Test 2: Test energy() with random N-by-M pictures with 10 trials each
  93. * 4-by-4
  94. * 5-by-5
  95. * 6-by-6
  96. * 7-by-7
  97. ==> passed
  98.  
  99. Test 3: Test width() with input file
  100. * 6x5.png
  101. * 4x6.png
  102. ==> passed
  103.  
  104. Test 4: Test width() with random N-by-M picture
  105. * 4-by-6
  106. * 5-by-5
  107. * 6-by-4
  108. * 7-by-10
  109. ==> passed
  110.  
  111. Test 5: Test height() with input file
  112. * 6x5.png
  113. * 4x6.png
  114. ==> passed
  115.  
  116. Test 6: Test height() with random N-by-M picture
  117. * 4-by-6
  118. * 5-by-5
  119. * 6-by-4
  120. * 7-by-10
  121. ==> passed
  122.  
  123. Test 7: Test findVerticalSeam() with random N-by-M pictures
  124. * 4-by-6
  125. * 5-by-5
  126. * 6-by-4
  127. * 7-by-10
  128. ==> passed
  129.  
  130. Test 8: Test findVerticalSeam() with file
  131. * 6x5.png
  132. * 4x6.png
  133. * 10x12.png
  134. * 3x7.png
  135. * 5x6.png
  136. * 7x3.png
  137. * 12x10.png
  138. ==> passed
  139.  
  140. Test 9: Test findHorizontalSeam() with random N-by-M pictures
  141. * 4-by-6
  142. * 5-by-5
  143. * 6-by-4
  144. * 7-by-10
  145. ==> passed
  146.  
  147. Test 10: Test findHorizontalSeam() with file
  148. * 6x5.png
  149. * 4x6.png
  150. * 10x12.png
  151. * 3x7.png
  152. * 5x6.png
  153. * 7x3.png
  154. * 12x10.png
  155. ==> passed
  156.  
  157. Test 11: Check whether exception is called if energy(i, j) are out of bounds
  158. * pic is 6-by-5, (i, j) = (-1, 4)
  159. * pic is 6-by-5, (i, j) = (6, 4)
  160. * pic is 6-by-5, (i, j) = (5, 5)
  161. * pic is 6-by-5, (i, j) = (4, -1)
  162. * pic is 6-by-5, (i, j) = (4, 5)
  163. ==> passed
  164.  
  165. Test 12: Test if exception is thrown if removeVerticalSeam() or removeHoriziontalSeam() array parameter is the wrong length
  166. * pic is 6-by-5, horizontal seam to remove is of length = (1)
  167. * pic is 6-by-5, horizontal seam to remove is of length = (5)
  168. * pic is 6-by-5, vertical seam to remove is of length = (1)
  169. * pic is 6-by-5, vertical seam to remove is of length = (6)
  170. ==> passed
  171.  
  172. Test 13: Check removeHorizontalSeam() and removeVerticalSeam() with null arguments
  173. * picture = 6x5.png
  174. * picture = 3x7.png
  175. ==> passed
  176.  
  177. Test 14: Test removeHorizontalSeam() with file
  178. * 6x5.png
  179. * 10x12.png
  180. * 3x7.png
  181. * 5x6.png
  182. * 7x3.png
  183. * 12x10.png
  184. ==> passed
  185.  
  186. Test 15: Test removeVerticalSeam() with random N-by-M pictures
  187. * 4-by-6
  188. * 5-by-5
  189. * 6-by-4
  190. * 7-by-10
  191. ==> passed
  192.  
  193. Test 16: Test removeVerticalSeam() with file
  194. * 6x5.png
  195. * 10x12.png
  196. * 3x7.png
  197. * 5x6.png
  198. * 7x3.png
  199. * 12x10.png
  200. ==> passed
  201.  
  202. Test 17: Test removeHorizontalSeam() with random N-by-M pictures
  203. * 4-by-4
  204. * 5-by-5
  205. * 6-by-6
  206. * 7-by-7
  207. ==> passed
  208.  
  209. Test 18: Check intermixed calls to findHorizontalSeam(), findVerticalSeam(), removeHorizontalSeam(), removeVerticalSeam(). Probabilities of calling each are p1, p2, p3, and p4 respectively. All calls to removal methods are based on randomly generated seams.
  210. * 50 calls in 100-by-100 image with probabilties p1=0.0, p2=0.0, p3=0.0, p4=1.0
  211. * 50 calls in 100-by-90 image with probabilties p1=0.0, p2=0.0, p3=1.0, p4=0.0
  212. * 50 calls in 90-by-100 image with probabilties p1=0.25, p2=0.25, p3=0.25, p4=0.25
  213. * 5 calls in 7-by-9 image with probabilties p1=0.25, p2=0.25, p3=0.25, p4=0.25
  214. * 5 calls in 7-by-9 image with probabilties p1=0.25, p2=0.25, p3=0.25, p4=0.25
  215. * 5 calls in 7-by-9 image with probabilties p1=0.25, p2=0.25, p3=0.25, p4=0.25
  216. * 5 calls in 9-by-7 image with probabilties p1=0.25, p2=0.25, p3=0.25, p4=0.25
  217. * 5 calls in 9-by-7 image with probabilties p1=0.25, p2=0.25, p3=0.25, p4=0.25
  218. * 5 calls in 9-by-7 image with probabilties p1=0.25, p2=0.25, p3=0.25, p4=0.25
  219. ==> passed
  220.  
  221. Test 19: Test findVerticalSeam() after call to removeVerticalSeam() with random images
  222. * 6x5.png
  223. * 10x12.png
  224. * 3x7.png
  225. * 5x6.png
  226. ==> passed
  227.  
  228.  
  229. Total: 19/19 tests passed!
  230.  
  231. ================================================================
  232.  
  233. ******************************************************************************
  234. * memory usage
  235. ******************************************************************************
  236.  
  237. Computing memory of SeamCarver
  238. *-----------------------------------------------------------
  239. Running 7 total tests.
  240.  
  241. Memory usage of a SeamCarver after removing 5 horizontal seams from a WxH image.
  242. Maximum allowed memory is 5x the reference.
  243.  
  244. W, H student (bytes) reference (bytes)
  245. --------------------------------------------------------------
  246. => passed 10 1792 1792
  247. => passed 20 2792 2792
  248. => passed 25 3592 3592
  249. => passed 40 7192 7192
  250. => passed 80 25592 25592
  251. => passed 100 39600 39600
  252. => passed 200 157600 157600
  253. ==> 7/7 tests passed
  254.  
  255. Total: 7/7 tests passed!
  256.  
  257. Estimated student memory (bytes) = 4.00 N^2 + -19.93 N + 1590.41 (R^2 = 1.000)
  258. Estimated reference memory (bytes) = 4.00 N^2 + -19.93 N + 1590.41 (R^2 = 1.000)
  259. ================================================================
  260.  
  261.  
  262.  
  263. ******************************************************************************
  264. * timing
  265. ******************************************************************************
  266.  
  267. Timing SeamCarver
  268. *-----------------------------------------------------------
  269. Running 6 total tests.
  270.  
  271. Finding 50 seams but not removing them for a 250-by-250 image
  272. width height h-seams v-seams find remove time
  273. ----------------------------------------------------------------
  274. 250 250 50 0 true false 2.04
  275. 250 250 0 50 true false 1.81
  276. 250 250 25 25 true false 1.74
  277. => PASSED
  278.  
  279. Removing 50 randomly generated non-optimal seams for a 250-by-250 image
  280. width height h-seams v-seams find remove time
  281. ----------------------------------------------------------------
  282. 250 250 50 0 false true 0.31
  283. 250 250 0 50 false true 0.29
  284. 250 250 25 25 false true 0.25
  285. => PASSED
  286.  
  287. Finding and removing 50 seams for a 250-by-250 image
  288. width height h-seams v-seams find remove time
  289. ----------------------------------------------------------------
  290. 250 250 50 0 true true 1.84
  291. 250 250 0 50 true true 1.90
  292. 250 250 25 25 true true 2.21
  293. => PASSED
  294.  
  295. Finding 50 seams but not removing them for a 500-by-500 image
  296. width height h-seams v-seams find remove time
  297. ----------------------------------------------------------------
  298. 500 500 50 0 true false 7.94
  299. 500 500 0 50 true false 7.45
  300. 500 500 25 25 true false 7.71
  301. => PASSED
  302.  
  303. Removing 50 randomly generated non-optimal seams for a 500-by-500 image
  304. width height h-seams v-seams find remove time
  305. ----------------------------------------------------------------
  306. 500 500 50 0 false true 1.21
  307. 500 500 0 50 false true 1.06
  308. 500 500 25 25 false true 1.18
  309. => PASSED
  310.  
  311. Finding and removing 50 seams for a 500-by-500 image
  312. width height h-seams v-seams find remove time
  313. ----------------------------------------------------------------
  314. 500 500 50 0 true true 8.41
  315. 500 500 0 50 true true 8.02
  316. 500 500 25 25 true true 8.05
  317. => PASSED
  318.  
  319.  
  320. Total: 6/6 tests passed!
  321.  
  322. ================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement