pub struct NfspConfig {
pub max_iterations: usize,
pub anticipatory_param: f32,
pub reservoir_capacity: usize,
pub br_train_steps_per_iteration: usize,
pub avg_policy_train_steps_per_iteration: usize,
pub avg_policy_minibatch_size: usize,
pub avg_policy_lr: f64,
pub avg_policy_min_reservoir_coverage: f32,
pub br_reward_scale: f32,
pub seed: u64,
}Expand description
NFSP trainer configuration.
Fields§
§max_iterations: usizeNumber of NFSP outer-loop iterations.
anticipatory_param: f32η, the anticipatory-mixing parameter. Probability of sampling
from the best-response policy (and appending the action to the
reservoir) at each rollout step. Heinrich & Silver §3
recommend η = 0.1 for 2-player zero-sum imperfect-information
games.
reservoir_capacity: usizeMaximum reservoir buffer size (per agent in the multi-agent setting). Paper default is 2×10⁶; the matching-pennies smoke test runs with ~2000.
br_train_steps_per_iteration: usizeNumber of BR train steps (one rollout + one PPO update per step) per outer iteration.
avg_policy_train_steps_per_iteration: usizeNumber of supervised cross-entropy steps applied to the AP per outer iteration (skipped when the reservoir is empty).
This is the floor on AP steps. When
avg_policy_min_reservoir_coverage
is > 0 the trainer may run more than this many steps so the
AP sees enough of the reservoir per iteration (issue #199).
avg_policy_minibatch_size: usizeAverage-policy supervised minibatch size.
avg_policy_lr: f64Average-policy learning rate.
avg_policy_min_reservoir_coverage: f32Minimum reservoir coverage per outer iteration for the AP supervised update, expressed as a multiple of the current reservoir size (issue #199).
NFSP’s average policy is fit by sampling minibatches from a
reservoir that grows into the thousands of entries, while the
default budget of avg_policy_train_steps_per_iteration × avg_policy_minibatch_size may only touch a few hundred samples
per iteration — far too few gradient steps to fit a moving
target, so the AP loss stays pinned at the uniform-entropy floor
(ln(num_joint_actions)). On bucket-brigade this manifested as
avg_ap_loss ≈ ln(40) for an entire 48-iteration run.
When coverage > 0, the trainer runs
max(avg_policy_train_steps_per_iteration, ceil(coverage × reservoir_len / avg_policy_minibatch_size))
supervised steps for each agent each iteration, so the AP is
exposed to (in expectation) coverage full passes over the
reservoir. coverage = 0.0 disables the adaptive floor and
preserves the legacy fixed-step behavior. Default 0.0.
br_reward_scale: f32Optional reward scaling applied to per-step rewards before the BR
(PPO) update, to keep the large-magnitude bucket-brigade payoff
band ([−700, 0]) from dominating value targets and advantage
normalization (issue #199).
Rewards in the anticipatory rollout are multiplied by this factor
before being handed to the joint PPO update. 1.0 (default) is a
no-op; a value like 0.01 rescales the bucket-brigade band to
roughly [−7, 0]. Scaling rewards uniformly does not change the
optimal policy (it is an affine transform of the return), but it
does keep the critic’s regression targets and the advantage
statistics in a numerically friendlier range.
seed: u64RNG seed (η-flips, reservoir eviction, AP minibatch sampling).
Trait Implementations§
Source§impl Clone for NfspConfig
impl Clone for NfspConfig
Source§fn clone(&self) -> NfspConfig
fn clone(&self) -> NfspConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for NfspConfig
impl Debug for NfspConfig
Auto Trait Implementations§
impl Freeze for NfspConfig
impl RefUnwindSafe for NfspConfig
impl Send for NfspConfig
impl Sync for NfspConfig
impl Unpin for NfspConfig
impl UnsafeUnpin for NfspConfig
impl UnwindSafe for NfspConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more