Skip to content

YuanSiping/Multi-agent-Deep-ReinforcementLearning-for-Bus-Dynamic-Holding-Control

Folders and files

NameName
Last commit message
Last commit date

Latest commit

6f21307 · May 25, 2024

History

2 Commits
May 25, 2024
May 25, 2024
May 25, 2024
May 25, 2024
May 25, 2024
May 25, 2024
May 25, 2024

Repository files navigation

安装

python 3.9

mindspore 2.2.10

用法

envs/env_wrappers.py里面实现环境仿真:Code

class Env(object):
    """
    # 环境中的智能体
    """
    def __init__(self, i):
        self.agent_num = 2  # 设置智能体(小飞机)的个数,这里设置为两个
        self.obs_dim = 14  # 设置智能体的观测纬度
        self.action_dim = 5  # 设置智能体的动作纬度,这里假定为一个五个纬度的

    def reset(self):
        """
        # self.agent_num设定为2个智能体时,返回值为一个list,每个list里面为一个shape = (self.obs_dim, )的观测数据
        """
        sub_agent_obs = []
        for i in range(self.agent_num):
            sub_obs = np.random.random(size=(14, ))
            sub_agent_obs.append(sub_obs)
        return sub_agent_obs

    def step(self, actions):
        """
        # self.agent_num设定为2个智能体时,actions的输入为一个2纬的list,每个list里面为一个shape = (self.action_dim, )的动作数据
        # 默认参数情况下,输入为一个list,里面含有两个元素,因为动作纬度为5,所里每个元素shape = (5, )
        """
        sub_agent_obs = []
        sub_agent_reward = []
        sub_agent_done = []
        sub_agent_info = []
        for i in range(self.agent_num):
            sub_agent_obs.append(np.random.random(size=(14,)))
            sub_agent_reward.append([np.random.rand()])
            sub_agent_done.append(False)
            sub_agent_info.append({})
        return [sub_agent_obs, sub_agent_reward, sub_agent_done, sub_agent_info]

介绍

主函数:train/sim_train

训练时,把runner/shared/sim_runner里的train_flag改true,测试的时候改成false。

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages