Skip to content

Commit

Permalink
Remove block area (graphhopper#2741)
Browse files Browse the repository at this point in the history
  • Loading branch information
easbar committed Feb 7, 2023
1 parent f6b1a1b commit aa71dc2
Show file tree
Hide file tree
Showing 17 changed files with 95 additions and 637 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- internal keys for EdgeKVStorage changed to contain the street_ prefix like the path details too. Similarly, the
extra_info in the instructions of the API response, see #2661
- subnetwork preparation can now be run in parallel to slightly speed up the base graph import (#2737)
- The block_area parameter was removed. Use custom model areas instead.

### 6.0 [13 Sep 2022]

Expand Down
15 changes: 5 additions & 10 deletions benchmark/benchmark.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ graph.location=${GRAPH_DIR}measurement-small-gh \
prepare.min_network_size=10000 \
measurement.json=true \
measurement.count=5000 \
measurement.use_measurement_time_as_ref_time=${USE_MEASUREMENT_TIME_AS_REF_TIME} \
"measurement.block_area=49.394664,11.144428,49.348388,11.144943,49.355768,11.227169,49.411643,11.227512"
measurement.use_measurement_time_as_ref_time=${USE_MEASUREMENT_TIME_AS_REF_TIME}

echo "2 - big map: node-based CH + landmarks (edge- & node-based for LM) + slow routing"
java -cp tools/target/graphhopper-tools-*-jar-with-dependencies.jar \
Expand Down Expand Up @@ -90,8 +89,7 @@ graph.location=${GRAPH_DIR}measurement-big-gh \
prepare.min_network_size=10000 \
measurement.json=true \
measurement.count=5000 \
measurement.use_measurement_time_as_ref_time=${USE_MEASUREMENT_TIME_AS_REF_TIME} \
"measurement.block_area=49.394664,11.144428,49.348388,11.144943,49.355768,11.227169,49.411643,11.227512"
measurement.use_measurement_time_as_ref_time=${USE_MEASUREMENT_TIME_AS_REF_TIME}

echo "3 - big map with a custom model that is 'a little customized', i.e. similar to the standard fastest-car profile"
echo "node-based CH + LM"
Expand Down Expand Up @@ -122,8 +120,7 @@ graph.location=${GRAPH_DIR}measurement-big-little-custom-gh \
prepare.min_network_size=10000 \
measurement.json=true \
measurement.count=5000 \
measurement.use_measurement_time_as_ref_time=${USE_MEASUREMENT_TIME_AS_REF_TIME} \
"measurement.block_area=49.394664,11.144428,49.348388,11.144943,49.355768,11.227169,49.411643,11.227512"
measurement.use_measurement_time_as_ref_time=${USE_MEASUREMENT_TIME_AS_REF_TIME}

echo "4 - big map with a custom model that is 'very customized', i.e. has many custom weighting rules"
echo "node-based CH + LM"
Expand Down Expand Up @@ -154,8 +151,7 @@ graph.location=${GRAPH_DIR}measurement-big-very-custom-gh \
prepare.min_network_size=10000 \
measurement.json=true \
measurement.count=5000 \
measurement.use_measurement_time_as_ref_time=${USE_MEASUREMENT_TIME_AS_REF_TIME} \
"measurement.block_area=49.394664,11.144428,49.348388,11.144943,49.355768,11.227169,49.411643,11.227512"
measurement.use_measurement_time_as_ref_time=${USE_MEASUREMENT_TIME_AS_REF_TIME}

echo "5 - big map, outdoor: node-based CH + landmarks (edge- & node-based for LM)"
java -cp tools/target/graphhopper-tools-*-jar-with-dependencies.jar \
Expand Down Expand Up @@ -183,5 +179,4 @@ graph.location=${GRAPH_DIR}measurement-big-outdoor-gh \
prepare.min_network_size=10000 \
measurement.json=true \
measurement.count=5000 \
measurement.use_measurement_time_as_ref_time=${USE_MEASUREMENT_TIME_AS_REF_TIME} \
"measurement.block_area=49.394664,11.144428,49.348388,11.144943,49.355768,11.227169,49.411643,11.227512"
measurement.use_measurement_time_as_ref_time=${USE_MEASUREMENT_TIME_AS_REF_TIME}
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ public Weighting createWeighting(Profile profile, PMap requestHints, boolean dis
// Merge profile hints with request hints, the request hints take precedence.
// Note that so far we do not check if overwriting the profile hints actually works with the preparation
// for LM/CH. Later we should also limit the number of parameters that can be used to modify the profile.
// todo: since we are not dealing with block_area here yet we cannot really apply any merging rules
// for it, see discussion here: https://github.com/graphhopper/graphhopper/pull/1958#discussion_r395462901
PMap hints = new PMap();
hints.putAll(profile.getHints());
hints.putAll(requestHints);
Expand Down
21 changes: 5 additions & 16 deletions core/src/main/java/com/graphhopper/routing/Router.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,11 @@
import com.graphhopper.routing.lm.LandmarkStorage;
import com.graphhopper.routing.querygraph.QueryGraph;
import com.graphhopper.routing.util.*;
import com.graphhopper.routing.weighting.BlockAreaWeighting;
import com.graphhopper.routing.weighting.Weighting;
import com.graphhopper.routing.weighting.custom.CustomProfile;
import com.graphhopper.routing.weighting.custom.FindMinMax;
import com.graphhopper.storage.BaseGraph;
import com.graphhopper.storage.Graph;
import com.graphhopper.storage.GraphEdgeIdFinder;
import com.graphhopper.storage.RoutingCHGraph;
import com.graphhopper.storage.index.LocationIndex;
import com.graphhopper.storage.index.Snap;
Expand Down Expand Up @@ -104,7 +102,7 @@ public GHResponse route(GHRequest request) {
checkHeadings(request);
checkPointHints(request);
checkCurbsides(request);
checkNoBlockAreaWithCustomModel(request);
checkNoBlockArea(request);

Solver solver = createSolver(request);
solver.checkRequest();
Expand Down Expand Up @@ -177,9 +175,9 @@ private void checkCurbsides(GHRequest request) {
throw new IllegalArgumentException("If you pass " + CURBSIDE + ", you need to pass exactly one curbside for every point, empty curbsides will be ignored");
}

private void checkNoBlockAreaWithCustomModel(GHRequest request) {
if (request.getCustomModel() != null && request.getHints().has(BLOCK_AREA))
throw new IllegalArgumentException("When using `custom_model` do not use `block_area`. Use `areas` in the custom model instead");
private void checkNoBlockArea(GHRequest request) {
if (request.getHints().has("block_area"))
throw new IllegalArgumentException("The `block_area` parameter is no longer supported. Use a custom model with `areas` instead.");
}

protected Solver createSolver(GHRequest request) {
Expand Down Expand Up @@ -428,9 +426,6 @@ protected void checkRequest() {
if (getPassThrough(request.getHints()))
throw new IllegalArgumentException("The '" + Parameters.Routing.PASS_THROUGH + "' parameter is currently not supported for speed mode, you need to disable speed mode with `ch.disable=true`. See issue #1765");

if (request.getHints().has(Parameters.Routing.BLOCK_AREA))
throw new IllegalArgumentException("The '" + Parameters.Routing.BLOCK_AREA + "' parameter is currently not supported for speed mode, you need to disable speed mode with `ch.disable=true`.");

if (request.getCustomModel() != null)
throw new IllegalArgumentException("The 'custom_model' parameter is currently not supported for speed mode, you need to disable speed mode with `ch.disable=true`.");

Expand Down Expand Up @@ -492,13 +487,7 @@ protected void checkRequest() {
protected Weighting createWeighting() {
PMap requestHints = new PMap(request.getHints());
requestHints.putObject(CustomModel.KEY, request.getCustomModel());
Weighting weighting = weightingFactory.createWeighting(profile, requestHints, false);
if (requestHints.has(Parameters.Routing.BLOCK_AREA)) {
GraphEdgeIdFinder.BlockArea blockArea = GraphEdgeIdFinder.createBlockArea(baseGraph, locationIndex,
request.getPoints(), requestHints, new FiniteWeightFilter(weighting));
weighting = new BlockAreaWeighting(weighting, blockArea);
}
return weighting;
return weightingFactory.createWeighting(profile, requestHints, false);
}

@Override
Expand Down

This file was deleted.

Loading

0 comments on commit aa71dc2

Please sign in to comment.