agi-brain / xuance

XuanCe: A Comprehensive and Unified Deep Reinforcement Learning Library
https://xuance.readthedocs.io/
MIT License
605 stars 100 forks source link

Custmize multi-agent environment #28

Open shswdmx1 opened 6 months ago

shswdmx1 commented 6 months ago

在new_env_mas.py文件中,self.state_space = Box(low=0, high=1, shape=[self.dim_state, ], dtype=np.float32, seed=self.seed)这句代码是定义智能体的状态空间。但是这样的话每个智能体的观测就都是一样的对吧。假如我现在有两个智能体,观测是给定的两列数据,也就是每个智能体的观测都对应一列数据,那这样的话每个智能体的观测范围就是不一致的。比如: obs_space1 = Box(low=self.data1.min(), high=self.data1.max(), shape=(self.dim_obs,), dtype=np.float32, seed=self.seed) obs_space2 = Box(low=self.data2.min(), high=self.data2.max(), shape=(self.dim_obs,), dtype=np.float32, seed=self.seed) 那请问这样的智能体该如何在new_env_mas.py文件中定义观测空间呢?

wenzhangliu commented 6 months ago

目前new_env_mas.py里给出的针对同质智能体(所有智能体的各种属性都一样)的示例。但是你提到的情况应该没有影响,只要每个智能体的obs_shape一样,在外部应该是不区分取值范围的。如果你需要在外部访问每个智能体的观测范围,不妨在这个文件中新增self.obs_space1,self.obs_space2这样的成员变量。

shswdmx1 commented 6 months ago

屏幕截图 2024-03-14 151610 为啥tensorborad这些图并没有展示出来呢?

wenzhangliu commented 6 months ago

貌似是因为纵坐标显示范围太大