Skip to main content

PdcfrPlus

Struct PdcfrPlus 

Source
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

Source

pub const RECOMMENDED: PlusDiscount

Grid-searched defaults from the source paper: α = 2.3, γ = 5.

Trait Implementations§

Source§

impl UpdateRule for PdcfrPlus

Source§

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

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

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

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], )

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

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

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

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)

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

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

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§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.