PrioritizedSweepingAgent<T>
Models & Types ยท AiDotNet.ReinforcementLearning.Agents.Planning
Prioritized Sweeping agent that focuses planning on high-priority state-actions.
Inheritance: ReinforcementLearningAgentBase<T> โ PrioritizedSweepingAgent<T>
For Beginners
Prioritized Sweeping is like Dyna-Q but smarter about which simulated updates to do. Instead of replaying random past experiences, it prioritizes updates where the biggest changes happened. Think of it like studying: focus on the topics where you got the most wrong. A priority queue tracks which state-actions need the most urgent updates, making planning much more efficient.
Example
// Create a Prioritized Sweeping agent for efficient planning
var options = new PrioritizedSweepingOptions<double> { PlanningSteps = 10, StateSize = 4, ActionSize = 2 };
var agent = new PrioritizedSweepingAgent<double>(options);
// Select an action and update priorities based on TD error
var state = new Vector<double>(new double[] { 0.5, -0.3, 1.0, 0.2 });
var action = agent.SelectAction(state);
Constructors
| Constructor | Summary |
|---|---|
PrioritizedSweepingAgent() |
Initializes a new instance with default settings. |
PrioritizedSweepingAgent(PrioritizedSweepingOptions<T> options) |
Properties
| Property | Summary |
|---|---|
int FeatureCount { get; } |
Methods
| Method | Summary |
|---|---|
Dictionary<string, T> GetMetrics() |
|
ModelMetadata<T> GetModelMetadata() |
|
T Train() |
|
Task TrainAsync() |
|
Task<Vector<T>> PredictAsync(Vector<T> input) |
|
Vector<T> Predict(Vector<T> input) |
|
Vector<T> SelectAction(Vector<T> state, bool training) |
|
byte[] Serialize() |
Auto-generated common model serialization surface. |
void Deserialize(byte[] data) |
Auto-generated common model deserialization surface. |
void LoadModel(string filepath) |
|
void ResetEpisode() |
|
void SaveModel(string filepath) |
|
void StoreExperience(Vector<T> state, Vector<T> action, T reward, Vector<T> nextState, bool done) |