-
Notifications
You must be signed in to change notification settings - Fork 0
Description
The statedb contains our best-seen path to any particular state, with a state referencing its total time and the step taken from its parent state. Each is updated individually, so may be stale. We also have the next column which shows us the children states from any parent, which means we don't have to deserialize and evaluate again if we encounter the same state later.
When we improve part of a route, the later states will have to get improved as well so we can appropriately reprioritize them for evaluation. Right now we do that eagerly in HeapDB::record_one_internal, including the entire recursive tree. As I write this, it's been almost an hour waiting for a recreate step that's around 70% of the way through the route, for a fourth canon replacement from #182.
This can potentially explain a lot of things:
- Why the best routes don't seem to improve upon the early stages of the input or the first solution found.
- Why stopping the program and restarting it (deleting the db in the process) is better for finding improvements.
- Why the program throughput slows down so much after running a long time.
- Why mutations from Improve minimizes and mutates #182 seem to be very slow.
- Why mutations don't seem to produce better solutions (they are updating states for so long first that another thread might take an improved state and find the solution before the mutation thread is done with the db).
- Why sometimes solutions find discrepancies between their state data and their elapsed times.
We need to find a more lazy approach to this. We're already geared towards understanding stale information in the statedb; what happens if we only update the new states produced in any step (including all of any solution)? Perhaps later when we retrieve a state from the queue we can check its predecessor (or all of them??)? Perhaps we can add a versioning tag somewhere that makes it easier to see if we need to rescore a state. Perhaps we can add another background thread.
I think if we only check a state's immediate predecessor when we pop from the queue, then we might not pick up on its actual best time from ancestors further away. However, if we find any solutions with that state (e.g. from the solve trie search), then we will recreate_store the entire solution and thus update those times.