Repository navigation
Conversation
|
Merged via: 0bf6b14 |
|
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 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 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 |
|
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 ? |
|
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? |
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:
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)