Zannick / logic-graph

Tools for video game logic representation and analysis, particularly routing and beatability checks for speedruns and randomizers.
MIT License
3 stars 0 forks source link

Stratify the queue by progress #69

Closed Zannick closed 1 year ago

Zannick commented 1 year ago

A* is a great search algorithm for routing, but unfortunately in a state search space, it acts too much like a BFS and results in an explosion of states that runs the system out of resources, and even if we did have enough resources, would probably take too long to generate interesting solutions. When the graph gets larger, this problem will only get worse.

One solution to this problem is to prioritize getting solutions not guaranteed to be optimal:

This idea would involve tracking elements in multiple priority queues in the Queue struct. This could be done via:

Zannick commented 1 year ago

The initial implementation just gets the minimum element at the lowest tier, but this seems to be causing a lot of retrieving from the database once the min element in the lowest tier is old enough. We ought to make the default pop_min and peek_min get the min element from any tier. And possibly we could evict the whole tier into the db.