makhidkarun / traveller_pyroute

Traveller trade route generator
MIT License
14 stars 5 forks source link

Add custom A* pathfinding implementation #40

Closed CyberiaResurrection closed 1 year ago

CyberiaResurrection commented 1 year ago

As pathfinding is the biggest part of most runs, it actually paid off adding a custom A* implementation, derived from the networkx one, that made assumptions better fitting pyroute (rather than general use).

The custom pathfinder also aggressively prunes blind alleys, dead ends, and upper-bound-busters before spending too much time on them.

Over a 12 sector testbed (Reft Sector, Trojan Reach, Deneb, Gushemege, Verge, Riftspan Reaches, Touchstone, Hlakhoi, Corridor, Vland, Dagudashaag, Zarushagar), totalling 4,117 stars:

As at https://github.com/makhidkarun/traveller_pyroute/commit/076f1a130d3b2754de300731422cdeeb9e18aede : Overall took 22 min 16 sec, (1336 s) with pathfinding occupying 18 min 17 sec (1097 s), or 82% of total.

As at "Sort neighbours after filtering", same testbed ( I hadn't gathered up all my changes to custom A*): Overall took 16 min 15 s, (975 s) with pathfinding occupying 12 min 55 sec (775 s), or 79% of total.