Commit 4be49a4e authored by Julian Zobel's avatar Julian Zobel
Browse files

WIP: More parameters for GH alternative routes

parent c72090d9
......@@ -219,8 +219,10 @@ public class RealWorldStreetsMovement extends AbstractLocalMovementStrategy {
req.getHints().put(Routing.BLOCK_AREA, blockedAreas);
}
if(allowAlternativeRoutes) {
req.setAlgorithm(Parameters.Algorithms.ALT_ROUTE);
req.getHints().put(Parameters.Algorithms.AltRoute.MAX_PATHS, "5");
// see: https://discuss.graphhopper.com/t/alternative-routes/424/11
req.setAlgorithm(Parameters.Algorithms.ALT_ROUTE);
req.getHints().put(Parameters.Algorithms.AltRoute.MAX_WEIGHT, "2.0"); // how much longer can alternatives be?
req.getHints().put(Parameters.Algorithms.AltRoute.MAX_PATHS, "5"); // how much alternatives should be returned at max?
}
......@@ -247,9 +249,11 @@ public class RealWorldStreetsMovement extends AbstractLocalMovementStrategy {
if(random.nextDouble() <= probabilityForAlternativeRoute) {
List<PathWrapper> paths = rsp.getAll();
System.out.println(paths.size());
pointList = rsp.getAll().get(1).getPoints();
int pick = random.nextInt(paths.size() - 1) + 1;
System.out.println(pick + " / " + paths.size());
pointList = rsp.getAll().get(pick).getPoints();
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment