aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2024-10-05 23:01:10 +0200
committerSebastiano Tronto <sebastiano@tronto.net>2024-10-05 23:01:10 +0200
commitce2d2d1339b2e0f8f7bb4c5392acf4fbf4e00f03 (patch)
treecf50236534e51e645aab384e04e434cdb63668a8
parent1272e304b6367c7dd94d25acf88b2843adabb93a (diff)
parenta581a8494e15d0abfb5ddb5acef75a1d7941bd69 (diff)
downloadnissy-core-ce2d2d1339b2e0f8f7bb4c5392acf4fbf4e00f03.tar.gz
nissy-core-ce2d2d1339b2e0f8f7bb4c5392acf4fbf4e00f03.zip
Merge branch 'master' of tronto.net:h48
-rw-r--r--src/solvers/h48/gendata_h48.h31
-rw-r--r--tools/expected_distributions.h67
2 files changed, 97 insertions, 1 deletions
diff --git a/src/solvers/h48/gendata_h48.h b/src/solvers/h48/gendata_h48.h
index 17c594f..391c97b 100644
--- a/src/solvers/h48/gendata_h48.h
+++ b/src/solvers/h48/gendata_h48.h
@@ -277,6 +277,37 @@ gendata_h48k2(gendata_h48_arg_t *arg)
277 static const uint8_t shortdepth = 8; 277 static const uint8_t shortdepth = 8;
278 static const uint64_t capacity = 10000019; 278 static const uint64_t capacity = 10000019;
279 static const uint64_t randomizer = 10000079; 279 static const uint64_t randomizer = 10000079;
280
281 /*
282 * A good base value for the k=2 tables have few positions with value
283 * 0, because those are treated as lower bound 0 and require a second
284 * lookup in another table, and at the same time not too many positions
285 * with value 3, because some of those are under-estimates.
286 *
287 * The following values for the base have been hand-picked. I first
288 * performed some statistics on the frequency of these values, but
289 * they turned out to be unreliable. I have not figured out why yet.
290 * In the end I resorted to generating the same table with multiple
291 * base value and see what was best.
292 *
293 * A curious case is h3, which has this distribution for base 8:
294 * [0] = 6686828
295 * [1] = 63867852
296 * [2] = 392789689
297 * [3] = 477195231
298 *
299 * and this for base 9:
300 * [0] = 70554680
301 * [1] = 392789689
302 * [2] = 462294676
303 * [3] = 14900555
304 *
305 * I ended up picking base 8 to have a much lower count of elements
306 * with value 0, at the cost of a less precise estimate for the higher
307 * values. But I am not 100% confident this is the optimal choice,
308 * so I'll leave it here for future considerations.
309 */
310
280 static const uint8_t base[] = { 311 static const uint8_t base[] = {
281 [0] = 8, 312 [0] = 8,
282 [1] = 8, 313 [1] = 8,
diff --git a/tools/expected_distributions.h b/tools/expected_distributions.h
index 0f3fec3..202edf9 100644
--- a/tools/expected_distributions.h
+++ b/tools/expected_distributions.h
@@ -43,6 +43,71 @@ uint64_t expected_h48[12][9][21] = {
43 [3] = 41281787, 43 [3] = 41281787,
44 }, 44 },
45 }, 45 },
46 [2] = {
47 [2] = {
48 [0] = 6391286,
49 [1] = 55494785,
50 [2] = 252389935,
51 [3] = 155993794,
52 },
53 },
54 [3] = {
55 [2] = {
56 [0] = 6686828,
57 [1] = 63867852,
58 [2] = 392789689,
59 [3] = 477195231,
60 },
61
62 },
63 [4] = {
64 [2] = {
65 [0] = 77147213,
66 [1] = 543379415,
67 [2] = 1139570251,
68 [3] = 120982321,
69 },
70 },
71 [5] = {
72 [2] = {
73 [0] = 82471284,
74 [1] = 687850732,
75 [2] = 2345840746,
76 [3] = 645995638,
77 },
78 },
79 [6] = {
80 [2] = {
81 [0] = 85941099,
82 [1] = 804752968,
83 [2] = 4077248182,
84 [3] = 2556374551,
85 },
86 },
87 [7] = {
88 [2] = {
89 [0] = 88529761,
90 [1] = 897323475,
91 [2] = 6126260791,
92 [3] = 7936519573,
93 },
94 },
95 [8] = {
96 /* Unknown */
97 [2] = {0},
98 },
99 [9] = {
100 /* Unknown */
101 [2] = {0},
102 },
103 [10] = {
104 /* Unknown */
105 [2] = {0},
106 },
107 [11] = {
108 /* Unknown */
109 [2] = {0},
110 },
46}; 111};
47 112
48static bool 113static bool
@@ -82,7 +147,7 @@ unknown_h48(uint8_t h, uint8_t k)
82 if (k == 4 && h != 0) 147 if (k == 4 && h != 0)
83 return true; 148 return true;
84 149
85 return k == 2 && h > 1; 150 return k == 2 && h > 7;
86} 151}
87 152
88STATIC bool 153STATIC bool

Generated with cgit - Back to sebastiano.tronto.net