Skip to content

Use Weighting.calcMillis instead of Path.calcMillis, fixes #393 - #807

Closed
karussell wants to merge 4 commits into
masterfrom
issue_393
Closed

karussell wants to merge 4 commits into
masterfrom
issue_393

Conversation

@karussell

@karussell karussell commented Sep 26, 2016 •

Copy link
Copy Markdown
Member

This allows the user to create a custom Weighting which also changes the time calculation and a time delay can be now stored in the edge flags

Fixes #393

TODOs:

  • add a test for this new flexibility
  • test performance

Would highly appreciate feedback as this changes the internals a bit. Also if we should assume for now that turn costs are in seconds or if we need a separate method (getTurnWeight vs. getTurnMillis)

@karussell karussell added this to the 0.8 milestone Sep 26, 2016
@karussell

Copy link
Copy Markdown
Member Author

Merged via: 0bf6b14

@karussell karussell closed this Sep 28, 2016
@karussell

karussell commented Oct 3, 2016 •

Copy link
Copy Markdown
Member Author

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 required for the pt branch.

@karussell
karussell deleted the issue_393 branch October 6, 2016 19:49
@karussell karussell modified the milestones: 0.9, 0.8 Oct 13, 2016
@easbar

easbar commented Aug 24, 2019

Copy link
Copy Markdown
Member

But isn't it like we are calculating only the weight while the routing algorithms are running and the distance/time is calculated while we are unpacking the path path anyway ?

@karussell

Copy link
Copy Markdown
Member Author

WeightingResult is definitely the wrong name ;) ... as I meant e.g. time as input parameter.

For time-dependent algorithms we need the time as additional input parameter to consider time dependent costs (weights).

Maybe we allow input parameters like time (and transfers, turns) and output parameters like travel cost, travel time and turn costs?

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.

Improve time calculation for turn costs

2 participants