Search in sources :

Example 1 with AStarBidirection

use of com.graphhopper.routing.AStarBidirection in project graphhopper by graphhopper.

the class MapMatching method createRouter.

private BidirRoutingAlgorithm createRouter() {
    BidirRoutingAlgorithm router;
    if (landmarks != null) {
        AStarBidirection algo = new AStarBidirection(queryGraph, weighting, TraversalMode.EDGE_BASED) {

            @Override
            protected void initCollections(int size) {
                super.initCollections(50);
            }
        };
        int activeLM = Math.min(8, landmarks.getLandmarkCount());
        algo.setApproximation(LMApproximator.forLandmarks(queryGraph, landmarks, activeLM));
        algo.setMaxVisitedNodes(maxVisitedNodes);
        router = algo;
    } else {
        router = new DijkstraBidirectionRef(queryGraph, weighting, TraversalMode.EDGE_BASED) {

            @Override
            protected void initCollections(int size) {
                super.initCollections(50);
            }
        };
        router.setMaxVisitedNodes(maxVisitedNodes);
    }
    return router;
}
Also used : AStarBidirection(com.graphhopper.routing.AStarBidirection) DijkstraBidirectionRef(com.graphhopper.routing.DijkstraBidirectionRef) BidirRoutingAlgorithm(com.graphhopper.routing.BidirRoutingAlgorithm)

Aggregations

AStarBidirection (com.graphhopper.routing.AStarBidirection)1 BidirRoutingAlgorithm (com.graphhopper.routing.BidirRoutingAlgorithm)1 DijkstraBidirectionRef (com.graphhopper.routing.DijkstraBidirectionRef)1