# RL Utils

A simple and useful Python package providing common Reinforcement Learning utility functions.

## Installation

```bash
pip install rl-utils
```

## Features

This package provides essential utility functions for implementing Reinforcement Learning algorithms:

- **Epsilon-Greedy Action Selection**: Classic exploration-exploitation strategy
- **Q-Learning Update**: Implementation of the Q-learning algorithm update rule
- **Softmax Action Selection**: Boltzmann exploration strategy
- **Q-Table Initialization**: Helper function to initialize Q-tables

## Usage

### Epsilon-Greedy Action Selection

```python
from rl_utils import epsilon_greedy_action
import numpy as np

q_values = [0.5, 0.3, 0.8, 0.2]
action = epsilon_greedy_action(q_values, epsilon=0.1, num_actions=4)
```

### Q-Learning Update

```python
from rl_utils import q_learning_update, initialize_q_table
import numpy as np

# Initialize Q-table
q_table = initialize_q_table(num_states=10, num_actions=4)

# Update Q-value
q_table, new_q = q_learning_update(
    q_table=q_table,
    state=0,
    action=1,
    reward=10.0,
    next_state=2,
    alpha=0.1,
    gamma=0.9,
    num_actions=4
)
```

### Softmax Action Selection

```python
from rl_utils import softmax_action_selection

q_values = [0.5, 0.3, 0.8, 0.2]
action = softmax_action_selection(q_values, temperature=1.0)
```

## Requirements

- numpy >= 1.11.1

## License

MIT License

## Author

Created for RL Practicum course.

