pub struct PdcfrPlus;Expand description
Predictive Discounted CFR+. Stores regret like DCFR+ (discounted, floored)
but forms the strategy like PCFR+ (regret plus prediction) — additionally
discounting the regret term by d(t, α) inside the prediction. The widest
shape: predictive (3 lanes) and discounted.
Implementations§
Source§impl PdcfrPlus
impl PdcfrPlus
Sourcepub const RECOMMENDED: PlusDiscount
pub const RECOMMENDED: PlusDiscount
Grid-searched defaults from the source paper: α = 2.3, γ = 5.
Trait Implementations§
Source§impl UpdateRule for PdcfrPlus
impl UpdateRule for PdcfrPlus
Source§const LANES: usize = 3
const LANES: usize = 3
Number of per-row state lanes: 2 for non-predictive rules (regret,
cumulative strategy), 3 for predictive ones (plus last-instantaneous
regret in lane 2).
Source§type Params = PlusDiscount
type Params = PlusDiscount
Per-instance parameters (e.g. discount exponents). Held per matcher, never
global, so two matchers of the same rule with different parameters
coexist.
Source§type Step = PdcfrPlusStep
type Step = PdcfrPlusStep
Constants derived once per iteration from
(params, t) and shared across
all rows of a batch. This is where the expensive powf/division results
live so they are computed once, not once per row.Source§fn step(p: &Self::Params, t: usize) -> Self::Step
fn step(p: &Self::Params, t: usize) -> Self::Step
Compute the shared per-iteration constants for iteration
t (1-based).Source§fn strategy_from_lanes(
_: &Self::Params,
regret: &[f32],
last: &[f32],
d: f32,
out: &mut [f32],
)
fn strategy_from_lanes( _: &Self::Params, regret: &[f32], last: &[f32], d: f32, out: &mut [f32], )
Write the strategy a row plays given its stored lanes, normalized to a
distribution.
regret_discount is the precomputed factor a predictive
rule applies to its regret before adding the prediction in last_inst;
non-predictive rules ignore both. Re-deriving the strategy from the lanes
— rather than storing it — lets the matcher drop a whole per-row array at
no precision cost, and is how a batched matcher reproduces a scalar
matcher’s carried strategy exactly.Source§fn pre_discount(s: &Self::Step) -> f32
fn pre_discount(s: &Self::Step) -> f32
Regret discount for deriving the pre-update strategy of an iteration
(the strategy carried in from the previous step).
0.0 for
non-predictive rules, which ignore it.Source§fn post_discount(s: &Self::Step) -> f32
fn post_discount(s: &Self::Step) -> f32
Regret discount for deriving the post-update strategy of an iteration
(the strategy this step will play and accumulate).
0.0 for
non-predictive rules.Source§fn accumulate_regret(
s: &Self::Step,
old: f32,
reward: f32,
expected: f32,
) -> f32
fn accumulate_regret( s: &Self::Step, old: f32, reward: f32, expected: f32, ) -> f32
New cumulative regret for one action from its old value, this action’s
reward, and the strategy’s expected value. The instantaneous regret
is reward − expected; rules take the two terms separately rather than
pre-combined so each can reproduce its scalar counterpart’s exact
floating-point expression (the associativity of … + reward − expected
is load-bearing for bit-for-bit equivalence).Source§fn strategy_accumulation(s: &Self::Step) -> (f32, f32)
fn strategy_accumulation(s: &Self::Step) -> (f32, f32)
How the cumulative-strategy lane advances:
X ← X · discount + weight · x
for the returned (discount, weight). This single shape covers
discounted accumulation ((d, 1)) and increasing-weight accumulation
((1, t) or (1, t²)) alike.Source§fn regret_weight_step(s: &Self::Step, old_w: f32) -> f32
fn regret_weight_step(s: &Self::Step, old_w: f32) -> f32
Advance the shared regret-weight accumulator. Discounted rules mirror the
regret discount here (
W ← W · d + 1); closed-form rules may treat it as
a plain counter, since UpdateRule::regret_weight_total ignores it.Source§fn regret_weight_total(_: &Self::Params, _t: usize, accum_w: f32) -> f32
fn regret_weight_total(_: &Self::Params, _t: usize, accum_w: f32) -> f32
The total regret weight after
t updates — the denominator that turns
accumulated regret into a true time average for the convergence
diagnostic. Discounted rules return the accumulated accum_w;
closed-form rules return a function of t (e.g. t(t+1)/2).Auto Trait Implementations§
impl Freeze for PdcfrPlus
impl RefUnwindSafe for PdcfrPlus
impl Send for PdcfrPlus
impl Sync for PdcfrPlus
impl Unpin for PdcfrPlus
impl UnsafeUnpin for PdcfrPlus
impl UnwindSafe for PdcfrPlus
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more