MonteCarloExploringStartsAgent<T>

Models & Types ยท AiDotNet.ReinforcementLearning.Agents.MonteCarlo

Monte Carlo Exploring Starts agent for reinforcement learning.

Inheritance: ReinforcementLearningAgentBase<T> โ†’ MonteCarloExploringStartsAgent<T>

For Beginners

Exploring Starts solves the exploration problem by guaranteeing every state-action pair has a chance of being the starting point. After the random start, the agent acts greedily (always picks the best known action). This ensures all state-action pairs are eventually tried, which is required for convergence. The downside is that random starts may not be possible in all real-world environments.

How It Works

Monte Carlo ES ensures exploration by starting each episode from a randomly chosen state-action pair, then following the greedy policy thereafter.

Example

// Create a Monte Carlo Exploring Starts agent
var options = new MonteCarloExploringStartsOptions<double> { StateSize = 4, ActionSize = 2 };
var agent = new MonteCarloExploringStartsAgent<double>(options);
            
// Select an action (random on first step, greedy thereafter)
var state = new Vector<double>(new double[] { 0.5, -0.3, 1.0, 0.2 });
var action = agent.SelectAction(state);

Constructors

Constructor Summary
MonteCarloExploringStartsAgent() Initializes a new instance with default settings.
MonteCarloExploringStartsAgent(MonteCarloExploringStartsOptions<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)