Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature maximum visited nodes #681

Merged
merged 1 commit into from
Mar 10, 2016

Conversation

boldtrn
Copy link
Member

@boldtrn boldtrn commented Mar 9, 2016

This PR contains the ability to limit the number of visitedNodes that a non-ch RoutingAlgorithm visits.

This can be specified in the config and via an URL parameter.

Fixes #473 and therefor #104

@boldtrn
Copy link
Member Author

boldtrn commented Mar 9, 2016

@karussell I think we have an issue with our current travis configuration. I forgot to run the whole test-suite before pushing and it failed for me locally. Since the js tests succeed, travis seems to think that all tests succeed. Btw, I am currently fixing the issues ;).

@boldtrn
Copy link
Member Author

boldtrn commented Mar 9, 2016

Ok. PR should be fine. What do you think?


protected boolean isMaxVisitedNodesExceeded()
{
return maxVisitedNodes > getVisitedNodes();
Copy link
Member

Choose a reason for hiding this comment

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

here is a minor mistake

Copy link
Member

Choose a reason for hiding this comment

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

but not important to add a test as we have your nice PR soon and throw this away :)

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah yes, we can actually delete the isMaxVisitedNodesExceeded method, since it is not used here. We delegate the maxVisitedNodes to the Dijkstra and the Dijkstra cares about the maxVisistedNodes.

@karussell
Copy link
Member

Thanks - looks really good!

I think we have an issue with our current travis configuration. I forgot to run the
whole test-suite before pushing and it failed for me locally. Since the js tests succeed,
travis seems to think that all tests succeed.

Do you mean that although tests are failing locally, travis is fine with it because only the JS tests are passing?

@@ -1093,10 +1096,15 @@ public GHResponse route( GHRequest request )
QueryResult fromQResult = qResults.get(0);

double weightLimit = request.getHints().getDouble("defaultWeightLimit", defaultWeightLimit);
int maxVisistedNodesForRequest = request.getHints().getInt("routing.max_visited_nodes", maxVisitedNodes);
Copy link
Contributor

Choose a reason for hiding this comment

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

Here the parameter shouldn't be plain "max_visited_nodes" ?

Copy link
Member

Choose a reason for hiding this comment

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

problem is that we are very inconsistent with this and it has a reason: from URL or JS one expects some_thing from within Java one expects someThing. What we could do is internally convert all someThing into some_thing or migrate all remaining someThing to my preferred naming some_thing "somehow"

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes we can change the name in both cases (config and url) so we do not have the routing. in front. I thought it would be better understandable since the number of parameters is growing.

Copy link
Member

Choose a reason for hiding this comment

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

The routing in front is good as indeed the count is growing. Also please for now use someThing notation - I've created #682 to make everything more consistent or to be able to use both.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok, so I shall use camel case in the url, as well?

@boldtrn
Copy link
Member Author

boldtrn commented Mar 9, 2016

Do you mean that although tests are failing locally, travis is fine with it because only the JS tests are passing?

Yes, have a look at this test. It fails but travis does not fail https://travis-ci.org/graphhopper/graphhopper/jobs/114835803#L1152

@karussell
Copy link
Member

Yes, have a look at this test.

Outch - ugly! Thanks for finding this!

@boldtrn
Copy link
Member Author

boldtrn commented Mar 10, 2016

Ok, I updated my branch. I renamed the URL parameter using camelCase.

@karussell
Copy link
Member

Thanks a lot! One minor in the exception -> routing.max_visited_nodes. Would you also squash the commits into one?

@boldtrn boldtrn force-pushed the feature_maximum_visited_nodes branch from a90fe6a to 7046e05 Compare March 10, 2016 09:29
Fixed some formatting issues

Added security catch if URL parameter contains values greater than the configured

Fixed failing Tests

Updated according to comments

Updated according to comments

Update
@boldtrn boldtrn force-pushed the feature_maximum_visited_nodes branch from 7046e05 to c5b6b7f Compare March 10, 2016 09:33
@boldtrn
Copy link
Member Author

boldtrn commented Mar 10, 2016

Squashed it

karussell added a commit that referenced this pull request Mar 10, 2016
Limit search via maximum visited nodes. Fixes #473
@karussell karussell merged commit 2b34274 into graphhopper:master Mar 10, 2016
@karussell
Copy link
Member

Thanks - merged!

@karussell karussell added this to the 0.7 milestone Mar 10, 2016
@boldtrn boldtrn deleted the feature_maximum_visited_nodes branch October 6, 2017 01:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants