From bdd132ebbfac988daff99386beb5881a56e5342b Mon Sep 17 00:00:00 2001 From: Marc Mintel Date: Sat, 21 Nov 2026 01:59:21 +0100 Subject: [PATCH] BUDGET=baum: Kostenmodell neu auf Live-Solo geeicht (HU iterationsgleich, MW 0.8-1.1), BAUM_WAHL=schritt Messknopf, Bericht Co-Authored-By: Claude Opus 5.5 --- messung/solver_kern/BUDGET_BAUM.md | 87 ++++++------------- messung/solver_kern/budget_baum/vs_iter.md | 38 ++++++++ .../budget_baum/vs_iter_schritt.md | 13 +++ messung/solver_kern/budget_baum/vs_live.md | 38 ++++++++ .../budget_baum/vs_live_schritt.md | 13 +++ src/engine/baum.rs | 21 +++-- src/engine/solver_kern.rs | 7 +- 7 files changed, 150 insertions(+), 67 deletions(-) create mode 100644 messung/solver_kern/budget_baum/vs_iter.md create mode 100644 messung/solver_kern/budget_baum/vs_iter_schritt.md create mode 100644 messung/solver_kern/budget_baum/vs_live.md create mode 100644 messung/solver_kern/budget_baum/vs_live_schritt.md diff --git a/messung/solver_kern/BUDGET_BAUM.md b/messung/solver_kern/BUDGET_BAUM.md index 1462c744..607a2e27 100644 --- a/messung/solver_kern/BUDGET_BAUM.md +++ b/messung/solver_kern/BUDGET_BAUM.md @@ -13,16 +13,14 @@ Schalter `BUDGET=baum` (aus/unset = bitgleich zu heute; in `BEKANNTE_SCHALTER`). * "Uhr" innerhalb einer Entscheidung ist ein Konto vorhergesagter ms (`baum::konto`), z. B. fuer MW-Budget je Strasse, den Notfall-Schwellwert, `tgstark=breit` (zweite Rechnung ab 900 ms) und den Zeit-Rueckfall. -## Kostenmodell (CPU-ms je Iteration; Fit ueber 238 Fixture-Entscheidungen, `BAUM_LOG=1`, SOLVER_ITER fest) -| Art | ms/Iteration | rel. Fehler | +## Kostenmodell (CPU-ms je Iteration; neu geeicht 21.11. auf `live_allein.txt`, Uhr-Lauf allein auf der Maschine) +| Art | ms/Iteration | Eichung | |---|---|---| -| hu_river | 1.37e-5 x Knoten x (c0+c1) | 16 % | -| hu_turn (k River-Karten) | k x (6.94e-7 x c0 x c1 + 1.14e-5 x Knoten x (c0+c1)) | 13 % | -| hu_flop (k Turn-Karten) | k x 1.5e-5 x Knoten x (c0+c1) | 12 % | -| mw_flop / mw_turn / mw_river | {1.0e-4, 1.06e-4, 2.97e-5} x Spieler x Summe(Kombos) | ~20 / 20 / 12 % | -Setup: HU 25 ms, MW 1.6e-3 ms je Knoten. Die Constanten stammen von einem Lauf bei ~1.35x Ueberbuchung der Maschine (CPU je Iteration -ist dort etwas hoeher), nicht von einer leeren Maschine; Eichung auf die leere Maschine steht aus (siehe unten). -Iterationen = floor((Kappe - Setup) / ms je Iteration), auf Vielfache 5 (HU) / 50 (MW) / 200 (MW River) abgerundet, mindestens Live-Minimum. +| hu_river | 7.0e-6 x Knoten x (c0+c1) | Fit auf 35 Live-Loesungen, rel. Fehler 13 % | +| hu_turn (k River-Karten) | k x (3.8e-7 x c0 x c1 + 6.4e-6 x Knoten x (c0+c1)) | 57 Loesungen, 20 % | +| hu_flop (k Turn-Karten) | k x 7.5e-6 x Knoten x (c0+c1) | 99 Loesungen, 19 % | +| mw_flop / mw_turn / mw_river | {4.2e-5, 4.8e-5, 1.75e-5} x Spieler x Summe(Kombos) | Median-Verhaeltnis zur Live-Iterationszahl (die erste, auf ueberbuchter Maschine gefittete Fassung war 1.5-2.7x zu pessimistisch) | +Setup: HU 15 ms, MW 1.6e-3 ms je Knoten. Iterationen = floor((Kappe - Setup) / ms je Iteration), auf Vielfache 5 (HU) / 50 (MW) / 200 (MW River) abgerundet, mindestens Live-Minimum. HU-Turn/Flop: Karten wie die Live-`eng`-Regel (zuerst min(16, 5.6e6/(c0 x c1)), dann bis zu dreimal verkleinern, wenn 20 Iterationen x 1.3 nicht in die Kappe passen), aber aus dem Modell, vor dem Aufbau (kein verlorener Aufbau). MW: Stufe 1 (200 Kombos, volle Slots) wird uebersprungen, wenn 1000 Iterationen nicht passen; dann (100, Slots/2), dann (50, 2). @@ -51,53 +49,24 @@ Abstand gewaehlt/Vollwert (44 Karten, je 38 Iterationen), `messung/solver_kern/b * (b) unset gegen `pokerbench-solverkern-grund-mess.exe`, beide mit `SOLVER_ZEIT=fest` (Uhr-Laeufe sind selbst nicht bitgleich): 238/238. * (c) Tabelle unten. Der saubere Live-Uhr-Lauf steht aus (siehe unten). -## (c) SOLVER_ITER gegen baum (ms je Entscheidung, Wand; Karten/Iterationen Median) -| kind | n | SOLVER_ITER mean/p99/max ms | baum mean/p99/max ms | SOLVER_ITER cards/iters (median) | baum cards/iters (median) | -|---|---|---|---|---|---| -| Flop/hu | 99 | 899/1622/2147 | 776/2046/2077 | 16/40 | 16/40 | -| Flop/mw | 32 | 942/2102/2516 | 513/1458/1527 | -/2000.0 | -/1675.0 | -| River/hu | 35 | 256/544/587 | 190/379/457 | -/100 | -/100 | -| River/mw | 5 | 873/1359/1495 | 611/817/933 | -/5600 | -/3600 | -| Turn/hu | 57 | 1632/3986/4296 | 815/1272/2284 | 16/38 | 16/35 | -| Turn/mw | 10 | 1197/2145/2934 | 595/964/1022 | -/2700.0 | -/1425.0 | -total SOLVER_ITER 238 s, baum 155 s -differ SOLVER_ITER vs baum: action 15, size only 14, of 238 - line 38 Turn/hu Call vs Fold | EV(pots) {'fold': 2.43, 'call': 2.47, 'raise to 1.50': 2.21, 'raise to 9.13': 0.0} vs {'fold': 3.06, 'call': 2.71, 'raise to 1.50': 2.55, 'raise to 9.13': 0.0} - line 54 Flop/hu Check vs Raise { to: 0.03666666666666667 } | EV(pots) {'check': 1.01} vs {'check': 1.13} - line 56 Flop/hu Raise { to: 0.06666666666666667 } vs Raise { to: 0.03333333333333333 } | EV(pots) {'check': 1.71} vs {'check': 2.24} - line 62 Flop/hu Call vs Fold | EV(pots) {'fold': 1.9, 'call': 1.98, 'raise to 3.00': 1.96, 'raise to 12.93': 0.0} vs {'fold': 3.2, 'call': 2.43, 'raise to 3.00': 2.05, 'raise to 12.93': 0.0} - line 63 Turn/hu Raise { to: 0.42 } vs Raise { to: 0.13999999999999999 } | EV(pots) {'check': 0.27} vs {'check': 0.39} - line 68 Flop/hu Check vs Raise { to: 0.03 } | EV(pots) {'check': 1.26} vs {'check': 0.94} - line 73 Flop/hu Raise { to: 0.12333333333333332 } vs Raise { to: 0.24666666666666665 } | EV(pots) {'check': 0.0} vs {'check': 0.0} - line 84 Flop/hu Raise { to: 0.33 } vs Raise { to: 0.22 } | EV(pots) {'check': 0.31} vs {'check': 0.28} - line 96 Flop/hu Raise { to: 0.05 } vs Raise { to: 0.02 } | EV(pots) {'check': 3.23} vs {'check': 3.16} - line 97 Turn/hu Raise { to: 0.05 } vs Raise { to: 0.02 } | EV(pots) {'check': 2.64} vs {'check': 3.12} - line 123 Flop/hu Raise { to: 0.11 } vs Raise { to: 0.07333333333333333 } | EV(pots) {'check': 1.34} vs {'check': 1.6} - line 133 Turn/hu Call vs Fold | EV(pots) {'fold': 1.96, 'call': 1.99, 'raise to 1.50': 2.11, 'raise to 9.63': 0.0} vs {'fold': 2.31, 'call': 2.29, 'raise to 1.50': 2.34, 'raise to 9.63': 0.0} - line 136 Flop/mw Raise { to: 0.15666666666666665 } vs Check | EV(pots) {} vs {} - line 145 Flop/hu Raise { to: 0.039999999999999994 } vs Raise { to: 0.12 } | EV(pots) {'check': 2.06} vs {'check': 1.76} - line 155 Flop/hu Raise { to: 0.03 } vs Check | EV(pots) {'check': 2.34} vs {'check': 2.21} - line 159 Turn/hu Raise { to: 0.27999999999999997 } vs Raise { to: 0.5599999999999999 } | EV(pots) {'check': 0.0} vs {'check': 0.0} - line 180 Turn/hu Raise { to: 0.02 } vs Check | EV(pots) {'check': 3.15} vs {'check': 2.82} - line 183 Flop/hu Check vs Raise { to: 0.1 } | EV(pots) {'check': 0.12} vs {'check': 0.26} - line 184 Turn/hu Check vs Raise { to: 0.05333333333333333 } | EV(pots) {'check': 0.94} vs {'check': 0.83} - line 185 Turn/hu Raise { to: 0.1 } vs Raise { to: 3.17 } | EV(pots) {'check': 0.0} vs {'check': 0.0} - line 190 Flop/hu Raise { to: 0.07333333333333333 } vs Raise { to: 0.03666666666666667 } | EV(pots) {'check': 0.48} vs {'check': 0.85} - line 199 Flop/mw Raise { to: 0.04666666666666667 } vs Raise { to: 0.023333333333333334 } | EV(pots) {} vs {} - line 200 Turn/hu Raise { to: 0.039999999999999994 } vs Raise { to: 0.07999999999999999 } | EV(pots) {'check': 0.22} vs {'check': 0.64} - line 205 Turn/hu Raise { to: 0.11 } vs Raise { to: 0.03666666666666667 } | EV(pots) {'check': 3.12} vs {'check': 2.64} - line 214 Turn/mw Raise { to: 0.1433333333333333 } vs Call | EV(pots) {} vs {} - line 218 Turn/hu Raise { to: 0.06333333333333332 } vs Check | EV(pots) {'check': 1.17} vs {'check': 1.28} - line 224 Turn/hu Check vs Raise { to: 0.07333333333333333 } | EV(pots) {'check': 0.14} vs {'check': 0.0} - line 228 Flop/hu Check vs Raise { to: 0.03666666666666667 } | EV(pots) {'check': 0.69} vs {'check': 0.69} - line 231 Turn/hu Fold vs Call | EV(pots) {'fold': 0.01, 'call': 0.0} vs {'fold': 0.0, 'call': 0.07} - -Unterschied zu SOLVER_ITER: 15 Aktionsart, 14 nur Groesse von 238 (ausser den Kipps der Spalte sind es fast nur gemischte Raise-Groessen -auf Flop/Turn und MW-Zeilen). Ursache: andere Kartenwahl (balanciert statt Schritt) und kleinere MW-Iterationen (Flop 1675 statt 2000, -Turn 1425 statt 2700, River 3600 statt 5600). Bei den Aktionsart-Kipps ist der Wertabstand klein (Call/Fold z. B. 2.43/2.47 -> 3.06/2.71 Pots). - -## Eichung offen -Mittel/Spitze (Gesamt 155 s baum; SOLVER_ITER 238 s) sind auf einer ueberbuchten Maschine gemessen; der Auftrag nennt 299 s Live. -Der saubere Live-Uhr-Lauf allein auf der Maschine fehlt: `messung/solver_kern/budget_baum/live_allein.sh` (ca. 5 min, ein Prozess), -danach `tab.py live_allein.txt baum2.txt live baum`. Stimmt das Mittel nicht, ist die Kappe je Art (BUDGET_MS etc. in -`solver_kern.rs`/`multi3_spieler.rs`) der Stellknopf; die Modellkonstanten bleiben. +## Ergebnis nach Neueichung (Fixture, `BUDGET=baum`) +* Gate (a): zwei Laeufe gleichzeitig (also unter Last, dazu andere Messungen auf der Maschine) 238/238 gleich, Notbremse 0. +* Gate (b): unset gegen mess-stand, beide `SOLVER_ZEIT=fest`: 238/238. +* Iterationen baum gegen Referenz (Median, Viertelgrenzen): HU River, Turn, Flop gegen `live_allein.txt` UND `it_neu1.txt` + (hu_*:100/40/40, mw 4050/4100/7200): exakt 1.00 (alle 191 HU-Loesungen gleich, Karten 16, bei breiten Baeumen die Live-eng-Karten). + MW Flop 0.98 (0.80-1.11) bzw. 1.00 (0.86-1.19), MW Turn 0.85 bzw. 0.76, MW River 0.89 bzw. 0.86. + MW Turn/River liegen etwas niedrig (Modellkonstanten dort auf 10 bzw. 5 Loesungen gefittet, Setup der grossen 4-Spieler-Baeume + ist nur grob modelliert); nicht weiter nachgezogen. +* Zeiten: die Neueichungs-Laeufe liefen auf einer wieder voll belegten Maschine (zwei eigene Laeufe parallel plus fremde Messungen, + Gesamt 309 s statt 86 s live solo). Die ms-Spalten von `vs_live.md` sind darum nicht vergleichbar; gueltig sind Iterationen und Karten. + Eine saubere Zeit-Spalte braucht einen Lauf allein (ca. 2 min, ein Prozess): `python lauf.py pokerbench-solverkern-budget-baum.exe x.txt BUDGET=baum` + danach `tab.py live_allein.txt x.txt live baum`. Gebaut ist die Obergrenze: HU Turn <= 900 ms, Flop <= 1000, River <= 1300, MW <= 300 ms Modell-CPU. +* Entscheidungen verschieden (von 238): + * baum (balancierte Karten) gegen live solo: 14 Aktionsart, 14 nur Groesse; gegen `it_neu1`: 15 / 13. + * baum mit `BAUM_WAHL=schritt` (alte Schritt-Kartenwahl, Messknopf): gegen `it_neu1` 3 (alle MW, Fold/Call/Raise, ohne EV-Ausgabe), + gegen live solo 3 (2 Art, 1 Groesse). => Die HU-Unterschiede stammen vollstaendig von der balancierten Kartenwahl, nicht vom Budget. + * Die Aktionsart-Kipps mit EV (HU, balanciert gegen live solo): Zeile 38 Call->Fold, EV Topf (fold/call) 2.43/2.47 -> 3.06/2.71; + 62: 1.90/1.98 -> 3.20/2.43; 133: 1.96/1.99 -> 2.31/2.29; 231 Fold->Call 0.01/0.00 -> 0.00/0.07; dazu Flop/Turn-Raise gegen Check mit + Checkwert 0.2-3.2 (siehe `vs_live.md`/`vs_iter.md`, Zeilenliste). Das sind knappe Faelle, wie die Kartenauswertung oben zeigt. +* Entscheidung offen fuer den Orchestrator: balanciert (hier, bewiesen monoton, aber andere Schaetzung als live) oder `BAUM_WAHL`-Schritt + als Standard (fast live-identisch, hat aber das Jd8h-Springen). diff --git a/messung/solver_kern/budget_baum/vs_iter.md b/messung/solver_kern/budget_baum/vs_iter.md new file mode 100644 index 00000000..67add1b4 --- /dev/null +++ b/messung/solver_kern/budget_baum/vs_iter.md @@ -0,0 +1,38 @@ +| kind | n | iter_neu mean/p99/max ms | baum mean/p99/max ms | iter_neu cards/iters (median) | baum cards/iters (median) | +|---|---|---|---|---|---| +| Flop/hu | 99 | 854/1959/3890 | 1129/3539/5060 | 16/40 | 16/40 | +| Flop/mw | 32 | 1489/3500/4121 | 1475/4582/4822 | -/4050.0 | -/4050.0 | +| River/hu | 35 | 231/458/822 | 295/765/998 | -/100 | -/100 | +| River/mw | 5 | 1187/1901/2268 | 2036/2981/3477 | -/7200 | -/6200 | +| Turn/hu | 57 | 1310/3053/3618 | 1994/5582/6072 | 16/40 | 16/40 | +| Turn/mw | 10 | 1221/1848/2316 | 1583/2423/3175 | -/4100.0 | -/3125.0 | +total iter_neu 233 s, baum 309 s +differ iter_neu vs baum: action 15, size only 13, of 238 + line 29 Flop/mw Raise { to: 0.026666666666666665 } vs Check | EV(pots) {} vs {} + line 38 Turn/hu Call vs Fold | EV(pots) {'fold': 2.43, 'call': 2.47, 'raise to 1.50': 2.21, 'raise to 9.13': 0.0} vs {'fold': 2.53, 'call': 2.47, 'raise to 1.50': 2.31, 'raise to 9.13': 0.0} + line 54 Flop/hu Check vs Raise { to: 0.03666666666666667 } | EV(pots) {'check': 1.01} vs {'check': 1.13} + line 56 Flop/hu Raise { to: 0.06666666666666667 } vs Raise { to: 0.03333333333333333 } | EV(pots) {'check': 1.71} vs {'check': 2.24} + line 62 Flop/hu Call vs Fold | EV(pots) {'fold': 1.9, 'call': 1.98, 'raise to 3.00': 1.96, 'raise to 12.93': 0.0} vs {'fold': 3.2, 'call': 2.43, 'raise to 3.00': 2.05, 'raise to 12.93': 0.0} + line 63 Turn/hu Raise { to: 0.42 } vs Raise { to: 0.13999999999999999 } | EV(pots) {'check': 0.27} vs {'check': 0.39} + line 68 Flop/hu Check vs Raise { to: 0.03 } | EV(pots) {'check': 1.26} vs {'check': 0.94} + line 73 Flop/hu Raise { to: 0.12333333333333332 } vs Raise { to: 0.24666666666666665 } | EV(pots) {'check': 0.0} vs {'check': 0.0} + line 81 Turn/hu Check vs Raise { to: 0.03666666666666667 } | EV(pots) {'check': 2.49} vs {'check': 3.33} + line 84 Flop/hu Raise { to: 0.33 } vs Raise { to: 0.22 } | EV(pots) {'check': 0.31} vs {'check': 0.28} + line 96 Flop/hu Raise { to: 0.05 } vs Raise { to: 0.02 } | EV(pots) {'check': 3.23} vs {'check': 3.16} + line 97 Turn/hu Raise { to: 0.05 } vs Raise { to: 0.02 } | EV(pots) {'check': 2.64} vs {'check': 3.11} + line 123 Flop/hu Raise { to: 0.11 } vs Raise { to: 0.07333333333333333 } | EV(pots) {'check': 1.34} vs {'check': 1.6} + line 145 Flop/hu Raise { to: 0.039999999999999994 } vs Raise { to: 0.12 } | EV(pots) {'check': 2.06} vs {'check': 1.76} + line 149 Flop/mw Fold vs Call | EV(pots) {} vs {} + line 155 Flop/hu Raise { to: 0.03 } vs Check | EV(pots) {'check': 2.34} vs {'check': 2.21} + line 159 Turn/hu Raise { to: 0.27999999999999997 } vs Raise { to: 0.5599999999999999 } | EV(pots) {'check': 0.0} vs {'check': 0.0} + line 183 Flop/hu Check vs Raise { to: 0.1 } | EV(pots) {'check': 0.12} vs {'check': 0.26} + line 184 Turn/hu Check vs Raise { to: 0.05333333333333333 } | EV(pots) {'check': 0.94} vs {'check': 0.83} + line 185 Turn/hu Raise { to: 0.1 } vs Raise { to: 3.17 } | EV(pots) {'check': 0.0} vs {'check': 0.0} + line 190 Flop/hu Raise { to: 0.07333333333333333 } vs Raise { to: 0.03666666666666667 } | EV(pots) {'check': 0.48} vs {'check': 0.85} + line 200 Turn/hu Raise { to: 0.039999999999999994 } vs Raise { to: 0.07999999999999999 } | EV(pots) {'check': 0.23} vs {'check': 0.65} + line 205 Turn/hu Raise { to: 0.11 } vs Raise { to: 0.03666666666666667 } | EV(pots) {'check': 3.12} vs {'check': 2.67} + line 218 Turn/hu Raise { to: 0.06333333333333332 } vs Check | EV(pots) {'check': 1.17} vs {'check': 1.28} + line 221 Flop/mw Fold vs Call | EV(pots) {} vs {} + line 224 Turn/hu Check vs Raise { to: 0.07333333333333333 } | EV(pots) {'check': 0.14} vs {'check': 0.0} + line 228 Flop/hu Check vs Raise { to: 0.03666666666666667 } | EV(pots) {'check': 0.69} vs {'check': 0.69} + line 231 Turn/hu Fold vs Call | EV(pots) {'fold': 0.01, 'call': 0.0} vs {'fold': 0.0, 'call': 0.07} diff --git a/messung/solver_kern/budget_baum/vs_iter_schritt.md b/messung/solver_kern/budget_baum/vs_iter_schritt.md new file mode 100644 index 00000000..bc82c1cd --- /dev/null +++ b/messung/solver_kern/budget_baum/vs_iter_schritt.md @@ -0,0 +1,13 @@ +| kind | n | iter_neu mean/p99/max ms | baum_schritt mean/p99/max ms | iter_neu cards/iters (median) | baum_schritt cards/iters (median) | +|---|---|---|---|---|---| +| Flop/hu | 99 | 854/1959/3890 | 1180/2988/4561 | 16/40 | 16/40 | +| Flop/mw | 32 | 1489/3500/4121 | 1568/3732/3736 | -/4050.0 | -/4050.0 | +| River/hu | 35 | 231/458/822 | 315/848/852 | -/100 | -/100 | +| River/mw | 5 | 1187/1901/2268 | 1611/2320/2855 | -/7200 | -/6200 | +| Turn/hu | 57 | 1310/3053/3618 | 1728/4199/4252 | 16/40 | 16/40 | +| Turn/mw | 10 | 1221/1848/2316 | 2028/3482/4418 | -/4100.0 | -/3125.0 | +total iter_neu 233 s, baum_schritt 305 s +differ iter_neu vs baum_schritt: action 3, size only 0, of 238 + line 29 Flop/mw Raise { to: 0.026666666666666665 } vs Check | EV(pots) {} vs {} + line 149 Flop/mw Fold vs Call | EV(pots) {} vs {} + line 221 Flop/mw Fold vs Call | EV(pots) {} vs {} diff --git a/messung/solver_kern/budget_baum/vs_live.md b/messung/solver_kern/budget_baum/vs_live.md new file mode 100644 index 00000000..708a5767 --- /dev/null +++ b/messung/solver_kern/budget_baum/vs_live.md @@ -0,0 +1,38 @@ +| kind | n | live mean/p99/max ms | baum mean/p99/max ms | live cards/iters (median) | baum cards/iters (median) | +|---|---|---|---|---|---| +| Flop/hu | 99 | 286/669/918 | 1129/3539/5060 | 16/40 | 16/40 | +| Flop/mw | 32 | 489/1010/1611 | 1475/4582/4822 | -/4100.0 | -/4050.0 | +| River/hu | 35 | 84/160/167 | 295/765/998 | -/100 | -/100 | +| River/mw | 5 | 715/694/1577 | 2036/2981/3477 | -/7400 | -/6200 | +| Turn/hu | 57 | 542/1539/1555 | 1994/5582/6072 | 16/40 | 16/40 | +| Turn/mw | 10 | 458/658/756 | 1583/2423/3175 | -/4100.0 | -/3125.0 | +total live 86 s, baum 309 s +differ live vs baum: action 14, size only 14, of 238 + line 28 Turn/mw Raise { to: 0.023333333333333334 } vs Check | EV(pots) {} vs {} + line 38 Turn/hu Call vs Fold | EV(pots) {'fold': 2.43, 'call': 2.47, 'raise to 1.50': 2.2, 'raise to 9.13': 0.0} vs {'fold': 2.53, 'call': 2.47, 'raise to 1.50': 2.31, 'raise to 9.13': 0.0} + line 54 Flop/hu Check vs Raise { to: 0.03666666666666667 } | EV(pots) {'check': 1.01} vs {'check': 1.13} + line 56 Flop/hu Raise { to: 0.06666666666666667 } vs Raise { to: 0.03333333333333333 } | EV(pots) {'check': 1.71} vs {'check': 2.24} + line 62 Flop/hu Call vs Fold | EV(pots) {'fold': 1.9, 'call': 1.98, 'raise to 3.00': 1.96, 'raise to 12.93': 0.0} vs {'fold': 3.2, 'call': 2.43, 'raise to 3.00': 2.05, 'raise to 12.93': 0.0} + line 63 Turn/hu Raise { to: 0.42 } vs Raise { to: 0.13999999999999999 } | EV(pots) {'check': 0.27} vs {'check': 0.39} + line 68 Flop/hu Check vs Raise { to: 0.03 } | EV(pots) {'check': 1.26} vs {'check': 0.94} + line 73 Flop/hu Raise { to: 0.12333333333333332 } vs Raise { to: 0.24666666666666665 } | EV(pots) {'check': 0.0} vs {'check': 0.0} + line 81 Turn/hu Check vs Raise { to: 0.03666666666666667 } | EV(pots) {'check': 2.49} vs {'check': 3.33} + line 84 Flop/hu Raise { to: 0.33 } vs Raise { to: 0.22 } | EV(pots) {'check': 0.31} vs {'check': 0.28} + line 96 Flop/hu Raise { to: 0.05 } vs Raise { to: 0.02 } | EV(pots) {'check': 3.23} vs {'check': 3.16} + line 97 Turn/hu Raise { to: 0.05 } vs Raise { to: 0.02 } | EV(pots) {'check': 2.64} vs {'check': 3.11} + line 123 Flop/hu Raise { to: 0.11 } vs Raise { to: 0.07333333333333333 } | EV(pots) {'check': 1.34} vs {'check': 1.6} + line 145 Flop/hu Raise { to: 0.039999999999999994 } vs Raise { to: 0.12 } | EV(pots) {'check': 2.06} vs {'check': 1.76} + line 155 Flop/hu Raise { to: 0.03 } vs Check | EV(pots) {'check': 2.34} vs {'check': 2.21} + line 159 Turn/hu Raise { to: 0.27999999999999997 } vs Raise { to: 0.5599999999999999 } | EV(pots) {'check': 0.0} vs {'check': 0.0} + line 183 Flop/hu Check vs Raise { to: 0.1 } | EV(pots) {'check': 0.12} vs {'check': 0.26} + line 184 Turn/hu Check vs Raise { to: 0.05333333333333333 } | EV(pots) {'check': 0.94} vs {'check': 0.83} + line 185 Turn/hu Raise { to: 0.1 } vs Raise { to: 3.17 } | EV(pots) {'check': 0.0} vs {'check': 0.0} + line 190 Flop/hu Raise { to: 0.07333333333333333 } vs Raise { to: 0.03666666666666667 } | EV(pots) {'check': 0.48} vs {'check': 0.85} + line 200 Turn/hu Raise { to: 0.039999999999999994 } vs Raise { to: 0.07999999999999999 } | EV(pots) {'check': 0.23} vs {'check': 0.65} + line 201 Turn/mw Raise { to: 0.04666666666666667 } vs Raise { to: 0.023333333333333334 } | EV(pots) {} vs {} + line 205 Turn/hu Raise { to: 0.11 } vs Raise { to: 0.03666666666666667 } | EV(pots) {'check': 3.12} vs {'check': 2.67} + line 218 Turn/hu Raise { to: 0.06333333333333332 } vs Check | EV(pots) {'check': 1.17} vs {'check': 1.28} + line 221 Flop/mw Fold vs Call | EV(pots) {} vs {} + line 224 Turn/hu Check vs Raise { to: 0.07333333333333333 } | EV(pots) {'check': 0.14} vs {'check': 0.0} + line 228 Flop/hu Check vs Raise { to: 0.03666666666666667 } | EV(pots) {'check': 0.69} vs {'check': 0.69} + line 231 Turn/hu Fold vs Call | EV(pots) {'fold': 0.01, 'call': 0.0} vs {'fold': 0.0, 'call': 0.07} diff --git a/messung/solver_kern/budget_baum/vs_live_schritt.md b/messung/solver_kern/budget_baum/vs_live_schritt.md new file mode 100644 index 00000000..f6bf06bb --- /dev/null +++ b/messung/solver_kern/budget_baum/vs_live_schritt.md @@ -0,0 +1,13 @@ +| kind | n | live mean/p99/max ms | baum_schritt mean/p99/max ms | live cards/iters (median) | baum_schritt cards/iters (median) | +|---|---|---|---|---|---| +| Flop/hu | 99 | 286/669/918 | 1180/2988/4561 | 16/40 | 16/40 | +| Flop/mw | 32 | 489/1010/1611 | 1568/3732/3736 | -/4100.0 | -/4050.0 | +| River/hu | 35 | 84/160/167 | 315/848/852 | -/100 | -/100 | +| River/mw | 5 | 715/694/1577 | 1611/2320/2855 | -/7400 | -/6200 | +| Turn/hu | 57 | 542/1539/1555 | 1728/4199/4252 | 16/40 | 16/40 | +| Turn/mw | 10 | 458/658/756 | 2028/3482/4418 | -/4100.0 | -/3125.0 | +total live 86 s, baum_schritt 305 s +differ live vs baum_schritt: action 2, size only 1, of 238 + line 28 Turn/mw Raise { to: 0.023333333333333334 } vs Check | EV(pots) {} vs {} + line 201 Turn/mw Raise { to: 0.04666666666666667 } vs Raise { to: 0.023333333333333334 } | EV(pots) {} vs {} + line 221 Flop/mw Fold vs Call | EV(pots) {} vs {} diff --git a/src/engine/baum.rs b/src/engine/baum.rs index 9a517bb1..1a9ca958 100644 --- a/src/engine/baum.rs +++ b/src/engine/baum.rs @@ -47,30 +47,30 @@ pub fn buche(ms: f64) { } /// Setup (ranges, tree, equity tables) of a heads-up flop/turn/river solve, CPU ms (the measured ticks are 0 to 60). -pub const HU_SETUP_MS: f64 = 25.0; +pub const HU_SETUP_MS: f64 = 15.0; /// CPU ms of one heads-up river iteration. pub fn hu_river_iter_ms(c0: usize, c1: usize, nodes: usize) -> f64 { - 1.37e-5 * nodes as f64 * (c0 + c1) as f64 + 7.0e-6 * nodes as f64 * (c0 + c1) as f64 } /// CPU ms of one heads-up turn iteration with `k` river cards. pub fn hu_turn_iter_ms(c0: usize, c1: usize, nodes: usize, k: usize) -> f64 { - k as f64 * (6.94e-7 * (c0 * c1) as f64 + 1.14e-5 * nodes as f64 * (c0 + c1) as f64) + k as f64 * (3.8e-7 * (c0 * c1) as f64 + 6.4e-6 * nodes as f64 * (c0 + c1) as f64) } /// CPU ms of one heads-up flop iteration with `k` turn cards. pub fn hu_flop_iter_ms(c0: usize, c1: usize, nodes: usize, k: usize) -> f64 { - k as f64 * 1.5e-5 * nodes as f64 * (c0 + c1) as f64 + k as f64 * 7.5e-6 * nodes as f64 * (c0 + c1) as f64 } /// CPU ms of one multiway iteration (MCCFR samples one path: the cost follows players x combos, not the node count; /// fit `ms = k x players x sum(combos)`, relative error ~20 %, the small solves are limited by the 15.6 ms clock tick). pub fn mw_iter_ms(art: Art, players: usize, combos: &[usize]) -> f64 { let k = match art { - Art::MwFlop => 1.0e-4, - Art::MwTurn => 1.06e-4, - _ => 2.97e-5, + Art::MwFlop => 4.2e-5, + Art::MwTurn => 4.8e-5, + _ => 1.75e-5, }; k * players as f64 * combos.iter().sum::() as f64 } @@ -113,3 +113,10 @@ pub fn karten_vorgabe() -> Option { static K: std::sync::OnceLock> = std::sync::OnceLock::new(); *K.get_or_init(|| std::env::var("BAUM_KARTEN").ok().and_then(|v| v.trim().parse().ok()).filter(|n: &usize| *n > 0)) } + +/// Measurement only (`BAUM_WAHL=schritt`, under `BUDGET=baum`): the old suit-sorted stride card selection instead of the balanced one, +/// to tell what a difference to the clock/`SOLVER_ITER` runs owes to the card choice. +pub fn wahl_schritt() -> bool { + static W: std::sync::OnceLock = std::sync::OnceLock::new(); + *W.get_or_init(|| std::env::var("BAUM_WAHL").as_deref() == Ok("schritt")) +} diff --git a/src/engine/solver_kern.rs b/src/engine/solver_kern.rs index 705a892a..ca8eb075 100644 --- a/src/engine/solver_kern.rs +++ b/src/engine/solver_kern.rs @@ -1740,7 +1740,12 @@ fn solve_frueh_roh(spot: &Spot, c: &Cfg, strasse: Street) -> Option let k0 = if c.eng { ((ENG_GRENZE / (combos[0] * combos[1]).max(1) as f64) as usize).clamp(2, c.karten) } else { c.karten }; turn_karten_baum = if let Some(n) = crate::engine::baum::karten_vorgabe() { n } else if c.eng { crate::engine::baum::karten_fuer(k0, 2, kappe, MIN_TURN_ITERS, &|k| crate::engine::baum::hu_turn_iter_ms(combos[0], combos[1], nodes, k)) } else { k0 }; } - let mut solver = if flop && baum { + let schritt = baum && crate::engine::baum::wahl_schritt(); + let mut solver = if schritt && flop { + TrSolver::new(game, hands, board, Some(c.flop_karten)).with_river_equity(board) + } else if schritt { + TrSolver::new(game, hands, board, Some(turn_karten_baum)) + } else if flop && baum { TrSolver::new_gleichmaessig(game, hands, board, crate::engine::baum::karten_vorgabe().unwrap_or(c.flop_karten)).with_river_equity(board) } else if flop { TrSolver::new(game, hands, board, Some(c.flop_karten)).with_river_equity(board)