DeterministicPolicy<T>
Models & Types · AiDotNet.ReinforcementLearning.Policies
Deterministic policy for continuous action spaces. Directly outputs actions without sampling from a distribution. Commonly used in DDPG, TD3, and other deterministic policy gradient methods.
Inheritance: ModelBase<T, Vector<T>, Vector<T>> → PolicyBase<T> → DeterministicPolicy<T>
Implements: IGeneratedParameterRegistrar<T>
Example
// Create a deterministic policy for DDPG/TD3 continuous control
var network = new NeuralNetwork<double>();
var policy = new DeterministicPolicy<double>(network, actionSize: 2, new EpsilonGreedyExploration<double>());
// Get a deterministic action with exploration noise
var state = new Vector<double>(new double[] { 0.5, -0.3, 1.0, 0.2 });
var action = policy.SelectAction(state, training: true);
Constructors
| Constructor | Summary |
|---|---|
DeterministicPolicy() |
Initializes a new instance with default settings. |
DeterministicPolicy(DeterministicPolicyOptions<T> options) |
Builds the policy from options: a dense ReLU network of the options’ hidden widths from StateSize inputs to ActionSize outputs, explored with the options’ strategy or, when it is null, Ornstein-Uhlenbeck noise (θ = 0.15, σ = 0.2) sized to… |
DeterministicPolicy(INeuralNetwork<T> policyNetwork, DeterministicPolicyOptions<T> options) |
Initializes a new instance of the DeterministicPolicy class from its options: action size, exploration strategy, tanh squashing and Seed. |
DeterministicPolicy(INeuralNetwork<T> policyNetwork, int actionSize, IExplorationStrategy<T> explorationStrategy, bool useTanhSquashing, Random random) |
Initializes a new instance of the DeterministicPolicy class. |
Methods
| Method | Summary |
|---|---|
IReadOnlyList<INeuralNetwork<T>> GetNetworks() |
Gets the neural networks used by this policy. |
T ComputeLogProb(Vector<T> state, Vector<T> action) |
Computes log probability for a deterministic policy. |
Vector<T> SelectAction(Vector<T> state, bool training) |
Selects a deterministic action from the policy network. |
void Reset() |
Resets the exploration strategy. |