Skip to main content

NfspConfig

Struct NfspConfig 

Source
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: usize

Number 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: usize

Maximum 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: usize

Number of BR train steps (one rollout + one PPO update per step) per outer iteration.

§avg_policy_train_steps_per_iteration: usize

Number 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: usize

Average-policy supervised minibatch size.

§avg_policy_lr: f64

Average-policy learning rate.

§avg_policy_min_reservoir_coverage: f32

Minimum 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: f32

Optional 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: u64

RNG seed (η-flips, reservoir eviction, AP minibatch sampling).

Trait Implementations§

Source§

impl Clone for NfspConfig

Source§

fn clone(&self) -> NfspConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for NfspConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for NfspConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more