MixedPolicy<T>
Models & Types · AiDotNet.ReinforcementLearning.Policies
Policy for environments with both discrete and continuous action spaces. Outputs both categorical distribution for discrete actions and Gaussian for continuous actions. Common in robotics where you have discrete mode selection and continuous parameter control.
Inheritance: ModelBase<T, Vector<T>, Vector<T>> → PolicyBase<T> → MixedPolicy<T>
Implements: IGeneratedParameterRegistrar<T>
Example
// Create a mixed policy for environments with both discrete and continuous actions
var discreteNet = new NeuralNetwork<double>();
var continuousNet = new NeuralNetwork<double>();
var policy = new MixedPolicy<double>(discreteNet, continuousNet,
discreteActionSize: 3, continuousActionSize: 2,
new EpsilonGreedyExploration<double>(), new GaussianNoiseExploration<double>());
Constructors
| Constructor | Summary |
|---|---|
MixedPolicy() |
Initializes a new instance of the MixedPolicy class. |
MixedPolicy(INeuralNetwork<T> discreteNetwork, INeuralNetwork<T> continuousNetwork, MixedPolicyOptions<T> options) |
Initializes a new instance of the MixedPolicy class from its options: both action sizes, both exploration strategies, feature sharing and Seed. |
MixedPolicy(INeuralNetwork<T> discreteNetwork, INeuralNetwork<T> continuousNetwork, int discreteActionSize, int continuousActionSize, IExplorationStrategy<T> discreteExploration, IExplorationStrategy<T> continuousExploration, bool sharedFeatures, Random random) |
|
MixedPolicy(MixedPolicyOptions<T> options) |
Builds the policy from options: dense ReLU networks of the options’ hidden widths from StateSize inputs, a DiscreteActionSize-logit head and a 2 × ContinuousActionSize head (means, then log standard deviations); with SharedFeatures, one… |
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 of mixed action. |
Vector<T> SelectAction(Vector<T> state, bool training) |
Selects mixed action: [discrete_action, continuous_actions] |
void Reset() |
Resets both exploration strategies. |