Files
pokerfreak/src/cfr/mod.rs
T
mmintelandClaude Opus 4.8 1492fb6a38 Synthetik-Labor: Population, Zwillings-Tor, adaptive Liga, Optimizer, Sim-to-Real
Ersetzt die irrefuehrende Oracle-Leiter durch eine ehrliche Messmethodik
(Oracle aus, Read via Memory/Posterior gegen eine gezogene Gegner-Population).

Stufen:
- 0 Exploitation-Luecke: +18.98 bb/100 gegen die gezogene Population
- 1 Kalibrierung an echte HUD-Daten (lesen/kalibrierung.py)
- 2 Zwillings-Tor (EGTA + Exploitability-Waechter): Offense +43.95,
  Boden gto -36.25 (verliert gegen Balancierte - die Oracle-verdeckte Wurzel)
- 3 Adaptive Liga L0-L3 (reaktiv / modellierend / Liga)
- 4 Sim-to-Real: HUD-Gap (sim::simreal) + Outcome-Abgleich (lesen/liveabgleich.py):
  real -266.75 vs Sim +43.95 => Gap -311; A/B-Pipeline + Runbook fertig,
  nur der geldechte Live-Lauf unter beiden Armen bleibt offen
- 5 Optimizer (Diagonal-CMA-ES, parallel): Nemesis -414.81 bb/100

Befunde und Architektur in docs/notizen/. Lab-Tests gruen
(Rust lib 92/0, python liveabgleich/kalibrierung/gegnersignal gruen).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-11-11 09:57:32 +01:00

114 lines
5.2 KiB
Rust

//! Offline preflop chart derivation: counterfactual regret minimisation over a small,
//! documented preflop abstraction. Pure; the only I/O lives in `src/bin/chartgen.rs`.
//!
//! # Abstraction (every assumption)
//!
//! **Hands.** The 169 hold'em classes (`hand_class`), dealt with exact combo weights:
//! a deal is an ordered pair of disjoint combos, all equally likely, so card removal between the
//! two players is exact (`chance_table`). Other players' cards are ignored (see multiway); the
//! multi-defender games deal real combos to every player instead (`multi_walk`).
//!
//! **Equity.** `equity_matrix`: all-in preflop equity of every class against every class, from a
//! seeded Monte Carlo over disjoint combo pairs and uniformly random five-card boards, evaluated
//! with `hand::showdown::judge` (`equity_pair`). Frozen as integers in `generated_equity.rs`
//! (regenerate with `chartgen equity`). Noise: about 0.2 % per entry at 60 000 samples.
//!
//! **Games** (`push_fold_game`, `open_game`), blinds 0.5 / 1, 6-max seats `seat`:
//! - push / fold: the first actor jams the effective stack or folds; the big blind calls or folds.
//! - open / call / 3-bet: raise to a fixed size or fold; the big blind folds, calls or 3-bets to a
//! fixed size; versus the 3-bet the opener folds, calls or jams; the big blind calls or folds
//! the jam. Sizes: `spot_params`.
//!
//! **Multiway.** The shipped tables model one opponent (the small blind as first actor) or both
//! blinds (`open3_game`, `push_fold3_game`). The players behind the first actor who are not
//! modelled each hold a hand that continues with probability `WAKE_FRACTION` (the top 15 % of
//! combos by random-hand equity); if one does, the first actor is called by that range and the
//! modelled players take no decision. Those players are independent, and their cards do not
//! block the modelled hands.
//!
//! **One to four defenders** (`defenders`, `multi_tree`, `multi_walk`, `multi_solve`): the open
//! game with the last k places behind the first actor as players (k = 1..4, always ending with the
//! big blind; k = 1 is `open_game`, k = 2 `open3_game`, node for node). Same classes, sizes,
//! payoff model (`multi_shares` generalises the two- and three-way shares) and wake field for the
//! places before the first defender; new are the overcall histories, the in-position 3-bet size
//! and exact card removal between all players. Full width is out of reach (169^5 deals), so the
//! solver samples the deal and keeps every player's own class as a vector; the Gegenprobe is a
//! sampled best response, and the exact one where k <= 2. Frozen in
//! `preflop/generated_charts_multi.rs` (`chartgen multi`) together with the one-defender
//! baselines and the measured deviation from them.
//!
//! **Payoffs.** Net result in bb for the first actor, zero-sum. All-in lines use raw equity.
//! Lines that leave chips behind use `pot x realised share`: equity is stretched around 50 %
//! (the better hand realises more, `REALIZATION_SPREAD`), then the out-of-position player's side
//! counts `R` (0.85 in single-raised, 0.90 in 3-bet pots) against the in-position player's 1.0 and
//! the pot is split in proportion -- zero-sum, unlike a one-sided `pot x equity x R`.
//! The big blind is out of position against every seat but the small blind.
//!
//! **Variants.** `Environment::new(rules, equity)` is generic over the rules: any two-card game
//! whose deck rule yields the class set (`classes_in`). AOF (binary action shape) is exactly the
//! push / fold game. Short deck needs only one more run once `hand::showdown::judge` is
//! deck-aware: `chartgen equity --deck short` (equity for the 81 classes of the 36-card deck),
//! then solve the spots with that `Environment`.
//!
//! # Solver
//!
//! Full-width vectorised CFR+ (`iterate`): regrets floored at zero, alternating updates, average
//! strategy linearly weighted. One iteration is a pure fold step `(state, rng) -> (state, rng)`;
//! the generator is passed through because enumerating all deals needs no randomness.
//! `solve` records the convergence (`checkpoints`, `stable_since`), `exploitability` and
//! `deviation` implement the Nash test, `spot_solver` freezes a spot as permille tables.
pub mod chance_table;
pub mod chart_deck;
pub mod chart_signature;
pub mod defenders;
pub mod deviation;
pub mod environment;
pub mod equity_matrix;
pub mod equity_pair;
pub mod equity_run;
pub mod exploitability;
pub mod frozen_equity;
pub mod frozen_multi;
pub mod frozen_spot;
pub mod frozen_strategy;
pub mod game;
pub mod generated_equity;
pub mod generated_equity_short;
pub mod hand_class;
pub mod iterate;
pub mod kl_br;
pub mod qre;
pub mod leaf_value3;
pub mod multi_shares;
pub mod multi_solve;
pub mod multi_tree;
pub mod multi_walk;
pub mod open3_game;
pub mod open_game;
pub mod payoffs;
pub mod permille;
pub mod plo5_bucket;
pub mod push_fold3_game;
pub mod push_fold_game;
pub mod regret_matching;
pub mod render_charts;
pub mod render_equity;
pub mod river;
pub mod render_multi;
pub mod run_plan;
pub mod seat;
pub mod solve;
pub mod solver_state;
pub mod spot_params;
pub mod spot_solver;
pub mod strategy;
pub mod terminal_value;
pub mod three_way;
pub mod tree3;
pub mod tree;
pub mod turn;
pub mod value_walk;
pub mod wake_range;
pub mod walk3;