python - 了解 OpenAI 健身房和稳定基线中的多智能体学习
问题描述
如本文所述,我正在尝试使用 OpenAI 稳定基线和健身房开发多智能体强化学习模型。
我对我们如何指定对手代理感到困惑。似乎对手被传递到环境中,agent2
如下所示:
class ConnectFourGym:
def __init__(self, agent2="random"):
ks_env = make("connectx", debug=True)
self.env = ks_env.train([None, agent2])
该ks_env.train()
方法似乎来自kaggle_environments.Environment
:
def train(self, agents=[]):
"""
Setup a lightweight training environment for a single agent.
Note: This is designed to be a lightweight starting point which can
be integrated with other frameworks (i.e. gym, stable-baselines).
The reward returned by the "step" function here is a diff between the
current and the previous step.
Example:
env = make("tictactoe")
# Training agent in first position (player 1) against the default random agent.
trainer = env.train([None, "random"])
Q1。然而我很困惑。为什么ConnectFourGym.__init__()
调用train()
方法?那就是为什么环境应该做培训?我觉得,train()
应该是模型的一部分:上面的文章使用了包含train()
方法的 PPO 算法。PPO.train()
当我们调用时,它会被调用PPO.learn()
,这是有道理的。
Q2。但是,阅读PPO.learn()
的代码,我看不出它是如何训练当前代理对抗多个对手代理的。模型算法不应该这样做吗?读错了吗?或者模型不知道代理的数量,它只是环境已知,这就是为什么环境包含train()
?在那种情况下,为什么我们有明确的Environment.train()
方法?环境将根据多个代理行为返回奖励,模型将从中学习。
还是完全搞砸了基本概念?somoene 能帮帮我吗?
解决方案
推荐阅读
- mysql - 如何使用一个公共列连接两个表,同时维护 mySQL 中其他列的值?
- mongodb - 如何从 mongodb 中获取年龄组数据
- html - 创建具有自定义列大小的html表
- ios - 如何将数据从一个模型传递到另一个模型?
- javascript - 使用类为元素应用样式的 withStyles 错误
- python - 多进程环境中的 cx_Oracle python delete 语句
- python - 从三个文本中计算单词
- reactjs - find 仅返回日期的第一个数据
- java - springboot中的调度器,用于spring批处理的大数据交替
- algorithm - 您如何计算具有多个来源的 Djikstra 热图?