添加 A2C/QAC 算法实现及训练结果

- 新增 RL_Algothrithms 模块,包含 A2C、QAC 智能体
- 添加 SAC 章节笔记和 C10 笔记
- 上传训练结果图片
- 完善 README 与 .gitignore
This commit is contained in:
2026-03-18 09:07:01 +00:00
parent b13e34cc51
commit 6b8156eceb
13 changed files with 1415 additions and 47 deletions
+48 -47
View File
@@ -1,56 +1,57 @@
# 强化学习的数学基础
# RL-Study
![Python](https://img.shields.io/badge/Python-3.10%2B-blue)
![Status](https://img.shields.io/badge/Status-Learning-orange)
![License](https://img.shields.io/badge/License-MIT-green)
强化学习算法实现与学习笔记,基于赵世钰老师《Mathematical Foundations of Reinforcement Learning》。
本项目是我在学习赵世钰老师书籍 **《Mathematical Foundations of Reinforcement Learning》** 时建立的个人仓库。主要用于记录学习笔记、公式推导,以及使用 Python/Jupyter Notebook 复现书中的算法和 Grid World 示例。
## 项目结构
## 📚 关于原书 (Original Book)
```
RL-Study/
├── Lecture slides/ # 课程幻灯片
│ ├── slidesForMyLectureVideos/ # 配套视频课件
│ └── slidesContinuouslyUpdated/ # 持续更新的课件
├── Notebooks/ # Jupyter 学习笔记
│ ├── C1.ipynb ~ C10.ipynb # 各章节推导与实验
│ ├── SAC.ipynb # SAC (Soft Actor-Critic) 算法
│ └── *_training_results.png # 训练结果可视化
├── RawBook/ # 原书资源
└── RL_Algothrithms/ # 核心算法实现
├── agents/ # 智能体实现
│ ├── a2c.py # A2C (Advantage Actor-Critic)
│ └── qac.py # QAC (Soft Actor-Critic / Q-Value Actor-Critic)
├── networks.py # 神经网络定义
├── utils.py # 工具函数
└── main.py # 训练入口
```
本项目的核心内容基于赵世钰老师的开源书籍,以下是原书的相关信息:
## 已实现算法
| 算法 | 文件 | 说明 |
|------|------|------|
| A2C | [a2c.py](RL_Algothrithms/agents/a2c.py) | Advantage Actor-Critic,同步版本 |
| QAC | [qac.py](RL_Algothrithms/agents/qac.py) | Q-Value Actor-Critic,支持 GPU |
## 环境配置
```bash
pip install torch numpy matplotlib gymnasium
```
## 快速开始
```bash
cd RL_Algothrithms
python main.py --agent a2c # 训练 A2C
python main.py --agent qac # 训练 QAC
```
## 关于原书
- **书名**: Mathematical Foundations of Reinforcement Learning
- **作者**: Shiyu Zhao (Westlake University)
- **GitHub 仓库**: [Book-Mathematical-Foundation-of-Reinforcement-Learning](https://github.com/MathFoundationRL/Book-Mathematical-Foundation-of-Reinforcement-Learning)
- **配套视频**:
- [Bilibili (中文)](https://space.bilibili.com/2044042934)
- [YouTube (English)](https://youtube.com/playlist?list=PLEhdbSEZZbDaFWPX4gehhwB9vJZJ1DNm8)
- **GitHub**: [MathFoundationRL/Book-Mathematical-Foundation-of-Reinforcement-Learning](https://github.com/MathFoundationRL/Book-Mathematical-Foundation-of-Reinforcement-Learning)
- **B站**: [赵世钰老师频道](https://space.bilibili.com/2044042934)
- **YouTube**: [课程列表](https://youtube.com/playlist?list=PLEhdbSEZZbDaFWPX4gehhwB9vJZJ1DNm8)
---
## License
## 📂 项目结构
本项目主要包含以下内容:
- `Lecture slides/`: 课程相关的幻灯片。
- `Notebooks/`: 包含详细推导和实验过程的 Jupyter Notebooks。
- `RawBook/`: 原书中的相关资源和代码。
- `.gitignore`: Git 忽略文件,指定不需要提交到版本控制的文件或目录。
- `README.md`: 项目说明文档。
- `LICENSE`: 代码的开源协议说明。
## 🛠️ 环境配置
本项目使用 Python 进行开发。推荐使用 `uv``conda` 管理环境。
```bash
# 安装依赖 (示例)
pip install numpy matplotlib jupyter
```
## 📝 开源协议 (License)
### 关于代码
本项目中由本人编写的复现代码遵循 **MIT License** 开源协议。这意味着你可以自由地使用、修改和分发这些代码,但请保留原作者的版权声明。
### 关于笔记
项目中的学习笔记内容仅供个人学习交流使用。
---
## 🤝 致谢
特别感谢赵世钰老师提供的精彩教材和开源资源,帮助我们深入理解强化学习的数学原理。
MIT License(代码部分)