Skip to content

Improve Weighting class #831

Closed
Closed

Description

@karussell

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);

Activity

  1. added this to the 0.9 milestone on Oct 13, 2016
  2. modified the milestones: 0.10, 0.9 on May 2, 2017
  3. removed this from the 0.10 milestone on Nov 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions