Table of Contents

Interface IPolicy<T>

Namespace
AiDotNet.ReinforcementLearning.Policies
Assembly
AiDotNet.dll

Core interface for RL policies - defines how to select actions.

public interface IPolicy<T> : IDisposable

Type Parameters

T

The numeric type used for calculations.

Inherited Members

Methods

ComputeLogProb(Vector<T>, Vector<T>)

Computes the log probability of a given action in a given state. Used by policy gradient methods (PPO, A2C, etc.).

T ComputeLogProb(Vector<T> state, Vector<T> action)

Parameters

state Vector<T>

The state observation.

action Vector<T>

The action taken.

Returns

T

The log probability of the action.

GetNetworks()

Gets the neural networks used by this policy.

IReadOnlyList<INeuralNetwork<T>> GetNetworks()

Returns

IReadOnlyList<INeuralNetwork<T>>

Reset()

Resets any internal state (e.g., for recurrent policies, exploration noise).

void Reset()

SelectAction(Vector<T>, bool)

Selects an action given the current state.

Vector<T> SelectAction(Vector<T> state, bool training = true)

Parameters

state Vector<T>

The current state observation.

training bool

Whether the agent is training (enables exploration).

Returns

Vector<T>

The selected action vector.