poker-flopsolve 0.5.0-beta.0 → 0.5.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +142 -0
- package/README.md +316 -27
- package/dist/browser-threads.js +42 -18
- package/dist/browser-threads.js.map +1 -1
- package/dist/browser.js +2187 -229
- package/dist/browser.js.map +1 -1
- package/dist/engine-worker.js +50 -19
- package/dist/engine-worker.js.map +1 -1
- package/dist/index.d.ts +423 -46
- package/dist/index.js +2247 -234
- package/dist/index.js.map +1 -1
- package/dist/threads.d.ts +4 -2
- package/dist/threads.js +54 -1
- package/dist/threads.js.map +1 -1
- package/dist/worker.js +215 -123
- package/dist/worker.js.map +1 -1
- package/docs/APPROXIMATIONS.md +22 -0
- package/package.json +6 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,144 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.5.0-beta.2
|
|
4
|
+
|
|
5
|
+
The third beta of 0.5.0 (`npm install poker-flopsolve@beta`): everything since 0.5.0-beta.1.
|
|
6
|
+
|
|
7
|
+
### `openLite` takes any range, with every Lite option
|
|
8
|
+
|
|
9
|
+
- A session no longer refuses a range. One that adds a hand the blueprint does not store, or
|
|
10
|
+
breaks a suit symmetry it folds, gets a new run started from the old one's regrets, so
|
|
11
|
+
`oopReserve` and `ipReserve` are optional: five moves with no reserve took 83 s against 143
|
|
12
|
+
for `solveLite` on As Kh 7d, 66 against 91 on Ts 9s 4h and 27 against 51 on Ks 9s 4s.
|
|
13
|
+
- `compressRanges` works in a session, compressing both ranges again at every move: 161 s
|
|
14
|
+
against 193 on As Kh 7d, 110 against 178 on Ts 9s 4h and 50 against 90 on Ks 9s 4s, on wide
|
|
15
|
+
ranges, less exploitable in 14 moves of 15.
|
|
16
|
+
- `algorithm: 'cfr+'` works in a session and in `run.setRange`, which clears its average and
|
|
17
|
+
keeps its count: 105 s against 147, 70 against 103 and 20 against 58, less exploitable in 8
|
|
18
|
+
moves of 15 and 0.2–1.4% of pot more on the monotone flop.
|
|
19
|
+
- `run.setRange` throws `RangeNotInPlaceError` for a range that needs a new run, apart from a
|
|
20
|
+
range that is no range.
|
|
21
|
+
- `defineSpot` refuses two ranges of which no pair of hands can be held together, which
|
|
22
|
+
solved to NaN before.
|
|
23
|
+
- A warm start into a new run copies about nine times faster (4.7 s to 0.5 on a 265 MiB
|
|
24
|
+
blueprint), the same values bit for bit.
|
|
25
|
+
|
|
26
|
+
### Startup
|
|
27
|
+
|
|
28
|
+
- Less stands between a call and solving. Defining the spot, creating the run and the first
|
|
29
|
+
iteration's extra cost took 727 ms on the bench flop on 4 threads and take 244, or 65 for a
|
|
30
|
+
later solve of the same board and hands; 582 and 233 (75) on one thread; 1456 and 584 (436)
|
|
31
|
+
for the Lite blueprint on As Kh 7d. Results are the same, bit for bit.
|
|
32
|
+
- The per-hand tables are built about five times faster, and the last set is kept for a spot
|
|
33
|
+
defined again on the same board with the same hands. `releaseSetupCache()` lets it go.
|
|
34
|
+
- In Node a run's threads start beside its setup, and when it closes replacements start and
|
|
35
|
+
wait 30 seconds for the next run; `enableThreads(n)` starts them ahead and keeps that many.
|
|
36
|
+
- The engine's storage is written once before the first iteration, a share a thread, instead
|
|
37
|
+
of being mapped by every thread at once during it.
|
|
38
|
+
|
|
39
|
+
### Lite for a range slider: `openLite`
|
|
40
|
+
|
|
41
|
+
- `openLite(spot, options)` solves the Lite blueprint as `solveLite` does and keeps it live.
|
|
42
|
+
`session.setRange(player, range)` changes a range in place and settles the blueprint again
|
|
43
|
+
from where it stands; `session.refine(n)` runs more iterations while the slider is at rest;
|
|
44
|
+
`session.current` is the `LiteSolution`, `resolve` included.
|
|
45
|
+
- On issue #47's betting, 4 threads, five moves of out of position's range settled in 95 s
|
|
46
|
+
against 163 for five `solveLite` calls on As Kh 7d, 69 against 103 on Ts 9s 4h and 27 against
|
|
47
|
+
52 on Ks 9s 4s: 0.31–0.61× the time for two hand classes added or dropped, 0.66–0.92× for a
|
|
48
|
+
third of the range dropped. It ended less exploitable than `solveLite` in 11 moves of 15, and
|
|
49
|
+
0.6–1.8% of pot more on the monotone flop's three moves that dropped hands.
|
|
50
|
+
- `oopReserve` and `ipReserve` on a spot keep storage for hands a range does not hold yet, so
|
|
51
|
+
they can be added. With nine classes in reserve an iteration cost 27–42% more and the first
|
|
52
|
+
solve took 20–52% longer.
|
|
53
|
+
- `run.setRange(player, range, { resume })` is the same change on any run, exact solves
|
|
54
|
+
included: about 0.02 ms a call, nothing built or copied, where a `warmStart` into a new run
|
|
55
|
+
costs about two iterations of the spot. It keeps the regrets and resumes the iteration count
|
|
56
|
+
(from 10, `RANGE_RESUME`; `openLite` resumes from 30, as chance sampling was unstable at 10).
|
|
57
|
+
The range must keep the suit symmetries the spot folds runouts by; runout buckets stand.
|
|
58
|
+
A CFR+ run is refused.
|
|
59
|
+
- `runToStop(run, options)` runs a live run as `solve` runs its own: to the iteration cap, the
|
|
60
|
+
target or the settle stop.
|
|
61
|
+
|
|
62
|
+
### `compressRanges` on a spot that starts on the turn or the river (issue #158)
|
|
63
|
+
|
|
64
|
+
- `compressRanges(spot)`, and Lite's option of the same name, take a board of four or five cards
|
|
65
|
+
with the ranges the players hold there; before, any board but a flop was refused. A turn is
|
|
66
|
+
matched on its board and each river that can follow. A river is also matched on what the other
|
|
67
|
+
player's hands face: how much of the range beats each, ties it and loses to it.
|
|
68
|
+
- The default tolerance past the flop is 0.005. Under Lite on four turns (270–497 combinations a
|
|
69
|
+
side, 4 threads) that settled in 0.6–0.8 s against 1.3–2.4, in 3–4 MiB against 6–11, the root
|
|
70
|
+
play 1.2–1.9 points from Lite's on the full ranges, where two Lite solves were 0.6–2.6 apart.
|
|
71
|
+
At 0.01 it was 1.1–7.8 points off.
|
|
72
|
+
- On a river there is nothing to save: Lite took 0.1 s on the full ranges.
|
|
73
|
+
- The vendored compressor is poker-rangecompress 0.2.0. A flop compresses as before.
|
|
74
|
+
|
|
75
|
+
## 0.5.0-beta.1
|
|
76
|
+
|
|
77
|
+
The second beta of 0.5.0 (`npm install poker-flopsolve@beta`): everything since 0.5.0-beta.0.
|
|
78
|
+
|
|
79
|
+
### Lite: compress the ranges first (issue #156)
|
|
80
|
+
|
|
81
|
+
- `solveLite` and `liteConfig` take `compressRanges` (off by default): before the blueprint is
|
|
82
|
+
solved, each range keeps the fewest of its combinations, re-weighted, whose equity
|
|
83
|
+
distributions on this flop's boards stay within a tolerance (default 0.01) of the full
|
|
84
|
+
range's. `compressRanges(spot)` does the same on its own.
|
|
85
|
+
- For wide ranges. A button open against a big-blind call (433–518 combinations a side) on 4
|
|
86
|
+
threads settled in 40.6 s against 87.6 on As Kh 7d, 31.2 against 62.1 on Ts 9s 4h and 16.5
|
|
87
|
+
against 27.3 on Ks 9s 4s, in 0.42–0.72× the storage, with the root play 1.2–2.7 points from
|
|
88
|
+
Lite's on the full ranges, where two Lite solves of the full ranges were 1.8–3.0 apart.
|
|
89
|
+
- On narrow ranges it gains little and can lose. The bench ranges, about 200 combinations a side:
|
|
90
|
+
As Kh 7d settled in 16.0 s against 21.5 (135 MiB against 173), Ts 9s 4h in 8.6 against 12.7 (91 against 122), and Ks 9s 4s in 7.8 against 6.6 (57 against 47). Dropping combinations breaks the
|
|
91
|
+
symmetries that fold boards together.
|
|
92
|
+
- It keeps how the range plays, not what one combination does: the blueprint and its re-solves
|
|
93
|
+
hold a strategy only for the combinations kept.
|
|
94
|
+
- The compressor is poker-rangecompress, vendored as `src/vendor/range-compress.js` (JavaScript
|
|
95
|
+
with its WebAssembly kernels embedded; the package still has no dependencies). It adds about
|
|
96
|
+
60 kB to the bundle, before minifying.
|
|
97
|
+
|
|
98
|
+
### Lite's exploitability in the full game (issue #154)
|
|
99
|
+
|
|
100
|
+
- `exploitabilityInExact(lite, exact)` measures how exploitable a Lite solve's play is in
|
|
101
|
+
the caller's full game. It copies Lite's strategy onto a run of the full spot wherever
|
|
102
|
+
Lite has the decision, keeps that run's own play below the sizes and raises Lite cut, and
|
|
103
|
+
returns the exploitability as a % of the pot.
|
|
104
|
+
- The benchmark page's Accuracy box, after a Lite solve, offers "Measure against Exact"
|
|
105
|
+
when the full game fits in the memory left beside it. It solves Exact to the form's
|
|
106
|
+
target and shows Lite's exploitability with Exact's own beside it.
|
|
107
|
+
|
|
108
|
+
### Faster: engine threads share out boards (issue #133)
|
|
109
|
+
|
|
110
|
+
- On the WebAssembly engine, threads take the split round's boards off a shared queue,
|
|
111
|
+
costliest first, instead of fixed slices. `solveLite` on As Kh 7d settled about 15% sooner
|
|
112
|
+
on 2 and 4 threads in headless Chromium (57.9 → 49.3 s, 33.7 → 28.1 s), turn re-solves
|
|
113
|
+
12–19% sooner; the slowest thread now walks within 1% of the mean, from about 13%.
|
|
114
|
+
- A threaded solve on the WebAssembly engine is now bitwise the same at every thread count
|
|
115
|
+
from two up, not only at a fixed count. One thread still agrees with it only to floating
|
|
116
|
+
point, as before.
|
|
117
|
+
- `npm run bench:lite` (issue #133) times `solveLite` phase by phase in any browser, at each
|
|
118
|
+
thread count, and reports each thread's walking time.
|
|
119
|
+
|
|
120
|
+
### Changed: EV is a percentage of the pot (issue #130) — breaking
|
|
121
|
+
|
|
122
|
+
- `Solution.ev(player)` and `Solution.handEvs(player)` now report the player's **share of the
|
|
123
|
+
pot, in percent**, instead of chips against a half-pot baseline. Folding (or losing every
|
|
124
|
+
showdown) is 0%, winning the pot uncontested is 100%, and `ev(0) + ev(1)` is 100. On Ks 9d 4c
|
|
125
|
+
with a 60 pot, `12.5 / −12.5` chips now reads `70.8 / 29.2`%.
|
|
126
|
+
- The pot is the spot's starting pot (`SpotConfig.pot`), exposed as `Solution.evPot`. Convert
|
|
127
|
+
back with **old chips = `pct / 100 × pot − pot / 2`**, or read `Solution.evChips(player)`
|
|
128
|
+
and `Solution.handEvsChips(player)`, which return the old numbers.
|
|
129
|
+
- New `SpotConfig.evPot` (default `pot`). `Solution.subgameAt` sets it to the original spot's,
|
|
130
|
+
so `resolveSubgame` and `LiteSolution.resolve` (nested too) report in % of the **original
|
|
131
|
+
flop pot**: values read the same way down a hand, and folding at a subgame's root reads below
|
|
132
|
+
0 (the chips put in on earlier streets). For those, convert with the flop pot, `evPot`.
|
|
133
|
+
- Applies to the presets' solutions (`solveLite`, `largeTree`), subgame solutions, the CLI and
|
|
134
|
+
the UI readout, which now show `%`.
|
|
135
|
+
- Unchanged, still chips on the half-pot baseline: `Solver.valuesAt`, `pairValuesAt`,
|
|
136
|
+
`rootValues`, `handEvs` on the `Solver`, regrets, `ResolvedSubgame.alternative` / `entered`,
|
|
137
|
+
and `exploitability()` (`exploitabilityPercent()` stays % of the spot's own pot).
|
|
138
|
+
- napkinpoker: `tools/bench/flopsolve/flop-vs-pfrs.mjs` reads `ev()` and needs `evChips()` to
|
|
139
|
+
keep its chip numbers, or a `%` label; `src/villain/flopsolve-villain.js` reads `valuesAt`,
|
|
140
|
+
which is unchanged.
|
|
141
|
+
|
|
3
142
|
## 0.5.0-beta.0
|
|
4
143
|
|
|
5
144
|
The first beta of 0.5.0, published under npm's `beta` tag (`npm install poker-flopsolve@beta`); `latest` stays 0.4.1 until 0.5.0. A minor release. Every approximation below is opt-in and off by default. The README's
|
|
@@ -21,6 +160,9 @@ The first beta of 0.5.0, published under npm's `beta` tag (`npm install poker-fl
|
|
|
21
160
|
a storage budget, ranked on a short solve of the blueprint with its river checked down
|
|
22
161
|
(`checkedDown`, `keepWithin`); `LiteSolution.kept` lists them. On issue #47's flops, 150 MiB at 16
|
|
23
162
|
bits cut a turn re-solve's best-response gain by a third to a half, root play unchanged.
|
|
163
|
+
With a budget, `settle`'s tolerance defaults to 0.005, not 0.01 (#123): the kept lines' turn
|
|
164
|
+
ranges go on improving after the root play settles, and stopping later cut the re-solve gain by
|
|
165
|
+
15–28% more for out of position (3–34% in position) for 16–32% more time on 4 threads.
|
|
24
166
|
|
|
25
167
|
### New opt-ins since 0.4.1
|
|
26
168
|
|
package/README.md
CHANGED
|
@@ -25,7 +25,7 @@ const spot = defineSpot({
|
|
|
25
25
|
|
|
26
26
|
const sol = solve(spot, { iterations: 500 });
|
|
27
27
|
|
|
28
|
-
sol.ev(0); //
|
|
28
|
+
sol.ev(0); // OOP's share of the pot, % (ev(0) + ev(1) = 100)
|
|
29
29
|
sol.exploitabilityPercent(); // distance from equilibrium, % of pot
|
|
30
30
|
sol.strategyAt(node, board); // per-combination action frequencies
|
|
31
31
|
```
|
|
@@ -62,6 +62,32 @@ number. The line reaching the selected node is spelled out above the grid —
|
|
|
62
62
|
Solving runs in its own worker thread, so progress streams and **Stop** ends early while
|
|
63
63
|
keeping the partial answer.
|
|
64
64
|
|
|
65
|
+
## Benchmark page
|
|
66
|
+
|
|
67
|
+
A static page for anyone to measure the solver on their own machine, nothing installed:
|
|
68
|
+
pick two ranges on a 13×13 grid (drag to paint, with weights and preset ranges), a flop
|
|
69
|
+
with an optional turn and river, the pot, stack and betting, and press **Run benchmark**.
|
|
70
|
+
It solves in a Web Worker on every core, shows each phase as it goes, and reports the time
|
|
71
|
+
to each level of exploitability, iterations per second, where the time went, the tree's
|
|
72
|
+
size, the machine and the solution's root strategy, with a JSON report and a link to share.
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
npm run site # build site/ into site/dist and serve it on http://localhost:5175
|
|
76
|
+
npm run site:build # build only
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
`.github/workflows/pages.yml` publishes it to GitHub Pages each time `main` moves (set
|
|
80
|
+
Settings → Pages → Source to "GitHub Actions" once). Pages cannot send the cross-origin
|
|
81
|
+
isolation headers threads need, so the page registers its own service worker
|
|
82
|
+
(`site/coi-sw.js`) that adds them and reloads once; where that is not possible it solves on
|
|
83
|
+
one thread and says so.
|
|
84
|
+
|
|
85
|
+
The page offers **Exact** (`solve` to an exploitability target) and **Lite** (`solveLite`'s
|
|
86
|
+
recipe, stopped when the root play settles), and says in plain words what Lite simplified and
|
|
87
|
+
what it cannot tell you. Its memory limit defaults to 2 GiB on desktops reporting 8 GB or
|
|
88
|
+
more, 512 MiB on phones and 1 GiB otherwise (the solver's own browser default is 512 MiB);
|
|
89
|
+
a tree over the limit at 32 bits is solved at 16. Threads default to every core.
|
|
90
|
+
|
|
65
91
|
## Ranges
|
|
66
92
|
|
|
67
93
|
```
|
|
@@ -166,10 +192,31 @@ dropped from both, which suits imported ranges full of hands at a percent or two
|
|
|
166
192
|
|
|
167
193
|
## Reading a solved spot
|
|
168
194
|
|
|
169
|
-
`solution.
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
195
|
+
`solution.ev(player)` is the player's **share of the pot**, in percent: what they win on
|
|
196
|
+
average per hand, as a percentage of the pot the spot starts with (`SpotConfig.pot`; on a
|
|
197
|
+
turn or river spot, that spot's starting pot). Folding, or losing every showdown, is 0%;
|
|
198
|
+
winning the pot uncontested is 100%; the two players' values add up to 100%. Percentages
|
|
199
|
+
compare directly across spots with different pots. On Ks 9d 4c with a 60 pot, for example,
|
|
200
|
+
`ev(0)` 70.8 and `ev(1)` 29.2 mean out of position wins 42.5 of the 60 chips on average
|
|
201
|
+
(the old chip reading was 12.5 / −12.5).
|
|
202
|
+
|
|
203
|
+
The pot used is `solution.evPot`. A subgame from `subgameAt` — and so `resolveSubgame` and
|
|
204
|
+
`LiteSolution.resolve`, nested or not — sets `SpotConfig.evPot` to the original spot's, so a
|
|
205
|
+
re-solved turn reports in the flop pot and its values read the same way down a hand. Folding
|
|
206
|
+
at a subgame's root then reads below 0: the chips put in on earlier streets, given up, as a
|
|
207
|
+
share of the flop pot (after a 30 bet and call into 60, folding the turn reads −50%).
|
|
208
|
+
`exploitabilityPercent` stays a percentage of the spot's own pot.
|
|
209
|
+
|
|
210
|
+
Up to and including 0.5.0-beta.0 `ev` was in chips, against a baseline where each player already owns half
|
|
211
|
+
the pot (folding −pot/2, the two summing to 0). That number is still there as
|
|
212
|
+
`solution.evChips(player)`, and per hand as `solution.handEvsChips(player)`; the conversion is `evChips = ev / 100 × evPot − evPot / 2`.
|
|
213
|
+
`Solver.valuesAt`, `pairValuesAt`, `rootValues`, the regrets and `ResolvedSubgame`'s
|
|
214
|
+
`alternative` and `entered` stay in chips on that baseline.
|
|
215
|
+
|
|
216
|
+
`solution.handEvs(player)` gives each combination's root EV, in % of `evPot` as `ev` is,
|
|
217
|
+
indexed like `COMBO_CARDS` (0 outside the range, on the board, or with no opponent hand to
|
|
218
|
+
face; those carry no weight). Weighted by range weight times the opponent mass each hand can
|
|
219
|
+
face, it averages to `solution.ev(player)`, and one pass serves both.
|
|
173
220
|
|
|
174
221
|
Both read the average strategy by default. With `approximations: { currentProfileEv: true }`
|
|
175
222
|
they read the current (regret-matched) profile instead: the strategy the next iteration would
|
|
@@ -237,6 +284,46 @@ const seven = solve(defineSpot({ ...config, board: 'As Kh 7d' }), {
|
|
|
237
284
|
On the bench flop that reaches 0.5% of pot in 8 iterations instead of 52 (from AsQh7d,
|
|
238
285
|
20). It needs the whole old solve: seeding only the flop's decisions saved at most 15%.
|
|
239
286
|
|
|
287
|
+
### Changing a range in place
|
|
288
|
+
|
|
289
|
+
A warm start builds a new run, which costs about two iterations of the spot before the first
|
|
290
|
+
one runs: around a second on the bench flop. A range slider, which changes nothing but one
|
|
291
|
+
player's weights, needs none of that. `run.setRange` reweights the live run where it stands:
|
|
292
|
+
|
|
293
|
+
```ts
|
|
294
|
+
const run = createRun(defineSpot({ ...config, oopReserve: widest })); // every hand the slider can reach
|
|
295
|
+
run.step(50);
|
|
296
|
+
run.setRange(0, weights); // a Float64Array of 1326 weights, or a range string
|
|
297
|
+
run.step(20); // keeps solving, from the regrets it had
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
Nothing is built or copied, so a call takes about 0.02 ms on any of the bench spots (0.04 ms
|
|
301
|
+
given a string to parse), against 3–110 ms on river and turn and about 1.1 s on the flop for a
|
|
302
|
+
warm start into a new run. It then solves as that warm start does, or faster:
|
|
303
|
+
|
|
304
|
+
| To 0.3% of pot (flop: 0.5%) | From scratch | `warmStart` | `setRange` |
|
|
305
|
+
|---|---|---|---|
|
|
306
|
+
| River, hands added | 60 iterations | 40 | 40 |
|
|
307
|
+
| River, hands dropped | 70 | 45 | 45 |
|
|
308
|
+
| Turn, hands added | 85 | 60 | 50 |
|
|
309
|
+
| Turn, hands dropped | 85 | 60 | 50 |
|
|
310
|
+
| Flop, hands added | 44 | 16 | 16 |
|
|
311
|
+
| Flop, hands dropped | 44 | 24 | 24 |
|
|
312
|
+
|
|
313
|
+
Hands can be reweighted or dropped freely. A hand can be added only where the spot kept
|
|
314
|
+
storage for it: `oopReserve` and `ipReserve` name the hands a range may gain, and each costs
|
|
315
|
+
what a held hand does, in memory and per iteration. The new range must keep the suit symmetries
|
|
316
|
+
the spot folds runouts by (define the spot with `isomorphism: false` to be free of that).
|
|
317
|
+
`runoutBuckets` stand as they are, since they were chosen by the hands the spot stores. The
|
|
318
|
+
average strategy is not cleared, which would cost a pass over the storage; the iteration count
|
|
319
|
+
resumes from 10 instead (`{ resume }` to choose), where DCFR's discounting shrinks the old
|
|
320
|
+
range's share within a few iterations. A run with `algorithm: 'cfr+'`, which discounts nothing,
|
|
321
|
+
keeps its count and has its average cleared: 25–100 iterations to 0.3% of pot against 105–185
|
|
322
|
+
from cold on the bench river and turn. A range that adds a hand without storage, or breaks a
|
|
323
|
+
symmetry, throws `RangeNotInPlaceError`: start a new run on it with `warmStart`. Every run built
|
|
324
|
+
on the same spot object is reweighted with it. For Lite, [`openLite`](#a-range-slider-on-lite-openlite) wraps this with the
|
|
325
|
+
settle rule.
|
|
326
|
+
|
|
240
327
|
## Re-solving from a node
|
|
241
328
|
|
|
242
329
|
Solve the whole spot with a coarse tree, then re-solve the street you are looking at
|
|
@@ -250,7 +337,9 @@ const detailed = solve(turn, { targetPercent: 0.3 });
|
|
|
250
337
|
|
|
251
338
|
`solution.subgameAt(node, board, betting?)` returns the spot that starts at a node that
|
|
252
339
|
opens a betting round. It carries the board dealt there, the pot and stacks as they stand,
|
|
253
|
-
and each player's range as their reach there (`solution.reachAt`)
|
|
340
|
+
and each player's range as their reach there (`solution.reachAt`), with `evPot` kept at
|
|
341
|
+
the original spot's pot so the re-solve's `ev` is a share of the flop pot (see
|
|
342
|
+
[Reading a solved spot](#reading-a-solved-spot)). Ranges accept these
|
|
254
343
|
per-combination weights as well as notation. Measured on the bench flop: the coarse flop
|
|
255
344
|
took 27 s and 150 MB with 3 threads. Each turn, re-solved with three sizes, two raises and
|
|
256
345
|
a shove, took about 7 s and 15 MB. The same rich tree solved from the flop would need
|
|
@@ -417,7 +506,7 @@ Pick a goal below, not a dozen options.
|
|
|
417
506
|
|---|---|---|---|---|
|
|
418
507
|
| Fastest flop answer in a browser | [`solveLite`](#lite-mode-solvelite) | 35 s, 511 MiB; root loss 0.023 / 0.014 | 21 s, 426 MiB; 0.118 / 0.076 | 12 s, 253 MiB; 0.059 / 0.037 |
|
|
419
508
|
| Fits a phone, 512 MiB or less | `solveLite` on a spot with `compactStorage: {}`, solved with `wasmStorage` | 300 MiB, 27% slower (Node) | not measured | not measured |
|
|
420
|
-
| Better turn re-solves, in a tab | `solveLite` with `keepBudget: 150 * 2 ** 20`, `precision: 'i16'`, `wasmStorage` |
|
|
509
|
+
| Better turn re-solves, in a tab | `solveLite` with `keepBudget: 150 * 2 ** 20`, `precision: 'i16'`, `wasmStorage` | 45 s, 534 MiB; re-solve gain 1.8 / 1.4 (1.3 / 1.1 at 800 it, 59 s) | 29 s, 467 MiB; 1.5 / 1.2 | 13 s, 315 MiB; 1.8 / 1.2 |
|
|
421
510
|
| The whole tree, in 2 GiB or less | [`largeTree`](#fitting-a-large-tree-largetree) | T: 155 s, 1.97 GiB (1.87 in Chromium); root loss 0.031 / 0.020 | not measured | `thinSizes` alone: 0.64 GiB at 32 bits |
|
|
422
511
|
| Exact | `solve(spot, { targetPercent })` | 9.2 s, 708 MiB (0.2%, Chromium) | 10.3 s (Node) | 5.6 s (Node) |
|
|
423
512
|
|
|
@@ -427,7 +516,8 @@ How each row was measured, all on 4 threads:
|
|
|
427
516
|
memory includes a turn re-solve. Root loss is what OOP's root play / IP's play after a check give up
|
|
428
517
|
at the unshared blueprint's per-action values, % of pot. The phone row's 300 MiB is Node's peak on
|
|
429
518
|
rainbow. The re-solve row is issue #113's: the same blueprint at 16 bits, keeping the most-reached
|
|
430
|
-
flop lines that 150 MiB holds, the pick included in the time
|
|
519
|
+
flop lines that 150 MiB holds, the pick included in the time, stopped at the tolerance #123 set
|
|
520
|
+
for it. Its gain is an opponent's best response
|
|
431
521
|
to a re-solved turn, % of the subgame pot: plain lite gives 3.1 / 2.7, 4.0 / 3.3 and 3.6 / 3.6, an
|
|
432
522
|
unshared blueprint 0.4–0.7.
|
|
433
523
|
- **`largeTree`**: T, which is As Kh 7d with issue #47's betting on every street (17.2 GiB at 32 bits), in Node. Time is until
|
|
@@ -504,6 +594,7 @@ against the exact solve at equal iterations, root loss OOP / IP in % of pot (the
|
|
|
504
594
|
| `solveLite` / `litePreset` | preset | both | — | settled at 2.6× the iterations: 0.22× storage, 0.30× time, root 0.052 / 0.068, turn nodes 0.127, 1.89% exploitable ([Lite mode](#lite-mode-solvelite)) |
|
|
505
595
|
| `largeTree` | preset | WebAssembly | — | at 4× the iterations: 0.38× storage, 0.58× time, root 0.057 / 0.289 (IP's cut 0.33 bet), 0.39% exploitable in its own tree ([Fitting a large tree](#fitting-a-large-tree-largetree)) |
|
|
506
596
|
| `shareHistories` | preset-internal (lite) | both | — | 0.40× storage, 1.00× time, root 0.061 / 0.068, 1.89% exploitable |
|
|
597
|
+
| `compressRanges` (`solveLite`, or on its own) | advanced (a lite option) | both | — | edits the ranges. Wide weighted ranges on a flop: 0.42–0.72× storage, 0.46–0.60× time, root play 1.2–2.7 points off where two Lite solves were 1.8–3.0 apart. Narrow ranges: little, and slower on a monotone flop. A spot that starts on the turn: 0.29–0.54× time, 1.2–1.9 points off (0.6–2.6); on the river, nothing to save ([Lite mode](#lite-mode-solvelite)) |
|
|
507
598
|
| `keepBudget` (`solveLite`), `shareHistories.keepLines`, `linesWithin` | advanced (a lite option) | both | — | turn re-solve gain within 0.1–0.8% of the subgame pot of an unshared blueprint's, against 3.0–4.2% from plain sharing ([History sharing](#history-sharing)) |
|
|
508
599
|
| `runoutBuckets` | preset-internal (lite) | both | — | folds nothing on napkinpoker's weighted ranges. Bench ranges, gap 3: 0.61× time, true exploitability 0.302 against 0.271 ([Runout buckets](#runout-buckets-and-coarse-start)) |
|
|
509
600
|
| `approximations.chanceSampling` | preset-internal (both) | both, threaded | — | at 4× the iterations: 0.69× time, root 0.057 / 0.056, 0.60% exploitable |
|
|
@@ -516,6 +607,8 @@ against the exact solve at equal iterations, root loss OOP / IP in % of pot (the
|
|
|
516
607
|
| `approximations.currentProfileEv` | advanced | both | `analysisOnly` | no more than reading EVs; per-hand EVs often 2–4× closer at equal iterations |
|
|
517
608
|
| `analysisOnly` | advanced | both, at 32 bits | `compactStorage`, `currentProfileEv` | loads a saved strategy; keeps no regrets |
|
|
518
609
|
| `warmStart`, `warmCards` | advanced | both | — | see [Warm starts](#warm-starts) |
|
|
610
|
+
| `oopReserve`, `ipReserve` | advanced | both | — | storage for hands `run.setRange` may add; see [Changing a range in place](#changing-a-range-in-place) |
|
|
611
|
+
| `openLite` | preset | both | — | `solveLite` kept live for a range slider: a changed range settled again in 0.52–0.68× the time of a new `solveLite` over five moves, 0.31–0.61× for a two-class move, about as exploitable; any range and every Lite option taken, with or without a reserve ([A range slider on Lite](#a-range-slider-on-lite-openlite)) |
|
|
519
612
|
| `minWeight` | advanced | both | — | edits the ranges: 2–5% less storage, up to 15% less time on napkinpoker's spots |
|
|
520
613
|
| `engine: 'js'` | advanced | JavaScript | — | the reference engine, about 2.4× slower; `precision: 'f64'` runs on it |
|
|
521
614
|
| `isomorphism: false`, `simd: false`, `algorithm: 'cfr+'` | advanced | both | — | exact; off switches for comparison |
|
|
@@ -525,6 +618,46 @@ against the exact solve at equal iterations, root loss OOP / IP in % of pot (the
|
|
|
525
618
|
`litePreset` and `largeTree` (45 pairs); none is refused. Every approximation
|
|
526
619
|
tried and left out, with its numbers and issue, is in [docs/APPROXIMATIONS.md](docs/APPROXIMATIONS.md).
|
|
527
620
|
|
|
621
|
+
### Startup
|
|
622
|
+
|
|
623
|
+
What stands between a call and solving: defining the spot, creating the run, and whatever the
|
|
624
|
+
first iteration costs over an ordinary one. Measured in new Node processes on the bench spots
|
|
625
|
+
(`bench/startup/measure.ts`; milliseconds, medians; "before" is the same build without this work):
|
|
626
|
+
|
|
627
|
+
| spot | cold, before | cold | hot, before | hot |
|
|
628
|
+
|---|---|---|---|---|
|
|
629
|
+
| River | 12 | 11 | 2.5 | 1.7 |
|
|
630
|
+
| Turn | 53 | 42 | 43 | 13 |
|
|
631
|
+
| Flop | 582 | 233 | 412 | 75 |
|
|
632
|
+
| Flop, 4 threads | 727 | 244 | 646 | 65 |
|
|
633
|
+
| Lite, As Kh 7d, 4 threads | 1456 | 584 | 1445 | 436 |
|
|
634
|
+
| Lite, Ts 9s 4h, 4 threads | 1124 | 474 | 1108 | 339 |
|
|
635
|
+
| Lite, Ks 9s 4s, 4 threads | 562 | 292 | 492 | 183 |
|
|
636
|
+
|
|
637
|
+
Cold is the first solve in a process. Hot is a later one of the same board and hands with
|
|
638
|
+
another pot, as a page solving its next spot has. Importing the package takes 13–16 ms more.
|
|
639
|
+
Where it went:
|
|
640
|
+
|
|
641
|
+
- **The per-hand tables** (showdown ranking, hand lists, the maps between boards) were most of
|
|
642
|
+
`createRun`: 280 ms of a flop's. They are built about five times faster, and the last set is
|
|
643
|
+
kept: a spot defined again on the same board with the same hands stored and the same
|
|
644
|
+
symmetries, whatever its pot, betting or weights, takes them as they are. They hold a few MiB
|
|
645
|
+
on narrow ranges and tens on wide ones; `releaseSetupCache()` lets them go.
|
|
646
|
+
- **Threads** took 100–190 ms to start, every run. A run now starts them before it builds its
|
|
647
|
+
tables, so they are up when it needs them, and when a run closes its threads end and
|
|
648
|
+
replacements start, off the calling thread, to wait 30 seconds for the next run.
|
|
649
|
+
`enableThreads(n)` from `poker-flopsolve/threads` starts them ahead of the first run and
|
|
650
|
+
keeps that many waiting for good; `enableThreads(1)` stops them.
|
|
651
|
+
- **Fresh memory** is mapped page by page as it is first written, and the first iteration did
|
|
652
|
+
that with every thread writing at once: 380 ms on the flop on 4 threads where later ones take
|
|
653
|
+
75, and 1.3 s against 70 ms on the Lite blueprint. The storage is now written once up front, a
|
|
654
|
+
share a thread, which takes 50–100 ms.
|
|
655
|
+
- **Laying out the storage** counted every hand on every board up to three times in `defineSpot`
|
|
656
|
+
and once more in `createRun`; it is counted once.
|
|
657
|
+
|
|
658
|
+
What is left on Lite is its first iteration, which under chance sampling walks every deal to
|
|
659
|
+
have a first value for each: 340 ms of the rainbow blueprint's 436 hot.
|
|
660
|
+
|
|
528
661
|
### Exact speed
|
|
529
662
|
|
|
530
663
|
Measured on an Apple M2, single threaded:
|
|
@@ -685,10 +818,20 @@ the difference.
|
|
|
685
818
|
|
|
686
819
|
`solve(spot, { workers })` splits the runouts across threads, the calling thread included:
|
|
687
820
|
`workers: 2` is the caller and one worker thread. Storage is indexed runout-outermost, so
|
|
688
|
-
each
|
|
821
|
+
each runout's storage is walked by one thread at a time and no thread takes a lock. Only the round above
|
|
689
822
|
the split stays on the main thread alone, because CFR+ clamps regrets at zero and partial
|
|
690
823
|
sums cannot be added through a clamp. Exploitability and EV passes are split the same way.
|
|
691
824
|
|
|
825
|
+
On the WebAssembly engine the split round's boards are not cut into fixed slices: every
|
|
826
|
+
thread takes the next board off a shared queue, the costliest first by what each took on the
|
|
827
|
+
previous traversal, until none are left (issue #133). Under chance sampling a board's work
|
|
828
|
+
changes from one iteration to the next, and fixed slices left the slowest thread walking
|
|
829
|
+
about 13% longer than the mean; the queue keeps it under 1%. On As Kh 7d with `solveLite`'s
|
|
830
|
+
blueprint in headless Chromium, 4 cores, it settled in 49.3 s on 2 threads and 28.1 s on 4,
|
|
831
|
+
where fixed slices took 57.9 and 33.7, the same 400 iterations, and a turn re-solve took
|
|
832
|
+
12.8 and 7.0 s instead of 14.5 and 8.6. `node --import tsx bench/threads/profile.ts` prints
|
|
833
|
+
where a threaded traversal's time goes. The JavaScript engine's pool keeps fixed slices.
|
|
834
|
+
|
|
692
835
|
Measured on a 133 vs 145 combo spot, 8 cores:
|
|
693
836
|
|
|
694
837
|
| Workers | Turn, 400 iters | Flop, 100 iters |
|
|
@@ -709,9 +852,12 @@ any chance to report it (a Node worker out of heap, a worker the browser kills)
|
|
|
709
852
|
a backstop instead: the main thread waits for the others at most 20× its own share of the
|
|
710
853
|
step, and never less than a minute, before it gives up on them.
|
|
711
854
|
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
855
|
+
On the WebAssembly engine, each board's values are kept apart and summed in board order,
|
|
856
|
+
whichever thread walked it, so a solve is bitwise the same at every thread count from two up
|
|
857
|
+
(`test/thread-schedule.test.ts`). One thread, and the JavaScript pool at any count, agree with
|
|
858
|
+
that only to floating point: one thread sums inside the walk, in a different association, and
|
|
859
|
+
a JavaScript worker sums its own slice before the totals are summed across workers. Regret
|
|
860
|
+
matching then amplifies
|
|
715
861
|
that rounding, as it does any small change: an action's share follows its regret's sign,
|
|
716
862
|
and where hands are close to indifferent the 32-bit gap grows from iteration to iteration.
|
|
717
863
|
Measured on a small turn (`Ah Kd Qc 8s`, half- and full-pot bets, two raises), 1 and 2
|
|
@@ -765,7 +911,7 @@ const turn = lite.resolve(node, board, { player: 0, iterations: 300 });
|
|
|
765
911
|
`lite.changes` says what the blueprint cut from your betting and what it switched on (see
|
|
766
912
|
[The presets](#the-presets)). `litePreset(spot)` returns the blueprint spot, the solve settings and
|
|
767
913
|
that report without solving, for a page that steps its own run; `liteConfig(spot)` returns the spot
|
|
768
|
-
alone. `trackSettle()` gives the same stop for such a loop. Lite is a shared blueprint, so it
|
|
914
|
+
alone. `trackSettle(preset.options.settle)` gives the same stop for such a loop. Lite is a shared blueprint, so it
|
|
769
915
|
never reaches an exploitability target: it plateaus a few percent of the pot from
|
|
770
916
|
equilibrium while its first decisions go on settling (issue #85). `SolveOptions.settle`
|
|
771
917
|
is the stop. Every 20 iterations it reads the average strategy at the root and at in
|
|
@@ -773,6 +919,138 @@ position's decision after a check. It stops once both have moved less than 1% of
|
|
|
773
919
|
range, by total variation weighted by range, twice in a row. That is two strategy reads,
|
|
774
920
|
with no best-response pass. It works on any solve: `solve(spot, { settle: {} })`.
|
|
775
921
|
|
|
922
|
+
Where the full game fits in memory too, `exploitabilityInExact(lite, exact)` measures Lite's
|
|
923
|
+
play there (issue #154): `exact` is a run of your own spot, solved as far as you like. Each of its
|
|
924
|
+
decisions that Lite also has takes Lite's average strategy, so a size Lite cut is never played,
|
|
925
|
+
and the decisions only reachable through such a size or a raise keep `exact`'s own play. The
|
|
926
|
+
result, % of the pot, is the exploitability of that strategy, with `exact`'s own as its floor.
|
|
927
|
+
It overwrites `exact`'s strategy, so close the run after. The benchmark page's Accuracy box does this
|
|
928
|
+
after a Lite solve, solving Exact to the form's target first.
|
|
929
|
+
|
|
930
|
+
`compressRanges` (issue #156) shrinks both ranges before the blueprint is solved. Each range keeps
|
|
931
|
+
the fewest of its combinations, re-weighted, whose distribution of equity on the flop, on every
|
|
932
|
+
turn and on the river boards stays within a tolerance (default 0.01) of the full range's:
|
|
933
|
+
|
|
934
|
+
```ts
|
|
935
|
+
const lite = solveLite(spot, { workers: 4, compressRanges: true }); // or { tolerance: 0.02 }, or { size: 150 }
|
|
936
|
+
lite.changes.notes; // [..., 'ranges: compressed to 186 and 180 re-weighted combinations ...']
|
|
937
|
+
```
|
|
938
|
+
|
|
939
|
+
It is for wide ranges, and off by default. On a button open against a big-blind call (433–518
|
|
940
|
+
weighted combinations a side, issue #47's betting, 4 threads in Node), the compression itself
|
|
941
|
+
taking about 0.05 s (up to three times that where WebAssembly SIMD is missing):
|
|
942
|
+
|
|
943
|
+
| flop | Lite | tolerance 0.01 | tolerance 0.02 | two Lite solves apart |
|
|
944
|
+
|---|---|---|---|---|
|
|
945
|
+
| As Kh 7d | 87.6 s, 706 MiB | 40.6 s, 294 MiB, 186 / 180 combinations, root play 2.7 points off | 31.0 s, 210 MiB, 127 / 128, 2.4 | 2.0 |
|
|
946
|
+
| Ts 9s 4h | 62.1 s, 393 MiB | 31.2 s, 214 MiB, 248 / 268, 1.2 | 25.1 s, 166 MiB, 191 / 204, 1.5 | 1.8 |
|
|
947
|
+
| Ks 9s 4s | 27.3 s, 146 MiB | 16.5 s, 105 MiB, 316 / 372, 2.5 | 13.2 s, 91 MiB, 277 / 319, 2.0 | 3.0 |
|
|
948
|
+
|
|
949
|
+
"Root play off" is the largest difference in how often the range takes an action at the root or
|
|
950
|
+
at in position's decision after a check, against Lite on the full ranges; the last column is the
|
|
951
|
+
same between two Lite solves of the full ranges, one stopped at half the settle tolerance. On
|
|
952
|
+
the narrow bench ranges (about 200 combinations) it gains little, and on the monotone flop it
|
|
953
|
+
loses: As Kh 7d settled in 16.0 s against 21.5 (135 MiB against 173), Ts 9s 4h in 8.6 against 12.7 (91 against 122), and Ks 9s 4s in 7.8 against 6.6 (57 against 47). Dropping
|
|
954
|
+
combinations breaks the suit and rank symmetries that fold boards together, so where those were
|
|
955
|
+
saving the most there is the least to gain (`bench/range-compress`).
|
|
956
|
+
|
|
957
|
+
What it keeps is how the range plays. What it does not keep is what one combination does: the
|
|
958
|
+
blueprint, and `resolve`, hold a strategy only for the combinations kept, each carrying the
|
|
959
|
+
weight of those dropped, and `exploitabilityInExact` covers only those: a combination left out
|
|
960
|
+
keeps `exact`'s play. `compressRanges(spot)` gives the two compressed ranges on their own.
|
|
961
|
+
`minWeight` is applied to the ranges as given, before compressing.
|
|
962
|
+
|
|
963
|
+
#### A range slider on Lite (`openLite`)
|
|
964
|
+
|
|
965
|
+
`solveLite` solves one pair of ranges and lets go of the run, so a page with a range slider
|
|
966
|
+
solves the blueprint again from nothing on every move. `openLite` keeps the blueprint live:
|
|
967
|
+
|
|
968
|
+
```ts
|
|
969
|
+
import { openLite } from 'poker-flopsolve';
|
|
970
|
+
|
|
971
|
+
const session = openLite({ ...spot, oopReserve: widest }, { workers: 4 }); // solves as solveLite does
|
|
972
|
+
session.current; // a LiteSolution: .solution, .resolve(...)
|
|
973
|
+
const next = session.setRange(0, range); // settles again from where it stands
|
|
974
|
+
session.refine(40); // more iterations while the slider is at rest
|
|
975
|
+
session.close();
|
|
976
|
+
```
|
|
977
|
+
|
|
978
|
+
`setRange` changes the range in place (`run.setRange`, above), resumes the iteration count
|
|
979
|
+
from 30 and runs the same settle rule, with the play before the move as its first reading.
|
|
980
|
+
Measured on issue #47's betting and the bench ranges, 4 threads in Node, with out of position's
|
|
981
|
+
range moved five times: two hand classes added, nine added, back to the start, two dropped, and a
|
|
982
|
+
third of the range dropped (`bench/lite/slider.ts`):
|
|
983
|
+
|
|
984
|
+
| flop | five moves, `setRange` | five `solveLite` | a move | iterations a move | less exploitable than `solveLite` | first solve |
|
|
985
|
+
|---|---|---|---|---|---|---|
|
|
986
|
+
| As Kh 7d | 95 s | 163 s | 12–27 s against 28–44 | 120–260 against 400–420 | 4 moves of 5 | 46 s against 30 |
|
|
987
|
+
| Ts 9s 4h | 69 s | 103 s | 11–20 s against 19–25 | 140–280 against 320 | 5 of 5 | 24 s against 18 |
|
|
988
|
+
| Ks 9s 4s | 27 s | 52 s | 3–8 s against 9–14 | 80–240 against 340–380 | 2 of 5 | 12 s against 10 |
|
|
989
|
+
|
|
990
|
+
So a slider move settles in 0.52–0.68× the time of a new solve over the five, the two-class
|
|
991
|
+
moves in 0.31–0.61× and the largest, a third of the range dropped, in 0.66–0.92×. What it
|
|
992
|
+
settles on is about as good. Its exploitability in the blueprint's own game was 2.97–4.66% of
|
|
993
|
+
pot against `solveLite`'s 3.16–5.45 on As Kh 7d and Ts 9s 4h, lower in 9 moves of 10, and
|
|
994
|
+
3.64–6.38 against 3.63–4.63 on the monotone flop, where the three moves that dropped hands
|
|
995
|
+
ended 0.6–1.8 higher. Against the new range's blueprint run to 1000 iterations, how often the
|
|
996
|
+
range takes each root action was closer than `solveLite`'s in 11 moves of 15 (1.6–6.9 points off
|
|
997
|
+
against 2.6–8.2). Hand by hand it was further off in 10 of 15, by 0.5–8 points. Part of that is
|
|
998
|
+
the reserve, which changes the hands stored and so the runouts bucketed together: `solveLite`
|
|
999
|
+
given the same reserve was itself further off than without it, by 0.1–6.6 points, in all 12
|
|
1000
|
+
moves where the reserve held more than the range.
|
|
1001
|
+
|
|
1002
|
+
Any range is taken, and every Lite option works with it. The same five moves in three other
|
|
1003
|
+
ways, each against `solveLite` with the same options (seconds for the five; then in how many
|
|
1004
|
+
moves the session ended less exploitable):
|
|
1005
|
+
|
|
1006
|
+
| | As Kh 7d | Ts 9s 4h | Ks 9s 4s | less exploitable |
|
|
1007
|
+
|---|---|---|---|---|
|
|
1008
|
+
| No reserve | 83 against 143 | 66 against 91 | 27 against 51 | 12 moves of 15 |
|
|
1009
|
+
| `compressRanges`, wide ranges | 161 against 193 | 110 against 178 | 50 against 90 | 14 of 15 |
|
|
1010
|
+
| `algorithm: 'cfr+'`, with the reserve | 105 against 147 | 70 against 103 | 20 against 58 | 8 of 15 |
|
|
1011
|
+
|
|
1012
|
+
- **The reserve is optional.** `oopReserve` and `ipReserve` name hands to store ahead: with the
|
|
1013
|
+
widest ranges the slider can reach in them, every move changes in place, at 27–42% more an
|
|
1014
|
+
iteration and a first solve 20–52% longer for the nine classes above. Without them the first
|
|
1015
|
+
solve costs what `solveLite`'s does, and a move that adds a hand the blueprint does not store,
|
|
1016
|
+
or breaks a suit symmetry it folds runouts by, gets a new run on the new ranges, started from
|
|
1017
|
+
the old one's regrets. The new run stores that hand and every hand stored before it, so the
|
|
1018
|
+
way back is in place; after a range that broke a symmetry the session stays without it. A new
|
|
1019
|
+
run costs a run's setup and the copy, about 0.5 s on a 265 MiB blueprint, and holds both
|
|
1020
|
+
blueprints for that moment.
|
|
1021
|
+
- **`compressRanges`** compresses both ranges again at every move, so every move gets a new run.
|
|
1022
|
+
Measured on a big blind's call against a button's open (458 and 426 combinations), where it
|
|
1023
|
+
matters; on As Kh 7d the gain is small, 0.83× the time, and one move of five was slower.
|
|
1024
|
+
- **`algorithm: 'cfr+'`** keeps its iteration count at a move and clears its average, and
|
|
1025
|
+
settles to half the tolerance unless `resettle` gives one, since its fresh average stops
|
|
1026
|
+
moving sooner than it is good. It is the fastest of the three and the least even: on the
|
|
1027
|
+
monotone flop every move ended 0.2–1.4% of pot more exploitable than `solveLite`.
|
|
1028
|
+
|
|
1029
|
+
The runout buckets are chosen by the hands stored, so they hold for every range that changes in
|
|
1030
|
+
place. Under the blueprint's shared river histories a reserved hand's river play is not trained
|
|
1031
|
+
until it has weight, so a move that adds hands has that to settle too. Each `setRange` or
|
|
1032
|
+
`refine` makes the `LiteSolution` before it stale: it reads the session's live storage.
|
|
1033
|
+
|
|
1034
|
+
A spot that starts on the turn or the river compresses too (issue #158): give the board's four or
|
|
1035
|
+
five cards and the ranges the players hold there. A turn is matched on its board and each river
|
|
1036
|
+
that can follow. A river has no board to follow, so there each range also keeps what the other
|
|
1037
|
+
player's hands face: how much of it beats each, ties it and loses to it. The default tolerance
|
|
1038
|
+
is 0.005 past the flop. On four turns, with the ranges a flop solve arrives with after check, bet
|
|
1039
|
+
a third, call (270–497 combinations a side, issue #47's betting, 4 threads in Node):
|
|
1040
|
+
|
|
1041
|
+
| board | Lite | tolerance 0.005 | tolerance 0.01 | two Lite solves apart |
|
|
1042
|
+
|---|---|---|---|---|
|
|
1043
|
+
| Td 9d 6h 2c | 1.6 s, 11 MiB | 0.6 s, 4 MiB, 127 / 119 combinations, root play 1.2 points off | 0.5 s, 98 / 93, 3.6 | 0.6 |
|
|
1044
|
+
| As 7d 2c 7h | 2.4 s, 10 MiB | 0.7 s, 3 MiB, 87 / 123, 1.4 | 0.5 s, 70 / 95, 7.8 | 2.6 |
|
|
1045
|
+
| Qs 8s 4s 2h | 1.3 s, 6 MiB | 0.7 s, 3 MiB, 158 / 190, 1.7 | 0.6 s, 128 / 153, 1.1 | 0.6 |
|
|
1046
|
+
| 8h 8d 3c Kc | 1.6 s, 7 MiB | 0.8 s, 3 MiB, 147 / 194, 1.9 | 0.6 s, 124 / 149, 3.7 | 1.7 |
|
|
1047
|
+
|
|
1048
|
+
On the four rivers that follow (149–431 combinations) Lite took 0.1 s with the full ranges, so
|
|
1049
|
+
there is nothing to save; the root play was 0.5–2.6 points off at 0.005, where two Lite solves
|
|
1050
|
+
were 0.5–1.5 apart, and 1.6–4.6 at 0.01. The compressor's own comparison, on another solver with
|
|
1051
|
+
one bet size and averaged over every decision, put the range 0.5–0.8 points off on turns and
|
|
1052
|
+
0.1–0.5 on rivers at 0.005.
|
|
1053
|
+
|
|
776
1054
|
Measured on that spot's betting, in headless Chromium. The time counts solving and the settle
|
|
777
1055
|
checks. Root play loss is what OOP's root mix and IP's mix after a check lose at the
|
|
778
1056
|
unshared blueprint's per-action values (solved to 0.05% of pot), with that blueprint's
|
|
@@ -814,19 +1092,23 @@ const lite = solveLite(spot, { workers: 4, keepBudget: 150 * 2 ** 20, precision:
|
|
|
814
1092
|
lite.kept; // ['check check /', 'bet 18.15 call /', 'bet 82.5 call /'] on As Kh 7d
|
|
815
1093
|
```
|
|
816
1094
|
|
|
817
|
-
|
|
1095
|
+
With a budget the solve also stops later: `settle`'s tolerance is 0.005, not 0.01 (issue #123),
|
|
1096
|
+
as the ranges the kept lines bring to the turn go on improving after the root play settles.
|
|
1097
|
+
Measured the same way on 4 threads, the ranking included in the time:
|
|
818
1098
|
|
|
819
|
-
| flop | kept | settled,
|
|
820
|
-
|
|
821
|
-
| As Kh 7d | 3 lines |
|
|
822
|
-
| Ts 9s 4h | 6 lines |
|
|
823
|
-
| Ks 9s 4s | all 19 |
|
|
824
|
-
|
|
825
|
-
The root play is unchanged, and the re-solve gain
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
1.
|
|
1099
|
+
| flop | kept | settled, Chromium | peak memory | root play loss, % pot | re-solve gain, % | at tolerance 0.01 |
|
|
1100
|
+
|---|---|---|---|---|---|---|
|
|
1101
|
+
| As Kh 7d | 3 lines | 580 it, 45 s | 534 MiB | 0.022 / 0.008 | 1.8 / 1.4 | 35 s; 2.5 / 1.7 |
|
|
1102
|
+
| Ts 9s 4h | 6 lines | 440 it, 29 s | 467 MiB | 0.104 / 0.047 | 1.5 / 1.2 | 22 s; 1.8 / 1.2 |
|
|
1103
|
+
| Ks 9s 4s | all 19 | 460 it, 13 s | 315 MiB | 0.056 / 0.031 | 1.8 / 1.2 | 11 s; 2.5 / 1.9 |
|
|
1104
|
+
|
|
1105
|
+
The root play is unchanged, and keeping lines cuts the re-solve gain by a third to a half; the
|
|
1106
|
+
later stop takes off 15–28% more for out of position (3–34% in position) for 16–32% more time. What is left is still the
|
|
1107
|
+
stop: the root settles before the ranges reaching the turn do. A stop that also watched the kept
|
|
1108
|
+
lines' turn ranges did no better than a tighter root tolerance; `settle: { tolerance: 0.0035 }`
|
|
1109
|
+
re-solves at 1.6 / 1.3, 1.4 / 1.2 and 1.5 / 1.0 for 39–51% more time than 0.01. Run longer with
|
|
1110
|
+
`settle: false, iterations: 800`: As Kh 7d then re-solves at 1.3 / 1.1 in 59 s on 4 threads
|
|
1111
|
+
(533 MiB), where plain sharing gives 2.2 / 2.4.
|
|
830
1112
|
`bench/lite/` has the scripts and logs.
|
|
831
1113
|
|
|
832
1114
|
### Fitting a large tree (`largeTree`)
|
|
@@ -1019,7 +1301,10 @@ the WebAssembly engine in Node and the browser, the JavaScript engine in Node).
|
|
|
1019
1301
|
samples the deals of its own runouts, and whether a deal is walked on an iteration is a hash
|
|
1020
1302
|
of its chance node, the deal and the iteration, so every thread count walks the same deals
|
|
1021
1303
|
and a fixed count is bitwise repeatable. On 4 Chromium threads it ran 3.1–3.2× faster than on
|
|
1022
|
-
one (`bench/blueprint-share/README.md`). The baselines count against `maxBytes
|
|
1304
|
+
one (`bench/blueprint-share/README.md`). The baselines count against `maxBytes`: with `precision` unset, a spot whose 32-bit
|
|
1305
|
+
storage fits but not beside its baselines is solved at 16 bits (issue #139; on the JavaScript
|
|
1306
|
+
engine unless the solve passes `wasmStorage`), and an explicit `precision` that does not fit
|
|
1307
|
+
throws. With `p: 1` it is the exact solve, bit for bit. `rounds: [2]` samples
|
|
1023
1308
|
river deals only. It works over any storage: 32 or 16 bits (since issue #102) or compact.
|
|
1024
1309
|
|
|
1025
1310
|
### Storage: 16-bit and compact
|
|
@@ -1198,7 +1483,11 @@ realistic spots it folds nothing, at any gap (see
|
|
|
1198
1483
|
spot, with runouts bucketed as by `runoutBuckets: 3`, for that many iterations. It then
|
|
1199
1484
|
starts the real spot from those regrets. Coarse iterations are cheaper, and the real solve
|
|
1200
1485
|
picks up roughly where they left off. The answer is still the real spot's, and
|
|
1201
|
-
exploitability measures the real game. Off by default.
|
|
1486
|
+
exploitability measures the real game. Off by default. Both runs are in memory at the
|
|
1487
|
+
switch and count against `maxBytes`: with `precision` unset, a spot whose 32-bit storage
|
|
1488
|
+
leaves no room for the coarse run is solved at 16 bits, the coarse run too (issue #148; on
|
|
1489
|
+
the JavaScript engine unless the solve passes `wasmStorage`), and one that does not fit
|
|
1490
|
+
even so throws.
|
|
1202
1491
|
|
|
1203
1492
|
Measured in Chromium on one thread, stopped at 15 s, 40 coarse iterations, with root-EV
|
|
1204
1493
|
error per combination (range-weighted mean, % of pot) against a 0.1% reference:
|