AB-Diagnose: Pflicht-Mehrheit river3 (5 Seeds), A-Anteil w<0.8, Mehrweg-Streuung, Aktionswerte in der Mehrweg-Begruendung

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-21 01:03:46 +01:00
co-authored by Claude Opus 5.5
parent 3bbace6617
commit e2222cf2e2
12 changed files with 419 additions and 9 deletions
+67
View File
@@ -0,0 +1,67 @@
# AB-Diagnose: Pflicht-Mehrheit, A-Anteil, Mehrweg-Streuung (claude/ab-diag, 21.11.)
Stand buendel-ab (36c486c2) plus gated Diagnose. Entscheidungen bitgleich (12 von 12 Anfragen, SOLVER_ZEIT=fest, alt gegen neu).
## 1. Pflicht-Tor, river3 mit 5 Seeds, Mehrheit
Werkzeug `pflicht_mehrheit.py` (Seed ueber das Anfragefeld `seed`, reine Messung). 44 Faelle, live-Zeitregeln, ein Prozess.
Arme: base, A k300/500/1000, B tau 0.10 (`REG_ANKER=messung/zwilling/reg_linien.tsv`). River3-Faelle: 4 (die anderen 40 haben einen HU-Pfad, ein Lauf).
| Fall | Soll (tol.) | base | A300 | A500 | A1000 | B010 |
|---|---|---|---|---|---|---|
| 178854100443 | CHECK (RAISE<=1.0) | 5/5 CHECK | 5/5 CHECK | 5/5 CHECK | 5/5 CHECK | 5/5 CHECK |
| 179095600052 | RAISE (CHECK) | 4/5 RAISE | 5/5 RAISE | 5/5 RAISE | 5/5 RAISE | 4/5 RAISE |
| 178908100701 | RAISE (CHECK) | 4/5 CHECK (tol.) | 4/5 CHECK | 5/5 CHECK | 5/5 CHECK | 4/5 CHECK |
| 177113202312 | CALL (FOLD) | 5/5 CALL | 5/5 CALL | 5/5 CALL | 5/5 CALL | 5/5 CALL |
Soll getroffen (Mehrheit): base 42 von 44, jeder Arm 42 von 44. Rangverlust gegen base: keiner in keinem Arm. Verbesserung: keine.
Die zwei Verfehlungen sind in allen Armen gleich: 177599200076 Turn (CALL statt FOLD, HU) und 178908100701 (CHECK statt RAISE, toleriert).
Vollstaendige Tabelle: `pflicht_mehrheit_tabelle.md`, Rohdaten `pflicht_mehrheit_roh.json`.
## 2. Anteil Gegnerknoten mit Lock-Gewicht w < 0.8
3 591 echte Held-Spots (`spots.jsonl`, NL2), `STUETZUNG_LOCKS=1` (nur Knoten, kein Solve), live-Schalter. Besuchsgewicht = Reach-Masse der
Gegnerrange am Knoten (Anteil an der Wurzelmasse; Held-Reach nicht enthalten). w = w_vor * n / (n + k). Rohzahlen: `locks_anteil_roh.txt`.
ranges_echt: nicht im Live-Schalter (`modell=echt` fehlt), 0 Knoten. Quelle "linie" (schon gespielte Linie) behaelt immer ihr Gewicht, "frei" = keine Zeile.
HU, Anteil w < 0.8 je Quelle und Strasse (Knoten / reach-gewichtet):
| Quelle | Strasse | Knoten | k1000 | k5000 | min n | Median n |
|---|---|---|---|---|---|---|
| wett_kurve | Flop | 3 825 | 2.7 % / 2.6 % | 30.1 % / 30.1 % | 892 | 23 512 |
| wett_kurve | Turn | 4 440 | 0.0 % / 0.0 % | 43.1 % / 43.8 % | 6 078 | 29 103 |
| wett_kurve | River | 3 589 | 8.1 % / 8.2 % | 51.8 % / 50.1 % | 1 517 | 17 185 |
| BETTOR | Flop | 413 | 0 % | 0 % | 22 678 | 49 981 |
| BETTOR | Turn | 518 | 0 % | 22.8 % | 14 903 | 30 950 |
| BETTOR | River | 354 | 0 % | 10.2 % | 11 121 | 31 797 |
| raise_pool | alle | 21 810 | 0 % | 0 % | 31 608 (fest) | 31 608 |
Alle gesperrten HU-Knoten ausser "linie" (34 949): k1000 1.1 % unter 0.8, k5000 14.5 %. Mittleres w: k1000 0.92 bis 0.97, k5000 0.73 bis 0.87.
Der Raise-Pool hat eine feste Konstante n = 31 608, also nie unter 0.8 (w 0.969 / 0.863).
Mehrweg (nur Knotenzahl, kein Reach; BETTOR im Mehrweg nicht aktiv, SOLVER3_OFFEN fehlt; Kartenslots zaehlen je Knoten): wett_kurve
Flop 11 653 Knoten, River 1 479 245, Turn 2 005 335. Anteil w < 0.8: k1000 8.0 % / 0.0 % / 0.0 %; k5000 48.0 % / 71.6 % / 88.6 %
(Median n Flop 20 011, River 13 650, Turn 9 120).
Lesart: k1000 beruehrt nur 1 % der HU-Knoten (Schwerpunkt River-Wett-Kurve), k5000 jeden siebten, am staerksten die Wett-Kurve
(30 bis 52 %). Im Mehrweg bei k5000 ueber die Haelfte der Antwortknoten.
## 3. Zeilenstreuung Mehrweg Flop/Turn (10 Seeds, SOLVER_ZEIT=fest, volle 12 000 Iterationen)
Heldenzeile an der Wurzel (alle Aktionen), je Spot Mittelwert und Streuung der Seeds. P(Modus) = Wahrscheinlichkeit der im Mittel haeufigsten Aktion.
| Spot | Mittelzeile | sd je Aktion | P(Modus) min..max |
|---|---|---|---|
| 178549401104 Flop | .93/.02/.04/0 | .16/.06/.09/.01 | 0.47..1.00 |
| 178789400240 Flop | 1.0 | 0 | 1.00 |
| 178786700247 Flop | .09/.67/.24/0 | .15/.32/.26/0 | 0.01..0.99 |
| 178698900619 Flop | 1.0 | 0 | 1.00 |
| 177509800161 Turn | 0/.19/.81/0 | 0/.12/.12/0 | 0.64..0.96 |
| 177541900226 Turn | 1.0 | 0 | 1.00 |
| 177509800163 Turn | .22/.78/0/0 | .12/.12/0/0 | 0.48..0.92 |
| 177106501507 Turn | 0/1 | 0 | 1.00 |
Vier von acht Spots eindeutig (sd 0); die uebrigen vier gemischt mit sd 0.12 bis 0.32, also dieselbe Streuung wie river3 (0.14 bis 0.22 bei 40 000 Iterationen).
Ein Seed reicht dort nicht fuer eine knappe Aktion.
## Zusatz: Aktionswerte in der Begruendung (river3, flop3, turn3)
Die Begruendung traegt jetzt `; values (pots/bb): check +x/+y, bet 0.33 ...` (Wert der Heldenhand je Wurzelaktion, t-gewichtet gegen die laufende
Gegnerstrategie, relativ zur schwaechsten Aktion). Beispiel 178908100701 (9hKh, Full House): check +0.761 Topf, bet 0.33 +0.754, also Luecke 0.007 Topf
(0.16 bb): echte Indifferenz, die Aktion entscheidet die Ziehung. Rein diagnostisch, 12 von 12 Entscheidungen bitgleich.
@@ -0,0 +1,43 @@
lock lines 3532829 spots 3585
== hu kappa 1000 ==
quelle/strasse | Knoten | davon n unbekannt | Anteil w<0.8 (Knoten) | Anteil w<0.8 (reach-gew.) | Anteil w<0.8 (je Spot normiert) | mittleres w | min n | Median n
BETTOR / Flop | 413 | 0 | 0.0 % | 0.0 % | 0.0 % | 0.971 | 22678.2 | 49980.7
BETTOR / River | 354 | 0 | 0.0 % | 0.0 % | 0.0 % | 0.970 | 11121.4 | 31797.4
BETTOR / Turn | 518 | 0 | 0.0 % | 0.0 % | 0.0 % | 0.967 | 14903.2 | 30950.4
linie / Flop | 571 | 571 | 0.0 % | 0.0 % | 0.0 % | 1.000 | - | -
linie / River | 425 | 422 | 0.0 % | 0.0 % | 0.0 % | 1.000 | 23583.0 | 30561.2
linie / Turn | 651 | 651 | 0.0 % | 0.0 % | 0.0 % | 1.000 | - | -
raise_pool / Flop | 5995 | 0 | 0.0 % | 0.0 % | 0.0 % | 0.969 | 31607.8 | 31607.8
raise_pool / River | 8907 | 0 | 0.0 % | 0.0 % | 0.0 % | 0.969 | 31607.8 | 31607.8
raise_pool / Turn | 6908 | 0 | 0.0 % | 0.0 % | 0.0 % | 0.969 | 31607.8 | 31607.8
wett_kurve / Flop | 3825 | 0 | 2.7 % | 2.6 % | 2.9 % | 0.946 | 892.0 | 23512.0
wett_kurve / River | 3589 | 0 | 8.1 % | 8.2 % | 7.7 % | 0.919 | 1517.0 | 17185.0
wett_kurve / Turn | 4440 | 0 | 0.0 % | 0.0 % | 0.0 % | 0.937 | 6078.0 | 29103.0
== hu kappa 5000 ==
quelle/strasse | Knoten | davon n unbekannt | Anteil w<0.8 (Knoten) | Anteil w<0.8 (reach-gew.) | Anteil w<0.8 (je Spot normiert) | mittleres w | min n | Median n
BETTOR / Flop | 413 | 0 | 0.0 % | 0.0 % | 0.0 % | 0.874 | 22678.2 | 49980.7
BETTOR / River | 354 | 0 | 10.2 % | 10.2 % | 10.2 % | 0.868 | 11121.4 | 31797.4
BETTOR / Turn | 518 | 0 | 22.8 % | 22.8 % | 22.8 % | 0.859 | 14903.2 | 30950.4
linie / Flop | 571 | 571 | 0.0 % | 0.0 % | 0.0 % | 1.000 | - | -
linie / River | 425 | 422 | 0.0 % | 0.0 % | 0.0 % | 0.999 | 23583.0 | 30561.2
linie / Turn | 651 | 651 | 0.0 % | 0.0 % | 0.0 % | 1.000 | - | -
raise_pool / Flop | 5995 | 0 | 0.0 % | 0.0 % | 0.0 % | 0.863 | 31607.8 | 31607.8
raise_pool / River | 8907 | 0 | 0.0 % | 0.0 % | 0.0 % | 0.863 | 31607.8 | 31607.8
raise_pool / Turn | 6908 | 0 | 0.0 % | 0.0 % | 0.0 % | 0.863 | 31607.8 | 31607.8
wett_kurve / Flop | 3825 | 0 | 30.1 % | 30.1 % | 30.2 % | 0.815 | 892.0 | 23512.0
wett_kurve / River | 3589 | 0 | 51.8 % | 50.1 % | 50.6 % | 0.728 | 1517.0 | 17185.0
wett_kurve / Turn | 4440 | 0 | 43.1 % | 43.8 % | 43.4 % | 0.772 | 6078.0 | 29103.0
== mw kappa 1000 ==
quelle/strasse | Knoten | davon n unbekannt | Anteil w<0.8 (Knoten) | Anteil w<0.8 (reach-gew.) | Anteil w<0.8 (je Spot normiert) | mittleres w | min n | Median n
wett_kurve / Flop | 11653 | 0 | 8.0 % | - | - | 0.907 | 892.0 | 20011.0
wett_kurve / River | 1479245 | 0 | 0.0 % | - | - | 0.925 | 6943.0 | 13650.0
wett_kurve / Turn | 2005335 | 0 | 0.0 % | - | - | 0.902 | 5353.0 | 9120.0
== mw kappa 5000 ==
quelle/strasse | Knoten | davon n unbekannt | Anteil w<0.8 (Knoten) | Anteil w<0.8 (reach-gew.) | Anteil w<0.8 (je Spot normiert) | mittleres w | min n | Median n
wett_kurve / Flop | 11653 | 0 | 48.0 % | - | - | 0.736 | 892.0 | 20011.0
wett_kurve / River | 1479245 | 0 | 71.6 % | - | - | 0.719 | 6943.0 | 13650.0
wett_kurve / Turn | 2005335 | 0 | 88.6 % | - | - | 0.658 | 5353.0 | 9120.0
@@ -0,0 +1,8 @@
178549401104/FLOP/0.16/0.32 seeds 10 mean row [0.93, 0.02, 0.04, 0.0] sd row [0.16, 0.06, 0.09, 0.01] modal 0 P(modal) min 0.47 max 1.00
178789400240/FLOP/0.06/0.23 seeds 10 mean row [1.0, 0.0, 0.0, 0.0] sd row [0.0, 0.0, 0.0, 0.0] modal 0 P(modal) min 1.00 max 1.00
178786700247/FLOP/0.17/0.85 seeds 10 mean row [0.09, 0.67, 0.24, 0.0] sd row [0.15, 0.32, 0.26, 0.0] modal 1 P(modal) min 0.01 max 0.99
178698900619/FLOP/0.09/0.21 seeds 10 mean row [1.0, 0.0, 0.0, 0.0] sd row [0.0, 0.0, 0.0, 0.0] modal 0 P(modal) min 1.00 max 1.00
177509800161/TURN/0.02/0.17 seeds 10 mean row [0.0, 0.19, 0.81, 0.0] sd row [0.0, 0.12, 0.12, 0.0] modal 2 P(modal) min 0.64 max 0.96
177541900226/TURN/0.26/0.92 seeds 10 mean row [1.0, 0.0, 0.0, 0.0] sd row [0.0, 0.0, 0.0, 0.0] modal 0 P(modal) min 1.00 max 1.00
177509800163/TURN/0.02/0.21 seeds 10 mean row [0.22, 0.78, 0.0, 0.0] sd row [0.12, 0.12, 0.0, 0.0] modal 1 P(modal) min 0.48 max 0.92
177106501507/TURN/0.32/1.25 seeds 10 mean row [0.0, 1.0] sd row [0.0, 0.0] modal 1 P(modal) min 1.00 max 1.00
@@ -0,0 +1,112 @@
"""Pflicht-Tor mit Mehrheitsvotum ueber 5 Seeds fuer die Mehrweg-River-Faelle (river3).
python -X utf8 messung/solver_kern/stuetzung/pflicht_mehrheit.py <aus.json> [--seeds 5] [--neu]
Der Seed kommt ueber das Anfragefeld `seed` (src/wire/decode.rs, Vorgabe DEFAULT_SEED): reine Messung, kein Live-Schalter.
Der river3-Solver (CFR mit Stichproben) zieht hero's Aktion aus seiner Mittelzeile mit einer vom Seed abhaengigen
Ziehung; ein Seed ist darum Rauschen. Pass 1: alle Faelle, ein Seed, alle Arme (erkennt river3 an `river3` in der
Begruendung). Pass 2: river3-Faelle mit Seeds 1..N. Urteil je Fall und Arm: Mehrheit der Aktion (Rang 2 Soll,
1 toleriert, 0 falsch), Bericht "k/N AKTION".
"""
import json, os, sys, collections
HIER = os.path.dirname(os.path.abspath(__file__))
BAUM = os.path.abspath(os.path.join(HIER, "..", "..", ".."))
sys.path.insert(0, os.path.join(BAUM, "werkzeuge"))
sys.path.insert(0, os.path.join(BAUM, "lesen"))
import pflichtfaelle as pf # noqa: E402
import livefaelle # noqa: E402
import roentgen # noqa: E402
REG = "D:/Projects/pokerfreak/messung/zwilling/reg_linien.tsv"
ARME = {
"base": "",
"A300": "STUETZUNG=k:300",
"A500": "STUETZUNG=k:500",
"A1000": "STUETZUNG=k:1000",
"B010": "REG_ANKER=%s,tau:0.10" % REG,
}
def lauf(arme, seeds=5, aus=None):
faelle = pf.laden()
ordner = os.path.join(BAUM, "archiv", "roentgen", "kern")
exe = os.path.join(BAUM, "target", "release", "rechner" + pf.EXE)
kopie = roentgen.kern_kopie(exe, ordner, "pokerbench-solverkern-pflicht3" + pf.EXE)
kern = roentgen.kern_aufruf(kopie, timeout_je=30.0, prioritaet=roentgen.BELOW_NORMAL_PRIORITY_CLASS)
live = roentgen.lies_schalter(os.path.join(BAUM, "betrieb", "kern_schalter.txt"))
envs = {n: livefaelle.kandidat_env(live, livefaelle.arm_lesen(a)) for n, a in arme.items()}
for e in envs.values():
e["POKERBENCH_THREADS"] = "1"
erg = {n: {} for n in arme}
for n, env in envs.items():
ants = kern([f["anfrage"] for f in faelle], env)
for i, a in enumerate(ants):
erg[n][i] = [a]
print("pass1", n, len(ants), flush=True)
r3 = sorted({i for n in arme for i, x in erg[n].items() if "river3" in str(x[0].get("reason"))})
print("river3-Faelle:", [faelle[i]["hand"] for i in r3], flush=True)
for n, env in envs.items():
for s in range(1, seeds + 1):
anfr = []
for i in r3:
a = dict(faelle[i]["anfrage"])
a["seed"] = s
anfr.append(a)
ants = kern(anfr, env)
for i, a in zip(r3, ants):
erg[n][i].append(a)
print("pass2", n, "seed", s, flush=True)
out = {"arme": arme, "river3": r3,
"antworten": {n: {str(i): [{"action": a.get("action"), "size": a.get("size"), "reason": a.get("reason")} for a in v] for i, v in e.items()} for n, e in erg.items()}}
if aus:
json.dump(out, open(aus, "w", encoding="utf-8"), ensure_ascii=False)
return out
def votum(f, antworten, ist_r3):
xs = antworten[1:] if ist_r3 else antworten[:1]
zaehl = collections.Counter(pf._antwort(f, a)[0] for a in xs)
akt, k = zaehl.most_common(1)[0]
rs = collections.Counter(pf.rang(f, pf._antwort(f, a)) for a in xs if pf._antwort(f, a)[0] == akt)
return rs.most_common(1)[0][0], "%d/%d %s" % (k, len(xs), akt)
def bericht(out):
faelle = pf.laden()
arme = list(out["arme"])
r3 = set(out["river3"])
zeilen = ["| Hand | Str | Soll (tol.) | live damals | river3 | " + " | ".join(arme) + " |", "|---|---|---|---|---|" + "---|" * len(arme)]
basis = arme[0]
ver = {n: [] for n in arme[1:]}
bes = {n: [] for n in arme[1:]}
rs = {n: 0 for n in arme}
for i, f in enumerate(faelle):
zs, rr = [], {}
for n in arme:
r, t = votum(f, out["antworten"][n][str(i)], i in r3)
rr[n] = r
rs[n] += r == 2
zs.append("%s (%s)" % (t, "S" if r == 2 else "t" if r == 1 else "X"))
for n in arme[1:]:
if rr[n] < rr[basis]:
ver[n].append(f["hand"])
if rr[n] > rr[basis]:
bes[n].append(f["hand"])
zeilen.append("| %s | %s | %s | %s | %s | %s |" % (f["hand"], f.get("street"), "/".join(f["soll"]) + (" (tol " + "/".join(f.get("toleriert") or []) + ")" if f.get("toleriert") else ""),
f.get("live_aktion"), "ja" if i in r3 else "", " | ".join(zs)))
kopf = ["Soll getroffen (Mehrheit): " + ", ".join("%s %d von %d" % (n, rs[n], len(faelle)) for n in arme),
"Rangverlust gegen base (Mehrheit): " + "; ".join("%s: %s" % (n, ",".join(v) or "keiner") for n, v in ver.items()),
"Rangverbesserung gegen base (Mehrheit): " + "; ".join("%s: %s" % (n, ",".join(v) or "keine") for n, v in bes.items())]
return "\n".join("- " + k for k in kopf) + "\n\n" + "\n".join(zeilen)
if __name__ == "__main__":
a = sys.argv[1:]
aus = a[0]
n = int(a[a.index("--seeds") + 1]) if "--seeds" in a else 5
if os.path.exists(aus) and "--neu" not in a:
out = json.load(open(aus, encoding="utf-8"))
else:
out = lauf(ARME, n, aus)
print(bericht(out))
File diff suppressed because one or more lines are too long
@@ -0,0 +1,50 @@
- Soll getroffen (Mehrheit): base 42 von 44, A300 42 von 44, A500 42 von 44, A1000 42 von 44, B010 42 von 44
- Rangverlust gegen base (Mehrheit): A300: keiner; A500: keiner; A1000: keiner; B010: keiner
- Rangverbesserung gegen base (Mehrheit): A300: keine; A500: keine; A1000: keine; B010: keine
| Hand | Str | Soll (tol.) | live damals | river3 | base | A300 | A500 | A1000 | B010 |
|---|---|---|---|---|---|---|---|---|---|
| 178593300919 | TURN | FOLD (tol CALL) | CALL | | 1/1 FOLD (S) | 1/1 FOLD (S) | 1/1 FOLD (S) | 1/1 FOLD (S) | 1/1 FOLD (S) |
| 178593300919 | RIVER | FOLD | CALL | | 1/1 FOLD (S) | 1/1 FOLD (S) | 1/1 FOLD (S) | 1/1 FOLD (S) | 1/1 FOLD (S) |
| 177599200076 | RIVER | FOLD | CALL | | 1/1 FOLD (S) | 1/1 FOLD (S) | 1/1 FOLD (S) | 1/1 FOLD (S) | 1/1 FOLD (S) |
| 177536500401 | RIVER | FOLD | CALL | | 1/1 FOLD (S) | 1/1 FOLD (S) | 1/1 FOLD (S) | 1/1 FOLD (S) | 1/1 FOLD (S) |
| 177536500403 | RIVER | FOLD | CALL | | 1/1 FOLD (S) | 1/1 FOLD (S) | 1/1 FOLD (S) | 1/1 FOLD (S) | 1/1 FOLD (S) |
| 177536500421 | RIVER | FOLD | CALL | | 1/1 FOLD (S) | 1/1 FOLD (S) | 1/1 FOLD (S) | 1/1 FOLD (S) | 1/1 FOLD (S) |
| 177613400152 | RIVER | FOLD | CALL | | 1/1 FOLD (S) | 1/1 FOLD (S) | 1/1 FOLD (S) | 1/1 FOLD (S) | 1/1 FOLD (S) |
| 177619300146 | RIVER | FOLD | CALL | | 1/1 FOLD (S) | 1/1 FOLD (S) | 1/1 FOLD (S) | 1/1 FOLD (S) | 1/1 FOLD (S) |
| 177600300575 | RIVER | FOLD | CALL | | 1/1 FOLD (S) | 1/1 FOLD (S) | 1/1 FOLD (S) | 1/1 FOLD (S) | 1/1 FOLD (S) |
| 177599200076 | TURN | FOLD | CALL | | 1/1 CALL (X) | 1/1 CALL (X) | 1/1 CALL (X) | 1/1 CALL (X) | 1/1 CALL (X) |
| 177718400199 | TURN | FOLD | CALL | | 1/1 FOLD (S) | 1/1 FOLD (S) | 1/1 FOLD (S) | 1/1 FOLD (S) | 1/1 FOLD (S) |
| 177113201687 | FLOP | FOLD/CALL | RAISE | | 1/1 CALL (S) | 1/1 CALL (S) | 1/1 CALL (S) | 1/1 CALL (S) | 1/1 CALL (S) |
| 177087901694 | FLOP | FOLD/CALL | RAISE | | 1/1 CALL (S) | 1/1 CALL (S) | 1/1 CALL (S) | 1/1 CALL (S) | 1/1 CALL (S) |
| 177862900036 | TURN | FOLD/CALL | RAISE | | 1/1 CALL (S) | 1/1 CALL (S) | 1/1 CALL (S) | 1/1 CALL (S) | 1/1 CALL (S) |
| 178854100443 | RIVER | CHECK (tol RAISE<=1.0) | RAISE | ja | 5/5 CHECK (S) | 5/5 CHECK (S) | 5/5 CHECK (S) | 5/5 CHECK (S) | 5/5 CHECK (S) |
| 178870300411 | RIVER | FOLD | CALL | | 1/1 FOLD (S) | 1/1 FOLD (S) | 1/1 FOLD (S) | 1/1 FOLD (S) | 1/1 FOLD (S) |
| 178903200610 | RIVER | RAISE (tol CHECK) | CHECK | | 1/1 RAISE (S) | 1/1 RAISE (S) | 1/1 RAISE (S) | 1/1 RAISE (S) | 1/1 RAISE (S) |
| 179095600052 | RIVER | RAISE (tol CHECK) | CHECK | ja | 4/5 RAISE (S) | 5/5 RAISE (S) | 5/5 RAISE (S) | 5/5 RAISE (S) | 4/5 RAISE (S) |
| 178908100701 | RIVER | RAISE (tol CHECK) | CHECK | ja | 4/5 CHECK (t) | 4/5 CHECK (t) | 5/5 CHECK (t) | 5/5 CHECK (t) | 4/5 CHECK (t) |
| 177113201683 | FLOP | CALL (tol FOLD) | RAISE | | 1/1 CALL (S) | 1/1 CALL (S) | 1/1 CALL (S) | 1/1 CALL (S) | 1/1 CALL (S) |
| 177113202312 | RIVER | CALL (tol FOLD) | RAISE | ja | 5/5 CALL (S) | 5/5 CALL (S) | 5/5 CALL (S) | 5/5 CALL (S) | 5/5 CALL (S) |
| 179003200362 | RIVER | CALL (tol FOLD) | RAISE | | 1/1 CALL (S) | 1/1 CALL (S) | 1/1 CALL (S) | 1/1 CALL (S) | 1/1 CALL (S) |
| 178933500669 | RIVER | CHECK | RAISE | | 1/1 CHECK (S) | 1/1 CHECK (S) | 1/1 CHECK (S) | 1/1 CHECK (S) | 1/1 CHECK (S) |
| 178907801564 | RIVER | CHECK (tol RAISE<=1.0) | RAISE | | 1/1 CHECK (S) | 1/1 CHECK (S) | 1/1 CHECK (S) | 1/1 CHECK (S) | 1/1 CHECK (S) |
| 179404400152 | PREFLOP | FOLD | CALL | | 1/1 FOLD (S) | 1/1 FOLD (S) | 1/1 FOLD (S) | 1/1 FOLD (S) | 1/1 FOLD (S) |
| 177613400122 | FLOP | CHECK/CALL/FOLD/RAISE<=1.56 | RAISE | | 1/1 CALL (S) | 1/1 CALL (S) | 1/1 CALL (S) | 1/1 CALL (S) | 1/1 CALL (S) |
| 177679200513 | TURN | CHECK/CALL/FOLD/RAISE<=1.77 | RAISE | | 1/1 CALL (S) | 1/1 CALL (S) | 1/1 CALL (S) | 1/1 CALL (S) | 1/1 CALL (S) |
| 177776800160 | TURN | CHECK/CALL/FOLD/RAISE<=1.71 | RAISE | | 1/1 CALL (S) | 1/1 CALL (S) | 1/1 CALL (S) | 1/1 CALL (S) | 1/1 CALL (S) |
| 177689800533 | RIVER | CHECK/CALL/FOLD/RAISE<=1.43 | RAISE | | 1/1 RAISE (S) | 1/1 RAISE (S) | 1/1 RAISE (S) | 1/1 RAISE (S) | 1/1 RAISE (S) |
| 177689800544 | RIVER | CHECK/CALL/FOLD/RAISE<=1.80 | RAISE | | 1/1 CALL (S) | 1/1 CALL (S) | 1/1 CALL (S) | 1/1 CALL (S) | 1/1 CALL (S) |
| 177087902397 | TURN | CHECK/CALL/FOLD/RAISE<=1.80 | RAISE | | 1/1 CALL (S) | 1/1 CALL (S) | 1/1 CALL (S) | 1/1 FOLD (S) | 1/1 FOLD (S) |
| 177810700200 | FLOP | CHECK/CALL/FOLD/RAISE<=1.89 | RAISE | | 1/1 RAISE (S) | 1/1 RAISE (S) | 1/1 RAISE (S) | 1/1 RAISE (S) | 1/1 CALL (S) |
| 177730700400 | FLOP | CHECK/CALL/FOLD/RAISE<=1.65 | RAISE | | 1/1 CALL (S) | 1/1 CALL (S) | 1/1 CALL (S) | 1/1 CALL (S) | 1/1 CALL (S) |
| 178371400594 | TURN | CHECK/CALL/FOLD/RAISE<=1.41 | RAISE | | 1/1 CALL (S) | 1/1 CALL (S) | 1/1 CALL (S) | 1/1 CALL (S) | 1/1 CALL (S) |
| 178543200043 | FLOP | CHECK/CALL/FOLD/RAISE<=1.76 | RAISE | | 1/1 CALL (S) | 1/1 CALL (S) | 1/1 CALL (S) | 1/1 CALL (S) | 1/1 CALL (S) |
| 178493100165 | FLOP | CHECK/CALL/FOLD/RAISE<=2.00 | RAISE | | 1/1 CALL (S) | 1/1 CALL (S) | 1/1 CALL (S) | 1/1 CALL (S) | 1/1 CALL (S) |
| 178805500097 | RIVER | CHECK/CALL/FOLD/RAISE<=1.0 | RAISE | | 1/1 RAISE (S) | 1/1 RAISE (S) | 1/1 RAISE (S) | 1/1 CHECK (S) | 1/1 RAISE (S) |
| 178702201349 | RIVER | CHECK/CALL/FOLD/RAISE<=1.0 | RAISE | | 1/1 CHECK (S) | 1/1 CHECK (S) | 1/1 CHECK (S) | 1/1 CHECK (S) | 1/1 CHECK (S) |
| 179003500246 | FLOP | CHECK/CALL/FOLD/RAISE<=1.50 | RAISE | | 1/1 CALL (S) | 1/1 CALL (S) | 1/1 CALL (S) | 1/1 CALL (S) | 1/1 CALL (S) |
| 179132701195 | RIVER | CHECK/CALL/FOLD/RAISE<=1.0 | RAISE | | 1/1 RAISE (S) | 1/1 RAISE (S) | 1/1 RAISE (S) | 1/1 RAISE (S) | 1/1 RAISE (S) |
| 179403500241 | TURN | CHECK/CALL/FOLD/RAISE<=1.67 | RAISE | | 1/1 CALL (S) | 1/1 CALL (S) | 1/1 CALL (S) | 1/1 CALL (S) | 1/1 CALL (S) |
| 178887301815 | FLOP | CHECK/CALL/FOLD/RAISE<=1.86 | RAISE | | 1/1 CALL (S) | 1/1 CALL (S) | 1/1 CALL (S) | 1/1 CALL (S) | 1/1 CALL (S) |
| 179394000343 | TURN | CHECK/CALL/FOLD/RAISE<=1.65 | RAISE | | 1/1 RAISE (S) | 1/1 RAISE (S) | 1/1 RAISE (S) | 1/1 RAISE (S) | 1/1 CALL (S) |
| 180802100046 | RIVER | CALL | FOLD | | 1/1 CALL (S) | 1/1 CALL (S) | 1/1 CALL (S) | 1/1 CALL (S) | 1/1 CALL (S) |
+3
View File
@@ -38,6 +38,9 @@ fn main() {
if spot.to_call > 0.0 { "/gegen" } else { "/offen" } if spot.to_call > 0.0 { "/gegen" } else { "/offen" }
); );
let lage = format!("{lage}{}{}", if spot.hero_cards.len() > 2 { "/omaha" } else { "" }, if extras_turnier(req) { "/icm" } else { "" }); let lage = format!("{lage}{}{}", if spot.hero_cards.len() > 2 { "/omaha" } else { "" }, if extras_turnier(req) { "/icm" } else { "" });
if std::env::var("STUETZUNG_LOCKS").is_ok() {
eprintln!("STZ_SPOT {}", feld(&v, "id").map_or(String::new(), |x| format!("{x:?}")));
}
rechner::engine::solver_kern::grund_nehmen(); rechner::engine::solver_kern::grund_nehmen();
rechner::engine::multi3_spieler::grund_nehmen(); rechner::engine::multi3_spieler::grund_nehmen();
let t0 = std::time::Instant::now(); let t0 = std::time::Instant::now();
+25 -1
View File
@@ -398,6 +398,8 @@ pub struct SolverM {
rng: Xs, rng: Xs,
t: u64, t: u64,
/// As `river3::Solver3`: the pool's row per hand and its weight per node. /// As `river3::Solver3`: the pool's row per hand and its weight per node.
/// Diagnosis only: hero's root node and hand, the t-weighted sum of the value of each act and the weight (`werte`).
werte_diag: Option<(usize, usize, Vec<f64>, f64)>,
locks: Vec<Option<(std::sync::Arc<Vec<f64>>, f64)>>, locks: Vec<Option<(std::sync::Arc<Vec<f64>>, f64)>>,
} }
@@ -454,7 +456,7 @@ impl SolverM {
} else { } else {
Vec::new() Vec::new()
}; };
SolverM { game, hands, board, slot_cards, karten_slot, extra, cum, regret, avg, rng: Xs(seed | 1), t: 0, locks } SolverM { game, hands, board, slot_cards, karten_slot, extra, cum, regret, avg, rng: Xs(seed | 1), t: 0, locks, werte_diag: None }
} }
/// Lock `node`'s player to the pool rows `rows` (one row per hand over the node's acts) with weight `w`. /// Lock `node`'s player to the pool rows `rows` (one row per hand over the node's acts) with weight `w`.
@@ -637,6 +639,14 @@ impl SolverM {
vals.push(self.walk(kids[k], i, d, live, &r)); vals.push(self.walk(kids[k], i, d, live, &r));
} }
let t = self.t as f64; let t = self.t as f64;
if let Some((wn, wh, sum, ws)) = &mut self.werte_diag {
if *wn == node && live[*wh] != 0.0 {
for k in 0..a {
sum[k] += t * vals[k][*wh];
}
*ws += t;
}
}
let mut out = vec![0.0; n]; let mut out = vec![0.0; n];
for h in 0..n { for h in 0..n {
if live[h] == 0.0 { if live[h] == 0.0 {
@@ -702,6 +712,20 @@ impl SolverM {
self.regret[node][h * a..(h + 1) * a].iter().map(|r| r / z).collect() self.regret[node][h * a..(h + 1) * a].iter().map(|r| r / z).collect()
} }
/// Diagnosis only: watch hero's hand `hand` at root `node` (no effect on the solve).
pub fn werte_beobachten(&mut self, node: usize, hand: usize) {
let a = match &self.game.nodes[node] {
NodeM::Dec { acts, .. } => acts.len(),
_ => return,
};
self.werte_diag = Some((node, hand, vec![0.0; a], 0.0));
}
/// Diagnosis only: the t-weighted mean value (chips of this street, net of its own bets) of each act of the watched hand.
pub fn werte(&self) -> Option<Vec<f64>> {
self.werte_diag.as_ref().filter(|w| w.3 > 0.0).map(|(_, _, s, z)| s.iter().map(|x| x / z).collect())
}
pub fn iterations(&self) -> u64 { pub fn iterations(&self) -> u64 {
self.t self.t
} }
+25 -1
View File
@@ -359,6 +359,8 @@ pub struct Solver3 {
t: u64, t: u64,
/// Per node: the measured pool's row per hand (hand-major) and its weight; the player plays `(1 - w) * CFR + w * row` /// Per node: the measured pool's row per hand (hand-major) and its weight; the player plays `(1 - w) * CFR + w * row`
/// where the others see him (node-locking as in the heads-up core, `TrSolver::lock`). /// where the others see him (node-locking as in the heads-up core, `TrSolver::lock`).
/// Diagnosis only: hero's root node and hand, the t-weighted sum of the value of each act and the weight (`werte`).
werte_diag: Option<(usize, usize, Vec<f64>, f64)>,
locks: Vec<Option<(Vec<f64>, f64)>>, locks: Vec<Option<(Vec<f64>, f64)>>,
} }
@@ -383,7 +385,7 @@ impl Solver3 {
let regret = sized(&|p, a| hands[p].masks.len() * a); let regret = sized(&|p, a| hands[p].masks.len() * a);
let avg = sized(&|p, a| hands[p].masks.len() * a); let avg = sized(&|p, a| hands[p].masks.len() * a);
let locks = vec![None; game.nodes.len()]; let locks = vec![None; game.nodes.len()];
Solver3 { game, hands, score, cum, regret, avg, rng: Xs(seed | 1), t: 0, locks } Solver3 { game, hands, score, cum, regret, avg, rng: Xs(seed | 1), t: 0, locks, werte_diag: None }
} }
/// Lock `node`'s player to the pool rows `rows` (one row per hand over the node's acts) with weight `w`. /// Lock `node`'s player to the pool rows `rows` (one row per hand over the node's acts) with weight `w`.
@@ -517,6 +519,14 @@ impl Solver3 {
vals.push(self.walk(kids[k], i, picked, live, &r)); vals.push(self.walk(kids[k], i, picked, live, &r));
} }
let t = self.t as f64; let t = self.t as f64;
if let Some((wn, wh, sum, ws)) = &mut self.werte_diag {
if *wn == node && live[*wh] != 0.0 {
for k in 0..a {
sum[k] += t * vals[k][*wh];
}
*ws += t;
}
}
let mut out = vec![0.0; n]; let mut out = vec![0.0; n];
for h in 0..n { for h in 0..n {
if live[h] == 0.0 { if live[h] == 0.0 {
@@ -576,6 +586,20 @@ impl Solver3 {
self.regret[node][h * a..(h + 1) * a].iter().map(|r| r / z).collect() self.regret[node][h * a..(h + 1) * a].iter().map(|r| r / z).collect()
} }
/// Diagnosis only: watch hero's hand `hand` at root `node` (no effect on the solve).
pub fn werte_beobachten(&mut self, node: usize, hand: usize) {
let a = match &self.game.nodes[node] {
Node3::Dec { acts, .. } => acts.len(),
_ => return,
};
self.werte_diag = Some((node, hand, vec![0.0; a], 0.0));
}
/// Diagnosis only: the t-weighted mean value (chips of this street, net of its own bets) of each act of the watched hand.
pub fn werte(&self) -> Option<Vec<f64>> {
self.werte_diag.as_ref().filter(|w| w.3 > 0.0).map(|(_, _, s, z)| s.iter().map(|x| x / z).collect())
}
pub fn iterations(&self) -> u64 { pub fn iterations(&self) -> u64 {
self.t self.t
} }
+41 -4
View File
@@ -267,6 +267,9 @@ pub(crate) fn pool_sperren<'a>(
None => crate::exploit::wett_kurve::pool_fold_n(spot, strasse, ratio, allin_ab), None => crate::exploit::wett_kurve::pool_fold_n(spot, strasse, ratio, allin_ab),
Some(l) => crate::exploit::wett_kurve::pool_fold_linie_n(strasse, l, ratio, allin_ab), Some(l) => crate::exploit::wett_kurve::pool_fold_linie_n(strasse, l, ratio, allin_ab),
}; };
if crate::engine::solver_kern::stuetz_locks() {
eprintln!("STZ_LOCK mw {:?} wett_kurve {:.3} {} -", strasse, pool_w(), n.map_or("-".to_string(), |n| format!("{n:.1}")));
}
ns.extend(n.map(|n| (g.at, n))); ns.extend(n.map(|n| (g.at, n)));
} }
out.push((g.at, rows)); out.push((g.at, rows));
@@ -300,7 +303,11 @@ pub(crate) fn pool_sperren<'a>(
}; };
if let Some(rows) = rows { if let Some(rows) = rows {
if stuetz { if stuetz {
ns.extend(crate::engine::solver_kern::offen_n(strasse, pfa, before, pct).map(|n| (g.at, n))); let n = crate::engine::solver_kern::offen_n(strasse, pfa, before, pct);
if crate::engine::solver_kern::stuetz_locks() {
eprintln!("STZ_LOCK mw {:?} BETTOR {:.3} {} -", strasse, offen_w(), n.map_or("-".to_string(), |n| format!("{n:.1}")));
}
ns.extend(n.map(|n| (g.at, n)));
} }
frei.push((g.at, rows)); frei.push((g.at, rows));
} }
@@ -577,6 +584,27 @@ fn later() -> Menu3 {
Menu3 { fracs: vec![0.75], raise_mult: 3.0, max_raises: 1, allin: true } Menu3 { fracs: vec![0.75], raise_mult: 3.0, max_raises: 1, allin: true }
} }
/// Reason text of the root act values (diagnosis, `solve_*` with `werte`): `values (pots, bb): check +0.000/+0.00, bet 0.33 +0.020/+0.50`,
/// relative to the weakest act, in pots of the street's start and in big blinds.
pub(crate) fn werte_text(acts: &[Act], werte: &Option<Vec<f64>>, pot: f64, bb: f64) -> String {
let Some(v) = werte else { return String::new() };
if v.len() != acts.len() {
return String::new();
}
let lo = v.iter().cloned().fold(f64::INFINITY, f64::min);
let name = |a: &Act| match a {
Act::Check => "check".to_string(),
Act::Call => "call".to_string(),
Act::Fold => "fold".to_string(),
Act::Bet(x) => format!("bet {:.2}", x / pot.max(1e-9)),
Act::Raise(x) => format!("raise {:.2}", x / pot.max(1e-9)),
};
format!(
"; values (pots/bb): {}",
acts.iter().zip(v).map(|(a, x)| format!("{} {:+.3}/{:+.2}", name(a), (x - lo) / pot.max(1e-9), (x - lo) / bb.max(1e-9))).collect::<Vec<_>>().join(", ")
)
}
pub struct SolvedM { pub struct SolvedM {
pub row: Vec<f64>, pub row: Vec<f64>,
pub acts: Vec<Act>, pub acts: Vec<Act>,
@@ -585,6 +613,8 @@ pub struct SolvedM {
pub players: usize, pub players: usize,
pub nodes: usize, pub nodes: usize,
pub combos: Vec<usize>, pub combos: Vec<usize>,
pub werte: Option<Vec<f64>>,
pub pot: f64,
} }
/// Solve this 3- or 4-handed turn or flop (gated spot) and return hero's average strategy at its node. /// Solve this 3- or 4-handed turn or flop (gated spot) and return hero's average strategy at its node.
@@ -658,6 +688,7 @@ pub fn solve_multi3(spot: &Spot) -> Option<SolvedM> {
let combos: Vec<usize> = hands.iter().map(|h| h.masks.len()).collect(); let combos: Vec<usize> = hands.iter().map(|h| h.masks.len()).collect();
let hero_index = hands[me].masks.iter().position(|m| *m == hero_mask)?; let hero_index = hands[me].masks.iter().position(|m| *m == hero_mask)?;
let mut solver = SolverM::new(game, hands, board, spot.seed ^ 0x9e37_79b9_7f4a_7c15); let mut solver = SolverM::new(game, hands, board, spot.seed ^ 0x9e37_79b9_7f4a_7c15);
solver.werte_beobachten(at, hero_index);
if pool_w() > 0.0 || offen_w() > 0.0 { if pool_w() > 0.0 || offen_w() > 0.0 {
let masks: Vec<&[u64]> = (0..order.len()).map(|p| solver.masks(p)).collect(); let masks: Vec<&[u64]> = (0..order.len()).map(|p| solver.masks(p)).collect();
let t_sperre = std::time::Instant::now(); let t_sperre = std::time::Instant::now();
@@ -692,6 +723,9 @@ pub fn solve_multi3(spot: &Spot) -> Option<SolvedM> {
} }
} }
} }
if crate::engine::solver_kern::stuetz_locks() {
return weg("stuetzung-locks");
}
let cpu_stufe = crate::engine::frist::thread_cpu_ms(); let cpu_stufe = crate::engine::frist::thread_cpu_ms();
let mut done = 0u32; let mut done = 0u32;
let mut zu_gross = false; let mut zu_gross = false;
@@ -738,7 +772,10 @@ pub fn solve_multi3(spot: &Spot) -> Option<SolvedM> {
} }
} }
let row = solver.row(at, hero_index); let row = solver.row(at, hero_index);
return Some(SolvedM { row, acts, iterations: solver.iterations(), millis: started.elapsed().as_secs_f64() * 1e3, players: order.len(), nodes, combos }); if std::env::var("STUETZUNG_DIAG").is_ok() {
eprintln!("STZ_ROW {:?}", row.iter().map(|x| (x * 1000.0).round() / 1000.0).collect::<Vec<_>>());
}
return Some(SolvedM { row, acts, iterations: solver.iterations(), millis: started.elapsed().as_secs_f64() * 1e3, players: order.len(), nodes, combos, werte: solver.werte(), pot });
} }
weg("mw zu wenig iterationen") weg("mw zu wenig iterationen")
} }
@@ -791,8 +828,8 @@ pub fn multi3_decision(raw: &Spot) -> Option<Decision> {
legal_choice(&gated, act), legal_choice(&gated, act),
p.clamp(0.0, 1.0), p.clamp(0.0, 1.0),
format!( format!(
"solver-kern solver {street} ({} players): {:?} combos, {} nodes, {} iters, {act:?} p {p:.2}, {:.0} ms{}", "solver-kern solver {street} ({} players): {:?} combos, {} nodes, {} iters, {act:?} p {p:.2}, {:.0} ms{}{}",
s.players, s.combos, s.nodes, s.iterations, s.millis, if geformt { " | form" } else { "" } s.players, s.combos, s.nodes, s.iterations, s.millis, if geformt { " | form" } else { "" }, werte_text(&s.acts, &s.werte, s.pot, gated.big_blind)
), ),
)) ))
} }
+9 -3
View File
@@ -132,6 +132,8 @@ pub struct Solved3 {
pub players: usize, pub players: usize,
pub nodes: usize, pub nodes: usize,
pub combos: Vec<usize>, pub combos: Vec<usize>,
pub werte: Option<Vec<f64>>,
pub pot: f64,
} }
/// Solve this 3- or 4-handed river (gated spot) and return hero's average strategy at its node. /// Solve this 3- or 4-handed river (gated spot) and return hero's average strategy at its node.
@@ -193,6 +195,7 @@ pub fn solve_river3(spot: &Spot) -> Option<Solved3> {
let diag_gew: Vec<Vec<f64>> = hands.iter().map(|h| h.weights.clone()).collect(); let diag_gew: Vec<Vec<f64>> = hands.iter().map(|h| h.weights.clone()).collect();
let mut diag_locks: std::collections::HashMap<usize, (f64, f64, Option<f64>)> = std::collections::HashMap::new(); let mut diag_locks: std::collections::HashMap<usize, (f64, f64, Option<f64>)> = std::collections::HashMap::new();
let mut solver = Solver3::new(game, hands, board, spot.seed ^ 0x9e37_79b9_7f4a_7c15); let mut solver = Solver3::new(game, hands, board, spot.seed ^ 0x9e37_79b9_7f4a_7c15);
solver.werte_beobachten(at, hero_index);
let w = crate::engine::multi3_spieler::pool_w(); let w = crate::engine::multi3_spieler::pool_w();
let wo = crate::engine::multi3_spieler::offen_w(); let wo = crate::engine::multi3_spieler::offen_w();
if w > 0.0 || wo > 0.0 { if w > 0.0 || wo > 0.0 {
@@ -230,6 +233,9 @@ pub fn solve_river3(spot: &Spot) -> Option<Solved3> {
} }
} }
} }
if crate::engine::solver_kern::stuetz_locks() {
return weg("stuetzung-locks");
}
let mut done = 0u32; let mut done = 0u32;
let mut zeit_stopp = false; let mut zeit_stopp = false;
while done < ITERS { while done < ITERS {
@@ -254,7 +260,7 @@ pub fn solve_river3(spot: &Spot) -> Option<Solved3> {
eprintln!("max |regret| je Hand (sortiert) {:?}", v); eprintln!("max |regret| je Hand (sortiert) {:?}", v);
} }
let row = solver.row(at, hero_index); let row = solver.row(at, hero_index);
Some(Solved3 { row, acts, iterations: solver.iterations(), millis: started.elapsed().as_secs_f64() * 1e3, players: order.len(), nodes, combos }) Some(Solved3 { row, acts, iterations: solver.iterations(), millis: started.elapsed().as_secs_f64() * 1e3, players: order.len(), nodes, combos, werte: solver.werte(), pot })
} }
/// `STUETZUNG_DIAG` (stderr, aendert keine Entscheidung): hero's Wurzelzeile (alle Haende, nach Gewicht), je Einsatz /// `STUETZUNG_DIAG` (stderr, aendert keine Entscheidung): hero's Wurzelzeile (alle Haende, nach Gewicht), je Einsatz
@@ -403,8 +409,8 @@ pub fn river3_decision(raw: &Spot) -> Option<Decision> {
legal_choice(&gated, act), legal_choice(&gated, act),
p.clamp(0.0, 1.0), p.clamp(0.0, 1.0),
format!( format!(
"solver-kern river3 solver ({} players): {:?} combos, {} nodes, {} iters, {act:?} p {p:.2}, {:.0} ms{}", "solver-kern river3 solver ({} players): {:?} combos, {} nodes, {} iters, {act:?} p {p:.2}, {:.0} ms{}{}",
s.players, s.combos, s.nodes, s.iterations, s.millis, if geformt { " | form" } else { "" } s.players, s.combos, s.nodes, s.iterations, s.millis, if geformt { " | form" } else { "" }, crate::engine::multi3_spieler::werte_text(&s.acts, &s.werte, s.pot, gated.big_blind)
), ),
)) ))
} }
+35
View File
@@ -889,12 +889,24 @@ fn echt_range(t: &re::Tabelle, key: &re::Key, board: &[Card], hero: u64) -> Opti
thread_local! { thread_local! {
/// `STUETZUNG_DIAG`: je gelockter Gegnerknoten (Knoten, Gewicht vor und nach Hebel A, n, gelockter Fold-Anteil). /// `STUETZUNG_DIAG`: je gelockter Gegnerknoten (Knoten, Gewicht vor und nach Hebel A, n, gelockter Fold-Anteil).
static DIAG_LOCKS: std::cell::RefCell<Vec<(usize, f64, f64, Option<f64>, f64)>> = const { std::cell::RefCell::new(Vec::new()) }; static DIAG_LOCKS: std::cell::RefCell<Vec<(usize, f64, f64, Option<f64>, f64)>> = const { std::cell::RefCell::new(Vec::new()) };
/// `STUETZUNG_LOCKS`: Reach-Masse der Gegnerrange an der Wurzel (Nenner der Besuchsanteile).
static WURZEL_MASSE: std::cell::Cell<f64> = const { std::cell::Cell::new(1.0) };
}
/// `STUETZUNG_LOCKS=1` (Messung, stderr): je Gegnerknoten eine Zeile `STZ_LOCK hu <strasse> <quelle> <w_vor> <n|-> <reach-anteil>`;
/// die Loesung entfaellt (die Heuristik antwortet), nur die Knoten und ihre Stuetzung zaehlen.
pub(crate) fn stuetz_locks() -> bool {
static A: OnceLock<bool> = OnceLock::new();
*A.get_or_init(|| std::env::var("STUETZUNG_LOCKS").is_ok())
} }
/// Legt die Gegnerknoten des Baums fest; `reach` = Gewicht je Gegnerkombo bis hierher (nach den gemessenen Zeilen). /// Legt die Gegnerknoten des Baums fest; `reach` = Gewicht je Gegnerkombo bis hierher (nach den gemessenen Zeilen).
#[allow(clippy::too_many_arguments)] #[allow(clippy::too_many_arguments)]
fn lege_fest(solver: &mut TrSolver, m: &Modell, node: usize, c: [f64; 2], incoming: Option<Act>, reach: &[f64], w: f64, z: &mut Locks, linie: &str) { fn lege_fest(solver: &mut TrSolver, m: &Modell, node: usize, c: [f64; 2], incoming: Option<Act>, reach: &[f64], w: f64, z: &mut Locks, linie: &str) {
let game = solver.game.clone(); let game = solver.game.clone();
if stuetz_locks() && linie.is_empty() {
WURZEL_MASSE.with(|x| x.set(reach.iter().sum::<f64>().max(1e-12)));
}
if node == m.at { if node == m.at {
*m.reach_at.borrow_mut() = Some(reach.to_vec()); *m.reach_at.borrow_mut() = Some(reach.to_vec());
} }
@@ -971,6 +983,23 @@ fn lege_fest(solver: &mut TrSolver, m: &Modell, node: usize, c: [f64; 2], incomi
} }
g2 g2
}; };
if stuetz_locks() {
let quelle = if r.is_none() {
"frei"
} else if m.echt.is_some() {
"echt"
} else if m.auf_linie[node] {
"linie"
} else if !facing {
"BETTOR"
} else if matches!(incoming, Some(Act::Bet(_))) {
"wett_kurve"
} else {
"raise_pool"
};
let anteil = reach.iter().sum::<f64>() / WURZEL_MASSE.with(|x| x.get());
eprintln!("STZ_LOCK hu {:?} {} {:.3} {} {:.4}", m.strasse, quelle, gw_vor, n_stuetz.map_or("-".to_string(), |n| format!("{n:.1}")), anteil);
}
if let (Some(rows), true) = (&r, std::env::var("STUETZUNG_DIAG").is_ok()) { if let (Some(rows), true) = (&r, std::env::var("STUETZUNG_DIAG").is_ok()) {
let a = acts.len(); let a = acts.len();
let fi = acts.iter().position(|x| *x == Act::Fold); let fi = acts.iter().position(|x| *x == Act::Fold);
@@ -1146,6 +1175,9 @@ pub fn solve(spot: &Spot, c: &Cfg) -> Option<Geloest> {
let mut locks = Locks::default(); let mut locks = Locks::default();
DIAG_LOCKS.with(|d| d.borrow_mut().clear()); DIAG_LOCKS.with(|d| d.borrow_mut().clear());
lege_fest(&mut solver, &m, root, [0.0, 0.0], None, &villain_weights, c.w, &mut locks, ""); lege_fest(&mut solver, &m, root, [0.0, 0.0], None, &villain_weights, c.w, &mut locks, "");
if stuetz_locks() {
return None;
}
if std::env::var("SOLVER_KERN_DIAG").is_ok() { if std::env::var("SOLVER_KERN_DIAG").is_ok() {
diag(&solver, &m, hero_mask, &villain_weights); diag(&solver, &m, hero_mask, &villain_weights);
if let Some((_, voll)) = model_lists(spot) { if let Some((_, voll)) = model_lists(spot) {
@@ -1751,6 +1783,9 @@ fn solve_frueh_roh(spot: &Spot, c: &Cfg, strasse: Street) -> Option<TurnGeloest>
let m = Modell { spot, strasse, pot, stack, board, pfa, before, pct, profile: villain.profile.as_ref(), at, reach_at: Default::default(), auf_linie, w_linie: c.w_linie.unwrap_or(c.w), w_raise: c.w_raise.unwrap_or(c.w), mitglied, echt: None }; let m = Modell { spot, strasse, pot, stack, board, pfa, before, pct, profile: villain.profile.as_ref(), at, reach_at: Default::default(), auf_linie, w_linie: c.w_linie.unwrap_or(c.w), w_raise: c.w_raise.unwrap_or(c.w), mitglied, echt: None };
let mut locks = Locks::default(); let mut locks = Locks::default();
lege_fest(&mut solver, &m, root, [0.0, 0.0], None, &villain_weights, c.w, &mut locks, ""); lege_fest(&mut solver, &m, root, [0.0, 0.0], None, &villain_weights, c.w, &mut locks, "");
if stuetz_locks() {
return weg("stuetzung-locks");
}
let (iters, kappe) = if flop { (c.flop_iters, FLOP_BUDGET_MS) } else { (c.turn_iters, TURN_BUDGET_MS) }; let (iters, kappe) = if flop { (c.flop_iters, FLOP_BUDGET_MS) } else { (c.turn_iters, TURN_BUDGET_MS) };
let mut done = 0; let mut done = 0;
let cpu_iter0 = crate::engine::frist::thread_cpu_ms(); let cpu_iter0 = crate::engine::frist::thread_cpu_ms();