aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2025-06-18 09:53:07 +0200
committerSebastiano Tronto <sebastiano@tronto.net>2025-06-18 09:53:07 +0200
commite71e2776674a748372e95702be49af2753ff3d48 (patch)
tree81a936d347e9317a06491d48d7ad879fb9c8cc70 /doc
parent5a8ca71aa8255fb76335bf41c8168cfe45eb9574 (diff)
downloadnissy-core-e71e2776674a748372e95702be49af2753ff3d48.tar.gz
nissy-core-e71e2776674a748372e95702be49af2753ff3d48.zip
Update H48 doc
Diffstat (limited to '')
-rw-r--r--doc/h48.md50
1 files changed, 35 insertions, 15 deletions
diff --git a/doc/h48.md b/doc/h48.md
index 681d092..6b31503 100644
--- a/doc/h48.md
+++ b/doc/h48.md
@@ -309,22 +309,42 @@ we can reuse it and avoid an expensive table lookup.
309 309
310### Other optimizations 310### Other optimizations
311 311
312Other possible (low-level) optimizations include: 312The H48 solver uses various other optimizations.
313 313
314* **Avoid inverse computation**: computing the inverse of a cube position 314#### Avoiding inverse cube computation
315 is expensive. We can avoid doing that (for the inverse pruning value 315
316 estimate) if we bring along both the normal and the inverse cube during 316Computing the inverse of a cube position is expensive. We avoid doing
317 the search, and we use *premoves* to apply moves to the inverse scramble. 317that (for the inverse pruning value estimate) if we bring along both
318* **Multi-threading (multiple scrambles)**: It is easy to parallelize this 318the normal and the inverse cube during the search, and we use *premoves*
319 algorithm when solving multiple cubes at once, by firing up multiple 319to apply moves to the inverse scramble.
320 instances of the solver. It is important to make sure that the same 320
321 (read-only) pruning table is used for all instances, to avoid expensive 321#### Multi-threading
322 memory duplication. 322
323* **Multi-threading (single scramble)**: It is also possible to parallelize 323The solution search is parallelized *per-scramble*. Although when solving
324 the search for a single scramble. For example, we can generate 18 different 324multiple positions it would be more efficient to solve them in parallel
325 cubes, one for each possible starting move, and solve each of them in a 325by dedicating a single thread to each of them, the current H48 solver
326 separate thread. Some coordination between threads is necessary to stop 326optimizes for solving a single cube at the time.
327 the search when the desired number of solutions has been found. 327
328To do this, we first compute all cube positions that are 4 moves away
329from the scramble. This way we prepare up to 43254 *tasks* (depending
330on the symmetries of the starting position, which we take advantage of)
331which are equally split between the available threads. Any solution
332encountered in this step is of course added to the list of solutions.
333
334#### Heuristically sorting tasks
335
336The tasks described in the previous paragraph (multi-threading) are
337initially searched in an arbitrary order. However, after searching at a
338sufficient depth, we have gathered some data that allows us to make some
339heuristical improvements: the tasks that leads to visiting more positions
340(or in other words, where we go over the estimated lower bounds less
341often), are more likely to yield the optimal solution. Thus we sort the
342tasks based on this.
343
344Preliminary benchmark show a performance improvement of around 40%
345when searching a single solution. When searching for multiple optimal
346solutions the effects of this optimization will be less pronounced, and
347they are obviously inexistent when looking for *all* optimal solutions.
328 348
329## Pruning table computation 349## Pruning table computation
330 350

Generated with cgit - Back to sebastiano.tronto.net