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

Improve Weighting class #831

Closed
karussell opened this issue Oct 13, 2016 · 0 comments
Closed

Improve Weighting class #831

karussell opened this issue Oct 13, 2016 · 0 comments

Comments

@karussell
Copy link
Member

karussell commented Oct 13, 2016

Copied from PR #807

I'm not satisfied here. We would need to break API again if we have to calculate time, distance, transfers, weight in a routing algo like Dijkstra. Currently we just calculate the weight.

Now I'm thinking about a new class WeightingResult with time, distance, weight, ... and just one method:

class Weighting {
  void calculate(WeightingResult res, EdgeIteratorState edge, boolean reverse, int prevEdge);
  // or for easier backward compatibility returning the first parameter:
 // WeightingResult calculate(WeightingResult, EdgeIteratorState, reverse, prevEdge);
}

Then we could easily fill the time or weight etc in this method. It would be even more customizable as we could subclass WeightingResult and add parameters. We could even replace TurnWeighting when we store the turnCosts in the WeightingResult (or a subclass).

Another advantage is that we currently would calculate the weighting and then the 'millis' but this work of calculating the time is already (often) done in calculating the weighting and so it would be duplicative which we can avoid via this new method.

One problem remains: how we incorporate the time stuff currently required for the pt branch.

We can avoid the reverse parameter if that is handled from the EdgeIterator:

iter = explorer.setBaseNode(node, reverse);

@karussell karussell added this to the 0.9 milestone Oct 13, 2016
This was referenced Oct 18, 2016
@karussell karussell modified the milestones: 0.10, 0.9 May 2, 2017
@karussell karussell removed this from the 0.10 milestone Nov 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant