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

Rebalance segment prioritization/round-robining #80

Closed Zannick closed 1 year ago

Zannick commented 1 year ago

We're now reaching in excess of 3 billion iterations before running out of disk space (~400GiB) for the AV2 test case, with 2B+ states left and 6.6B history entries. However, the max progress level for this test case is 23, but we only made it to progress level 8 around 1B iters, and never to 9 or above. (Previously we were starting from the given routes' thresholds.) The given route will win around progress level 20-21. Future cases will have on the order of hundreds.

Additionally, we pretty quickly reach a point where the lowest progress level (0) still has tons of states but the lowest is much worse score-wise than the minimums in the other levels.

Here's some things we should do:

Zannick commented 1 year ago

This change is somehow remarkably efficient, or is otherwise doing some very strange things. The heap size reported is varying wildly, which could be from threads holding onto more work than they did before, or from states not being iterated on. Further, unlike the previous runs, segment 0 disappears super quickly. It never has a chance to reach the times it was reaching before.

What it could be:

In terms of relative counts, if we assume round-robin gets 8 items, and each item takes the same amount of time, we'd originally have gotten in 2 round-robin cycles:

coming out to around 24 round robins and 56 individual specials, not counting the greedy thread(s). (Total = 248 in 15 threads) Now, though, in those two standard cycles, we'll instead get:

Or around 14 round robins and 144 specials. (Total 256 in 16 threads)

The good news is that it's now getting up to progress 11 very quickly, when 8 was hard to reach before.

Zannick commented 1 year ago

I think this is working pretty well. But sometimes I see early on in the program the queue runs out of low-progress states (according to the status updates) and then regains them somehow. This backtracking shouldn't happen unless a thread got really delayed for some reason while holding onto the earlier ones. But also it doesn't always seem to occur, sometimes we just have no 0-progress states from early on, and sometimes we run through tons of them.

Zannick commented 1 year ago

That bug I just fixed probably explains so much! The weird backtracking, the surprise voids, and even the gradual growth of memory usage!

Zannick commented 1 year ago

We probably still need to add more focus on the highest segment somehow.