AI4Finance-Foundation / ElegantRL

Massively Parallel Deep Reinforcement Learning. 🔥
https://ai4finance.org
Other
3.63k stars 834 forks source link

🐛 Fix bug PER moudle. #268

Open Yonv1943 opened 1 year ago

Yonv1943 commented 1 year ago

After updating the vectorized env and the corresponding multiprocessing training module, support for the PER algorithm has been affected.

Corresponding Pull Request: https://github.com/AI4Finance-Foundation/ElegantRL/pull/269


The related issue is as follows, PER appears nan because multiprocessing is not adapted to PER.

With multiprocessing, there are num_envs * num_workers parallel subenvironments available for a learner to learn. The way I used before, I had a PER sumTree(Binary search tree) with so many subenvironments producing trajectory at the same time, which led to bugs.

After modification, I let each subenvironment output trajectory correspond to one sumTree(Binary search tree). This solves the bug and reduces the size of each sumTree

Yonv1943 commented 1 year ago

This fix covers the following.

Agents folder.

train folder.

env folder.

example folder.

unit_test folder.

Yonv1943 commented 1 year ago

Addition: