# pendulardqn **Repository Path**: DevilcLo/pendulardqn ## Basic Information - **Project Name**: pendulardqn - **Description**: 使用深度Q网络(Deep Q Network)学习控制单摆 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2025-05-07 - **Last Updated**: 2025-05-07 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 使用深度Q网络(Deep Q Network)学习控制单摆 # C++测试代码 ```cpp #include #include "matplotlibcpp.h" #include "env.hpp" using namespace std; namespace plt = matplotlibcpp; int main(int argc, char **argv) { PendulumEnvironment env; vector state; vector ans1, ans2; int change = 30; if (argc >1) { change = atoi(argv[1]); cout << change << endl; } for (size_t i = 0; i < 300; i++) { if (i < change) env.Step(1); else env.Step(0); state = env.Get_State(); ans1.push_back(state[0]); ans2.push_back(env.Get_Reward()); } plt::plot(ans1); plt::plot(ans2); plt::show(); return 0; } ``` # 参考 [深度强化学习-DQN算法原理与代码 -CSDN博客](https://blog.csdn.net/weixin_46133643/article/details/121845874) 译文 [__init__.py的神奇用法 -知乎](https://zhuanlan.zhihu.com/p/115350758)