Better tests for the square map
這個提交存在於:
父節點
25e08fc7f0
當前提交
5e75797cda
共有 1 個檔案被更改,包括 12 行新增 和 6 行删除
|
|
@ -66,15 +66,21 @@ public abstract class ShortestPathTest {
|
|||
assertTrue(sol.isFeasible());
|
||||
Path path = sol.getPath();
|
||||
assertTrue(path.isValid());
|
||||
// skip these tests for the square map where there may be several arcs with the same cost
|
||||
// check the optimality locally
|
||||
if (arcInspector == arcInspectors[0])
|
||||
assertEquals(path, Path.createShortestPathFromNodes(data.getGraph(), path.getNodes()));
|
||||
if (arcInspector == arcInspectors[1])
|
||||
assertEquals(path, Path.createFastestPathFromNodes(data.getGraph(), path.getNodes()));
|
||||
|
||||
// skip this test for the square map where there may be several paths with the same cost
|
||||
if (i != 0) {
|
||||
// check the optimality locally
|
||||
if (arcInspector == arcInspectors[0])
|
||||
assertEquals(path, Path.createShortestPathFromNodes(data.getGraph(), path.getNodes()));
|
||||
if (arcInspector == arcInspectors[1])
|
||||
assertEquals(path, Path.createFastestPathFromNodes(data.getGraph(), path.getNodes()));
|
||||
// Check result against Bellman Ford algorithm
|
||||
assertEquals(sol.getPath(), oracle.getPath());
|
||||
} else { // in the square map case, compare only the costs
|
||||
if (arcInspector == arcInspectors[0])
|
||||
assertEquals(sol.getPath().getLength(), oracle.getPath().getLength(), 1e-5);
|
||||
if (arcInspector == arcInspectors[1])
|
||||
assertEquals(sol.getPath().getMinimumTravelTime(), oracle.getPath().getMinimumTravelTime(), 1e-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
載入中…
新增問題並參考