You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Tests for graph maintenance consistency in the D* Lite algorithm.
33
+
* These tests verify that the graph state after invalidation and pruning
34
+
* is consistent with a fresh graph created with the same blocked nodes.
35
+
*/
36
+
classGraphConsistencyTest {
37
+
@Test
38
+
fun`graph consistency N6`() {
39
+
val startNode = fastVectorOf(0, 0, 5)
40
+
val goalNode = fastVectorOf(0, 0, 0)
41
+
val blockedNodes = mutableSetOf<FastVector>()
42
+
val graph1 = createGridGraph6Conn(blockedNodes)
43
+
val dStar1 =DStarLite(graph1, startNode, goalNode, ::euclideanHeuristic)
44
+
dStar1.computeShortestPath()
45
+
val initialPath = dStar1.path()
46
+
47
+
val blockedNode = fastVectorOf(0, 0, 4)
48
+
blockedNodes.add(blockedNode)
49
+
50
+
dStar1.invalidate(blockedNode)
51
+
dStar1.computeShortestPath()
52
+
val path1 = dStar1.path()
53
+
54
+
assertTrue(initialPath.size < path1.size, "Initial path size (${initialPath.size}) is less than blocked path size (${path1.size})")
55
+
56
+
val graph2 = createGridGraph6Conn(blockedNodes)
57
+
val dStar2 =DStarLite(graph2, startNode, goalNode, ::euclideanHeuristic)
58
+
dStar2.computeShortestPath()
59
+
val path2 = dStar2.path()
60
+
61
+
assertEquals(path1, path2, "Graph consistency test failed for N6 graph with blocked node at ${blockedNode.string}.\nPath1: ${path1.string()}\nPath2: ${path2.string()}")
62
+
63
+
val (graphDifferences, valueDifferences) = dStar1.compareWith(dStar2)
0 commit comments