Skip to content

Speed comparison for A* #506

Closed
Closed

Description

@karussell

You can choose bidirectional A* or A* with a bit heuristic for maximum speed, increasing epsilon (weight*epsilon) in the weight estimation.

The area is Saxony with none-CH car routing:

algorithm epsilon av. query / ms av. dist / km av. visited node
A* 1 92.2 110.81 104K
A* 1.5 50.5 110.69 56K
A* 2 31.7 109.4 30K
bidir Dijkstra - 83.9 110.81 111K

(A* uses astar.approximation=BeelineSimplification)

The bidirectional case of A* (with astarbi.approximation=BeelineSimplification) is 40% faster and shows nice behaviour for epsilon < 1.8:

algorithm epsilon av. query / ms av. dist / km av. visited node
bidir A* 1 65.4 110.81 57K
bidir A* 1.8 34.7 110.82 29K
bidir A* 2 29.1 110.65 25K

But for CH the A* is not better and the 'epsilon speedup' is not measurable (still always the risc of heuristical results):

algorithm epsilon av. query / ms av. dist / km av. visited node
bidir Dijkstra CH - 2.02 104.1 291
bidir A* CH 1 2.17 104.1 287
bidir A* CH 1.8 1.90 104.1 287
bidir A* CH 2 2.11 104.1 287

TODOs

  • measure the weight instead of the average distance as suboptimal "fastest weighting" results could be shorter and also longer

Notes:

  • Which means accepting a bit heuristics your queries could get dramatically faster.
  • Take care when introducing heuristics and keep this in mind as the returned route is not necessarily optimal (but for small epsilons it cannot be longer than epsilon*real_weight)
  • Using astar(bi).approximation=BeelineAccurate makes the query roughly 25 to 30% slower
  • bidir Dijkstra is faster than A* with simple distance measurement, even faster than bidir A* with accurate distance measurement. And that although more nodes are traversed as the distance measurement is expensive.
  • differences within 5% can be measurement errors etc

Activity

  1. devemux86 commented on Aug 24, 2015

    @devemux86
    Contributor

    Thanks @karussell, very interesting analysis.

  2. karussell commented on Aug 24, 2015

    @karussell
    MemberAuthor

    I'll update the main entry with new findings and numbers. Also keep in mind that the absolute numbers are kind of none sense as they are done on my laptop and no server CPU.

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