This repository contains a Python script that simulates the performance of the epsilon-greedy reinforcement learning algorithm on a multi-armed bandit problem. The simulation is designed to demonstrate the trade-off between exploration and exploitation in decision-making, showcasing how different epsilon values (the probability of exploration) impact the agent's cumulative reward over time.
![Epsilon-Greedy Performance Plot]: 
A multi-armed bandit is a classic problem in reinforcement learning. Imagine you're in a casino, faced with several slot machines (one-armed bandits), each with an unknown probability distribution of rewards. Your goal is to maximize your total winnings over a series of pulls. The challenge is to figure out which machine is best (exploitation) while also trying out other machines to ensure you haven't missed an even better one (exploration).
The epsilon-greedy strategy is a simple yet effective approach to solving the multi-armed bandit problem. At each step, the agent:
-
Explores (with probability
$\epsilon$ ): Randomly chooses an arm to pull. -
Exploits (with probability 1 -
$\epsilon$ ): Chooses the arm with the highest estimated average reward so far.
This simulation compares three different epsilon values: 0 (pure greedy, always exploiting), 0.01 (small exploration), and 0.1 (moderate exploration).
The main script is organized into three parts:
run_epsilon_greedy_simulationfunction: Encapsulates the core simulation logic. It runs multiple bandit tasks for a given set of epsilon values and records the rewards.plot_resultsfunction: Handles the visualization of the simulation results, generating a line plot showing average rewards over steps for each epsilon strategy.- Main Execution Block (
if __name__ == "__main__":): Defines simulation parameters, calls the simulation function, and then plots the outcomes.