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
TThe 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
stateVector<T>The state observation.
actionVector<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
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
stateVector<T>The current state observation.
trainingboolWhether the agent is training (enables exploration).
Returns
- Vector<T>
The selected action vector.