• Stars
    star
    189
  • Rank 204,649 (Top 5 %)
  • Language
    Python
  • Created over 3 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Lightweight version of MAPPO to help you quickly migrate to your local environment.

light_mappo

Lightweight version of MAPPO to help you quickly migrate to your local environment.

Table of Contents

Background

The original MAPPO code was too complex in terms of environment encapsulation, so this project directly extracts and encapsulates the environment. This makes it easier to transfer the MAPPO code to your own project.

Installation

Simply download the code, create a Conda environment, and then run the code, adding packages as needed. Specific packages will be added later.

Usage

import numpy as np
class EnvCore(object):
    """
    # Environment Agent
    """
    def __init__(self):
        self.agent_num = 2 # set the number of agents(aircrafts), here set to two
        self.obs_dim = 14 # set the observation dimension of agents
        self.action_dim = 5 # set the action dimension of agents, here set to a five-dimensional

    def reset(self):
        """
        # When self.agent_num is set to 2 agents, the return value is a list, and each list contains observation data of 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):
        """
        # When self.agent_num is set to 2 agents, the input of actions is a two-dimensional list, and each list contains action data of shape = (self.action_dim,).
        # By default, the input is a list containing two elements, because the action dimension is 5, so each element has a shape of (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]

Just write this part of the code, and you can seamlessly connect with MAPPO. After env_core.py, two files, env_discrete.py and env_continuous.py, were separately extracted to encapsulate the action space and discrete action space. In elif self.continuous_action: in algorithms/utils/act.py, this judgment logic is also used to handle continuous action spaces. The # TODO here in runner/shared/env_runner.py is also used to handle continuous action spaces.

In the train.py file, choose to comment out continuous environment or discrete environment to switch the demo environment.

Related Efforts

  • on-policy - 💌 Learn the author implementation of MAPPO.

Maintainers

@tinyzqh.

Translator

@tianyu-z

License

MIT © tinyzqh

More Repositories

1

awesome-reinforcement-learning

Learning Resources And Links Of Reinforcement Learning (updating)
Python
178
star
2

code-of-csdn

csdn上面的一些相关代码
Python
107
star
3

Opencv-Computer-Vision-Practice-Python-

Opencv 计算机视觉实战
Python
101
star
4

awesome-Robot-Operating-Syetem

Learning Resources And Links Of Robot Operating System(updating)
63
star
5

control-of-jump-systems-based-on-reinforcement-learning

Code for the paper “Control Strategy of Speed Servo Systems Based on Deep Reinforcement Learning”
Python
16
star
6

GPTStore

轻松构建自定义GPT助手,GPTStore。
Python
14
star
7

Algorithms_Note

算法工程师技术栈学习笔记
Jupyter Notebook
14
star
8

Resource-Of-Wechate

个人公众微信号上的资源
Python
6
star
9

Erlang-planning-network

Implementation of the paper "Erlang planning network: An iterative model-based reinforcement learning with multi-perspective".
Python
6
star
10

Demo-Of-Few-Shot-Learning

some basic demo of few-shot learning
Python
4
star
11

XuanJing

XuanJing is a benchmark library of decision algorithms for reinforcement learning, imitation learning, multi-agent learning and planning algorithms.
Python
3
star
12

IELTS_100_Sentence

100局句子记完雅思7000个雅思单词
3
star
13

face_recognition

人脸识别示例代码
Python
3
star
14

torch_optimizer_visualizations

Visualize PyTorch's Optimizers.
Python
1
star
15

Theorem_In_RL_And_Game

Video Material of Reinforcement Learning and Algorithm Game Theory in Bilibili.
1
star
16

Cross-entropy-method-Series

Implementing various cross-entropy methods
Python
1
star
17

code-of-reinforcement-learning

强化学习算法实现
Python
1
star
18

circuit-sat

The un-official implementation of ICLR 2019 paper: Learning To Solve Circuit-SAT: An Unsupervised Differentiable Approach.
Python
1
star
19

Computer_room_reservation_system

C++机房预约系统
C++
1
star
20

AINews

1
star
21

Course-notes

Here are some notes I took during my own deep learning, machine learning sessions
1
star