Metadata-Version: 2.4
Name: reinforcements
Version: 0.5.0
Summary: A Complete, Source-Accessible Reinforcement Learning Exam Kit and Lab Implementation Toolkit
Author: Arvind Nandigam
License-Expression: MIT
Project-URL: Homepage, https://github.com/arvindnandigam/reinforcements
Project-URL: Documentation, https://github.com/arvindnandigam/reinforcements#readme
Project-URL: Repository, https://github.com/arvindnandigam/reinforcements.git
Keywords: reinforcement-learning,rl,q-learning,sarsa,dqn,policy-gradient,reinforce,actor-critic,ppo,value-iteration,policy-iteration,monte-carlo,exam-preparation,educational
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Education
Classifier: Intended Audience :: Science/Research
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Education
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.22.0
Provides-Extra: notebooks
Requires-Dist: jupyter>=1.0.0; extra == "notebooks"
Requires-Dist: ipykernel>=6.0.0; extra == "notebooks"
Provides-Extra: torch
Requires-Dist: torch>=2.0.0; extra == "torch"
Provides-Extra: plots
Requires-Dist: matplotlib>=3.5.0; extra == "plots"
Provides-Extra: gymnasium
Requires-Dist: gymnasium[classic-control]>=1.0.0; extra == "gymnasium"
Provides-Extra: test
Requires-Dist: pytest>=7.0.0; extra == "test"
Provides-Extra: all
Requires-Dist: jupyter>=1.0.0; extra == "all"
Requires-Dist: ipykernel>=6.0.0; extra == "all"
Requires-Dist: torch>=2.0.0; extra == "all"
Requires-Dist: matplotlib>=3.5.0; extra == "all"
Requires-Dist: gymnasium[classic-control]>=1.0.0; extra == "all"
Requires-Dist: pytest>=7.0.0; extra == "all"
Dynamic: license-file

# `reinforcements`

**A Complete, Source-Accessible Reinforcement Learning Exam Kit and Lab Implementation Toolkit**

[![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Labs: 12/12](https://img.shields.io/badge/Labs-12%20Complete-brightgreen.svg)]()
[![Exam Ready](https://img.shields.io/badge/FAT%20Exam-Ready-red.svg)]()

`reinforcements` is designed specifically for students, researchers, and engineers preparing for **Reinforcement Learning laboratory examinations (FAT)**, viva-voce tests, and practical coursework.

It turns 12 classic and modern RL laboratory experiments into a clean, pip-installable Python package where **all algorithms, environments, underlying mathematical formulas, and complete source code** are instantly inspectable through `help()`, `show_theory()`, and `show_source()`.

---

## 🚀 Key Highlights

1. **One-Line Installation**: Standard `pip install .` or `pip install reinforcements`.
2. **12 Labs at Your Fingertips**: Call `reinforcements.lab_01()` through `reinforcements.lab_12()` directly.
3. **Deep Theory & Mathematical Formulae**: Every single lab docstring and helper function contains complete Bellman equations, update rules, and convergence guarantees.
4. **Instant Source Code Retrieval**: Retrieve full orchestration code or any function/class via `reinforcements.show_source("DroneEnv")`.
5. **Exam & Viva Survival Kit**: Bundled viva Q&As, cheat sheets, algorithm comparison matrices, and a 5-hour FAT exam crash plan.
6. **13 Bundled Jupyter Notebooks**: Export all 12 individual lab notebooks + 1 master notebook directly to your computer with `reinforcements.export_all("./my_rl_kit")`.
7. **Zero Required Heavy Dependencies**: Core package runs on **pure NumPy**. PyTorch and Matplotlib are optional extras with seamless fallbacks.

---

## 📦 Installation

```bash
# Core package (NumPy only; package commands and standalone labs work offline after install)
pip install reinforcements

# Optional features
pip install "reinforcements[notebooks]"
pip install "reinforcements[torch,plots]"
pip install "reinforcements[all]"
```

---

## ⚡ Quick Start

```python
import reinforcements as rl

# 1. Run any lab
result = rl.lab_01()
print(result.summary())
result.plot()

# 2. Retrieve theory, math formulae, and viva questions
rl.show_theory(5)      # Comprehensive guide for Lab 5 (Q-Learning)
rl.show_formulae(5)    # Bellman optimality update equations
rl.show_viva(7)        # Top FAT exam viva questions for DQN

# 3. Retrieve or inspect source code directly
rl.show_source(5)          # Shows full Python source of Lab 5
rl.show_source("DroneEnv") # Shows class definition of DroneEnv
src = rl.get_source(7)     # Returns raw source string for editing

# 4. Export all notebooks and exam notes to a local folder
rl.export_all("./rl_exam_prep")
```

---

## 📚 Laboratory Curriculum (All 12 Labs)

| Lab | Algorithm | Paradigm | Environment | Function |
|:---:|:---|:---|:---|:---:|
| **01** | $\epsilon$-Greedy Bandit | Multi-Armed Bandit | 5-Arm Ad CTR | `rl.lab_01()` |
| **02** | Value Iteration | Dynamic Programming | 4x4 GridWorld | `rl.lab_02()` |
| **03** | Policy Iteration vs. Value Iteration | Dynamic Programming | 500-state Taxi | `rl.lab_03()` |
| **04** | First-Visit Monte Carlo | Model-Free MC | 1D Random Walk | `rl.lab_04()` |
| **05** | Q-Learning | Off-Policy TD Control | 5x5 Drone Delivery | `rl.lab_05()` |
| **06** | SARSA | On-Policy TD Control | Traffic Signal Queues | `rl.lab_06()` |
| **07** | Deep Q-Networks (DQN) | Value-Based Deep RL | Classic CartPole | `rl.lab_07()` |
| **08** | TD-Gammon Self-Play Demo | TD(0) Approximation | 1-Ply Search Tree | `rl.lab_08()` |
| **09** | REINFORCE with Baseline | Policy Gradient | CartPole Continuous | `rl.lab_09()` |
| **10** | Tabular Actor-Critic | Actor-Critic | 5-Floor Elevator | `rl.lab_10()` |
| **11** | Advantage Actor-Critic (A2C) | Advantage Actor-Critic | Autonomous Vehicle Speed | `rl.lab_11()` |
| **12** | Proximal Policy Optimization (PPO) | Clipped Surrogate Deep RL | CartPole with GAE | `rl.lab_12()` |

---

## 🎓 Exam Revision & Viva Features

### Python `help()` Built-in Inspection
Every lab function docstring is packed with complete theoretical derivations, equations, step-by-step algorithms, and viva Q&As:
```python
help(rl.lab_05)
```

### Dedicated Exam API
```python
# Full theory breakdown
rl.show_theory(1)

# Just the mathematical formulas
rl.show_formulae(12)

# Common viva voce questions & model answers
rl.show_viva(7)
```

### Exportable Study Notes (`rl.export_notes()`)
Exports 5 dedicated markdown guides:
- `algorithm_cheat_sheet.md`: Equations and updates for all 12 algorithms.
- `viva_questions.md`: Over 20 common viva exam questions and answers.
- `comparison_tables.md`: MC vs TD, Q-Learning vs SARSA, On-policy vs Off-policy.
- `five_hour_crash_plan.md`: Hour-by-hour study plan before a FAT exam.
- `practical_report_template.md`: Ready-to-use lab report format.

---

## 🛠️ Command-Line Interface (CLI)

The package provides a built-in CLI tool:

```bash
# List all 12 labs
reinforcements list

# Run a specific lab or all labs
reinforcements run 5
reinforcements run all

# Display theory and viva for a lab
reinforcements theory 2
reinforcements formulae 6
reinforcements viva 7

# From a Jupyter cell, insert real cells after the command cell
!reinforcements import lab_01

# From a terminal, replace or append cells in a notebook file
reinforcements import lab_01 --notebook ./my_notebook.ipynb
reinforcements import lab_01 --notebook ./my_notebook.ipynb --append

# Inspect source code from terminal
reinforcements source lab_05
reinforcements source DroneEnv

# Export notebooks and notes
reinforcements export ./my_revision_kit
```

Each exported `lab01`–`lab12` notebook contains a standalone implementation
of its BCSE432E assignment using Python and NumPy, without importing this package.

---

## 📄 License

MIT License. Copyright (c) 2026 Arvind Nandigam.
