This project demonstrates and compares three reinforcement learning agents โ Dynamic Programming (DP), Monte Carlo (MC), and Temporal Difference (TD) โ applied to a custom Maze environment. The agents learn policies to maximize undiscounted rewards and are evaluated using metrics like MSE and convergence plots.
- Solve a grid-based Maze using value iteration (Dynamic Programming), Monte Carlo learning, and Temporal Difference learning
- Compare learned policies and value functions to a DP baseline
- Evaluate agent performance in terms of:
- Total rewards
- Value function error (MSE)
- Learning convergence across multiple runs
This project demonstrates the application of Reinforcement Learning in a discrete environment:
- The Maze is a grid where each cell represents a state
- The agent can move in discrete directions (up, down, left, right), representing discrete actions
- Rewards are collected by reaching certain cells
- Policies map states (cells) to actions (movements) to maximize reward
This setup provides an intuitive and visualizable environment for studying RL algorithms and their learning behavior in structured, discrete domains.
- Computes the optimal policy using full knowledge of the environment
- Serves as a ground truth baseline
- On-policy agent using learning rate decay
- Evaluates returns at the end of each episode
- Supports multiple replicas for convergence analysis
- On-policy TD(0) method
- Learns from incomplete episodes
- Uses decaying learning rate for stability
The project generates several plots to help understand agent performance and learning dynamics.
For each agent (DP, MC, TD), the learned policy and value function are visualized as heatmaps or directional fields.
Learning progress for MC and TD agents with respect to the amount of episodes.
| Metric | Description |
|---|---|
| Total Reward | Accumulated reward across episodes |
| MSE | Error of estimated value function vs DP baseline |
| Convergence | Stability of episode rewards over multiple runs |
Plots are automatically generated and displayed using matplotlib.





