Table of Contents

Class ExplorationStrategyBase<T>

Namespace
AiDotNet.ReinforcementLearning.Policies.Exploration
Assembly
AiDotNet.dll

Abstract base class for exploration strategy implementations. Provides common functionality for noise generation and action clamping.

public abstract class ExplorationStrategyBase<T> : IExplorationStrategy<T>

Type Parameters

T

The numeric type used for calculations.

Inheritance
ExplorationStrategyBase<T>
Implements
Derived
Inherited Members

Fields

NumOps

Numeric operations helper for type-agnostic calculations.

protected static readonly INumericOperations<T> NumOps

Field Value

INumericOperations<T>

Methods

BoxMullerSample(Random)

Generates a standard normal random sample using the Box-Muller transform.

protected T BoxMullerSample(Random random)

Parameters

random Random

Random number generator.

Returns

T

A sample from the standard normal distribution N(0, 1).

ClampAction(Vector<T>, double, double)

Clamps all elements of an action vector to a specified range. Compatible with net462 (does not use Math.Clamp).

protected Vector<T> ClampAction(Vector<T> action, double min = -1, double max = 1)

Parameters

action Vector<T>

The action vector to clamp.

min double

The minimum value (default: -1.0).

max double

The maximum value (default: 1.0).

Returns

Vector<T>

A new vector with clamped values.

GetExplorationAction(Vector<T>, Vector<T>, int, Random)

Modifies or replaces the policy's action for exploration.

public abstract Vector<T> GetExplorationAction(Vector<T> state, Vector<T> policyAction, int actionSpaceSize, Random random)

Parameters

state Vector<T>

The current state.

policyAction Vector<T>

The action suggested by the policy.

actionSpaceSize int

The number of possible actions.

random Random

Random number generator for stochastic exploration.

Returns

Vector<T>

The action to take after applying exploration.

Reset()

Resets internal state (e.g., for new episodes or training sessions).

public virtual void Reset()

Update()

Updates internal parameters (e.g., epsilon decay, noise reduction). Called after each training step.

public abstract void Update()

ValidateActionSize(int, int, string)

Validates that an action vector has the expected size.

protected void ValidateActionSize(int expected, int actual, string paramName)

Parameters

expected int

The expected action size.

actual int

The actual action size.

paramName string

The parameter name for error reporting.

Exceptions

ArgumentException

Thrown when action size doesn't match expected size.