Skip to content

Choose edge-based CH if it was prepared and the edge_based parameter was not set - #1706

Merged
easbar merged 13 commits into
masterfrom
use_edge_based_ch_issue1637
Sep 7, 2019
Merged

easbar merged 13 commits into
masterfrom
use_edge_based_ch_issue1637

Conversation

@easbar

@easbar easbar commented Aug 28, 2019

Copy link
Copy Markdown
Member

This fixes #1637 and is based on #1705.

When we are determining the traversal mode and when the edge_based parameter is missing, we check what CH preparations are there (instead of looking at the turn cost support of the encoder as for non-CH).

So with this change we do no longer need to set edge_based=true to get edge-based CH and instead edge-based CH is picked automatically if it was prepared (if not we fall back to node-based CH). If edge_based is set on the request its value is respected (and there will be an error if the specified preparation is missing).

Note that with this PR we now choose edge-based CH when there are node and edge-based CH preparations for the chosen weighting and the edge_based parameter was not set.

@easbar easbar changed the title Use edge based ch issue1637 Choose edge-based CH if it was prepared and the edge_based parameter was not set Aug 28, 2019
easbar added 3 commits August 29, 2019 06:35
# Conflicts:
#	core/files/changelog.txt
#	reader-osm/src/test/java/com/graphhopper/GraphHopperIT.java
Comment thread core/files/changelog.txt Outdated
CH graphs are now identified using CHProfile instead of Weighting, #1670
removed the 'traversal_mode` request parameter for /route, instead of 'traversal_mode=edge_based_2dir' use edge_based=true
removed GraphHopper.set/getTraversalMode() methods, #1705
removed the 'traversal_mode` request parameter for /route, instead of 'traversal_mode=edge_based_2dir' use edge_based=true

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a merge conflict and duplicated?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah sorry yes

} else {
return nodeBasedPCH;
}
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to reduce the nesting a bit? E.g. (or is this then too unreadable?)

if (edgeBased && edgeBasedPCH != null)
    return edgeBasedPCH;

if (!edgeBased && nodeBasedPCH != null)
    return nodeBasedPCH;

String str = edgeBased? 
  "Found a node-based CH preparation for weighting map " + map + ", but requested edge-based CH :
  "Found an edge-based CH preparation for weighting map " + map + ", but requested node-based CH : 
throw new IllegalArgumentException(str + ". You either need to configure edge-based CH preparation or set the '" + Parameters.Routing.EDGE_BASED 
+ "' parameter to '"+!edgeBased+"' (was '"+edgeBased+"'). all entries: " + entriesStrs);

and

return edgeBasedPCH != null ? edgeBasedPCH : nodeBasedPCH;

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok yes I did this. there was an error in the error message as well ('need to configure node-based' instead of 'need to configure edge-based' in the second case)

@karussell karussell added this to the 0.13 milestone Sep 6, 2019
@easbar
easbar merged commit df0ca50 into master Sep 7, 2019
@easbar
easbar deleted the use_edge_based_ch_issue1637 branch September 7, 2019 05:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

If only edge based CH is prepared no error should be thrown

2 participants