diff --git a/README.md b/README.md index 905a8a9..fc0679e 100644 --- a/README.md +++ b/README.md @@ -82,7 +82,7 @@ Solution found! 15 14 7 6 Total solutions: 1 -Total time: 90.49 ms +Total time: 77 Total number of iterations: 398 + Solution 1: - States: @@ -99,7 +99,7 @@ What is this output? The output includes the challenge requirements to display the completed board. -It also displays `Additional details...` which is provided by Hipster to show which states were used, and actions taken. +It also displays `Additional details...` which is provided by Hipster to show the time taken in milliseconds, what actions were taken and states generated. Items in the list of states are of the form (x,y)=v. The `x` and `y` values are the coordinate location in the board, and `v` is the value at this spot. @@ -107,9 +107,9 @@ Items in the list of states are of the form (x,y)=v. The `x` and `y` values are Performance =========== -Below are the run times for sample input files. +Below are the run times in milliseconds for sample input files. -**SampleInput1.txt** : `Total time: 5.656 s` +**SampleInput1.txt** : `Total time: 5830` (5.8 s) ``` XX XX XX XX -- 53 XX XX XX XX XX XX XX XX -- -- XX XX XX XX @@ -123,7 +123,7 @@ XX XX XX XX -- -- XX XX XX XX XX XX XX XX 7 -- XX XX XX XX ``` -**SampleInput2.txt** : `Total time: 118.7 ms` +**SampleInput2.txt** : `Total time: 121` (121 ms) ``` -- 33 35 -- -- XX XX XX -- -- 24 22 -- XX XX XX @@ -135,14 +135,14 @@ XX XX XX XX -- 7 -- -- XX XX XX XX XX XX 5 -- ``` -**SampleInput3_impossible.txt** : `Total time: 0 ms` +**SampleInput3_impossible.txt** : `Total time: 0 ms` (0 ms) ``` XX XX XX XX XX XX 1 XX -- XX XX XX XX XX XX ``` -**SampleInput4.txt** : `Total time: 747.7 ms` +**SampleInput4.txt** : `Total time: 911` (911 ms) ``` 30 -- 26 -- 16 -- -- 11 -- -- -- 18 -- -- -- 9 @@ -154,7 +154,7 @@ XX XX XX XX XX 61 -- -- -- -- -- 46 -- ``` -**SampleInput5.txt** : `Total time: 1.216 s` +**SampleInput5.txt** : `Total time: 1343` (1.3 s) ``` -- -- -- -- 39 XX XX XX -- -- 7 40 -- XX XX XX @@ -166,7 +166,7 @@ XX XX XX XX -- 19 21 -- XX XX XX XX XX XX -- 23 ``` -**SampleInput6.txt** : `Total time: 83.21 ms` +**SampleInput6.txt** : `Total time: 77` (77 ms) ``` -- -- -- -- 12 -- 1 -- @@ -201,6 +201,7 @@ Where appropriate I used streams instead of for loops. So instead of iterating o * Ordering which filter conditions are checked first by their "effort" increased performance. * Care should be taken to check the heuristic is actually working. + References ========== diff --git a/pom.xml b/pom.xml index 0cea9f3..99d3b6e 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ es.usc.citius.hipster hipster-core - 1.0.0-rc1 + 1.0.0-rc2 junit diff --git a/src/main/java/hidatohippy/HidatoBoardSearcher.java b/src/main/java/hidatohippy/HidatoBoardSearcher.java index fde71fe..721cd07 100644 --- a/src/main/java/hidatohippy/HidatoBoardSearcher.java +++ b/src/main/java/hidatohippy/HidatoBoardSearcher.java @@ -3,8 +3,6 @@ import java.util.ArrayList; import java.util.List; -import com.google.common.base.Predicate; - import es.usc.citius.hipster.algorithm.Algorithm; import es.usc.citius.hipster.algorithm.Hipster; import es.usc.citius.hipster.model.Transition; @@ -15,6 +13,7 @@ import es.usc.citius.hipster.model.impl.WeightedNode; import es.usc.citius.hipster.model.problem.ProblemBuilder; import es.usc.citius.hipster.model.problem.SearchProblem; +import es.usc.citius.hipster.util.Predicate; public class HidatoBoardSearcher { @@ -45,6 +44,8 @@ public static Algorithm> predicate = getPredicateFunction(); + + Predicate emptyTest = s -> s.isEmpty(); return Hipster.createAStar(problem).search(predicate); } diff --git a/src/test/java/hidatohippy/HidatoBoardSearcherTest.java b/src/test/java/hidatohippy/HidatoBoardSearcherTest.java index e090335..04f638c 100644 --- a/src/test/java/hidatohippy/HidatoBoardSearcherTest.java +++ b/src/test/java/hidatohippy/HidatoBoardSearcherTest.java @@ -10,12 +10,11 @@ import org.junit.Test; -import com.google.common.base.Predicate; - import es.usc.citius.hipster.model.function.ActionFunction; import es.usc.citius.hipster.model.impl.WeightedNode; import es.usc.citius.hipster.model.problem.ProblemBuilder; import es.usc.citius.hipster.model.problem.SearchProblem; +import es.usc.citius.hipster.util.Predicate; public class HidatoBoardSearcherTest {