use of com.graphhopper.routing.ev.DecimalEncodedValue in project graphhopper by graphhopper.
the class LMIssueTest method lm_issue2.
@ParameterizedTest
@EnumSource
public void lm_issue2(Algo algo) {
// Before #1745 This would fail for LM, because an underrun of 'delta' would not be treated correctly,
// and the remaining weight would be over-approximated
// ---
// / \
// 0 - 1 - 5 - 6 - 9 - 4 - 0
// \ /
// ->-
NodeAccess na = graph.getNodeAccess();
DecimalEncodedValue speedEnc = encoder.getAverageSpeedEnc();
na.setNode(0, 49.406987, 9.709767);
na.setNode(1, 49.403612, 9.702953);
na.setNode(2, 49.409755, 9.706517);
na.setNode(3, 49.409021, 9.708649);
na.setNode(4, 49.400674, 9.700906);
na.setNode(5, 49.408735, 9.709486);
na.setNode(6, 49.406402, 9.700937);
na.setNode(7, 49.406965, 9.702660);
na.setNode(8, 49.405227, 9.702863);
na.setNode(9, 49.409411, 9.709085);
GHUtility.setSpeed(112, true, true, encoder, graph.edge(0, 1).setDistance(623.197000));
GHUtility.setSpeed(13, true, true, encoder, graph.edge(5, 1).setDistance(741.414000));
GHUtility.setSpeed(35, true, true, encoder, graph.edge(9, 4).setDistance(1140.835000));
GHUtility.setSpeed(18, true, true, encoder, graph.edge(5, 6).setDistance(670.689000));
GHUtility.setSpeed(88, true, false, encoder, graph.edge(5, 9).setDistance(80.731000));
GHUtility.setSpeed(82, true, true, encoder, graph.edge(0, 9).setDistance(273.948000));
GHUtility.setSpeed(60, true, true, encoder, graph.edge(4, 0).setDistance(956.552000));
preProcessGraph();
int source = 5;
int target = 4;
Path refPath = new DijkstraBidirectionRef(graph, weighting, NODE_BASED).calcPath(source, target);
Path path = createAlgo(algo).calcPath(source, target);
assertEquals(refPath.getWeight(), path.getWeight(), 1.e-2);
assertEquals(refPath.getDistance(), path.getDistance(), 1.e-1);
assertEquals(refPath.getTime(), path.getTime(), 50);
assertEquals(refPath.calcNodes(), path.calcNodes());
}
Aggregations