Marl-Neon-Grid


NameMarl-Neon-Grid JSON
Version 0.1.4.5 PyPI version JSON
download
home_pagehttps://github.com/romue404/marl-neon-grid
SummaryA collection of MARL gridworlds to study coordination and cooperation.
upload_time2023-09-01 12:52:09
maintainer
docs_urlNone
authorRobert Müller
requires_python
licenseMIT
keywords artificial intelligence pytorch multiagent reinforcement learning simulation
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 🦩🌴 MARL-Neon-Grid

A collection of multi-agent reinforcement learning gridworlds to study coordination and cooperation that follows the 
[Gymnasium](https://github.com/Farama-Foundation/Gymnasium) interface. 
All agents are equipped with a 360 degree sensor to obtain a partial view of the world. 
We use [ray casting](https://en.wikipedia.org/wiki/Ray_casting) and [bresenham's algorithm](https://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm) to determine what the agents see.

## Setup
Simply run:
```pip install marl-neon-grid```

## Example
```py
from marl_neon_grid import FoodNAgents

n_agents = 2
gw = FoodNAgents(n_agents=n_agents, n_food=8, max_steps=128, agents_must_coordinate=False)

for t in range(100):  # simulate 100 episodes
    observations = gw.reset()
    dones = [False] * n_agents
    while not all(dones):
        gw.render()  # render with pygame
                                             # perform random actions
        observations, rewards, dones, info = gw.step([gw.action_space.sample(), 
                                                      gw.action_space.sample()])  
        # observations, rewards, dones are lists where each entry i belongs to agent i.


```

## Environments
The following environments are available.
### Closed Rooms
![Examples](examples/closed_rooms.png) 

In each episode, goal fields on the left or the right of the upper room are randomly chosen.
The goal for the upper agent is to navigate to one of these fields while the lower agent must navigate to 
the opposite side in the lower room. However, the agent in the lower room does not see the goal fields in its observation
while the upper agent does. Reward is given to both agents as long as they both stay on their respective goal fields.

### Doors n' Agents
![Examples](examples/doors_n_agents.png)

Two agents are randomly placed in the environment in each episode. The environment terminates successfully when both doors
are opened by the agents simultaneously.

### Food n' Agents
![Examples](examples/food_n_agents.png)

I each episode a prespecified number of agents (`n_agents=...`) and number of foods (`n_food=8`) are randomly placed in the environment.
Agents receive reward for collecting food. When `agents_must_coordinate` is set to `True`, all agents must gather around a food source
and simultaneously perform the "collect food" action to obtain reward. Otherwise agents are able to collect food individually.
The environment terminates successfully when all foods are collected.

#### 🚧 More environments are under construction ...

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/romue404/marl-neon-grid",
    "name": "Marl-Neon-Grid",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "artificial intelligence,pytorch,multiagent reinforcement learning,simulation",
    "author": "Robert M\u00fcller",
    "author_email": "robert.mueller1990@googlemail.com",
    "download_url": "https://files.pythonhosted.org/packages/a6/da/7836a01668331ead6d25d9b66413f016ef2f6472708d3e85e269e53efcd5/Marl-Neon-Grid-0.1.4.5.tar.gz",
    "platform": null,
    "description": "# \ud83e\udda9\ud83c\udf34 MARL-Neon-Grid\n\nA collection of multi-agent reinforcement learning gridworlds to study coordination and cooperation that follows the \n[Gymnasium](https://github.com/Farama-Foundation/Gymnasium) interface. \nAll agents are equipped with a 360 degree sensor to obtain a partial view of the world. \nWe use [ray casting](https://en.wikipedia.org/wiki/Ray_casting) and [bresenham's algorithm](https://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm) to determine what the agents see.\n\n## Setup\nSimply run:\n```pip install marl-neon-grid```\n\n## Example\n```py\nfrom marl_neon_grid import FoodNAgents\n\nn_agents = 2\ngw = FoodNAgents(n_agents=n_agents, n_food=8, max_steps=128, agents_must_coordinate=False)\n\nfor t in range(100):  # simulate 100 episodes\n    observations = gw.reset()\n    dones = [False] * n_agents\n    while not all(dones):\n        gw.render()  # render with pygame\n                                             # perform random actions\n        observations, rewards, dones, info = gw.step([gw.action_space.sample(), \n                                                      gw.action_space.sample()])  \n        # observations, rewards, dones are lists where each entry i belongs to agent i.\n\n\n```\n\n## Environments\nThe following environments are available.\n### Closed Rooms\n![Examples](examples/closed_rooms.png) \n\nIn each episode, goal fields on the left or the right of the upper room are randomly chosen.\nThe goal for the upper agent is to navigate to one of these fields while the lower agent must navigate to \nthe opposite side in the lower room. However, the agent in the lower room does not see the goal fields in its observation\nwhile the upper agent does. Reward is given to both agents as long as they both stay on their respective goal fields.\n\n### Doors n' Agents\n![Examples](examples/doors_n_agents.png)\n\nTwo agents are randomly placed in the environment in each episode. The environment terminates successfully when both doors\nare opened by the agents simultaneously.\n\n### Food n' Agents\n![Examples](examples/food_n_agents.png)\n\nI each episode a prespecified number of agents (`n_agents=...`) and number of foods (`n_food=8`) are randomly placed in the environment.\nAgents receive reward for collecting food. When `agents_must_coordinate` is set to `True`, all agents must gather around a food source\nand simultaneously perform the \"collect food\" action to obtain reward. Otherwise agents are able to collect food individually.\nThe environment terminates successfully when all foods are collected.\n\n#### \ud83d\udea7 More environments are under construction ...\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A collection of MARL gridworlds to study coordination and cooperation.",
    "version": "0.1.4.5",
    "project_urls": {
        "Homepage": "https://github.com/romue404/marl-neon-grid"
    },
    "split_keywords": [
        "artificial intelligence",
        "pytorch",
        "multiagent reinforcement learning",
        "simulation"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0c7014fde377eb87fd636f49d1dda0ef7232f5b373386cdc01bd3ec9958539d1",
                "md5": "cc9af145c3dab62b89694005982fd2b5",
                "sha256": "d06b086e9a4fc5d6edb215652d870f133d89d48bc1c7c16295e4d1b0f4d95b8b"
            },
            "downloads": -1,
            "filename": "Marl_Neon_Grid-0.1.4.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "cc9af145c3dab62b89694005982fd2b5",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 195831,
            "upload_time": "2023-09-01T12:52:07",
            "upload_time_iso_8601": "2023-09-01T12:52:07.266609Z",
            "url": "https://files.pythonhosted.org/packages/0c/70/14fde377eb87fd636f49d1dda0ef7232f5b373386cdc01bd3ec9958539d1/Marl_Neon_Grid-0.1.4.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a6da7836a01668331ead6d25d9b66413f016ef2f6472708d3e85e269e53efcd5",
                "md5": "8a95d73d6f0a25883753caff1321cb64",
                "sha256": "327c8693b0c685848cd59c4f488c69c2708fc3844bfe4a5fea8088574554b239"
            },
            "downloads": -1,
            "filename": "Marl-Neon-Grid-0.1.4.5.tar.gz",
            "has_sig": false,
            "md5_digest": "8a95d73d6f0a25883753caff1321cb64",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 225598,
            "upload_time": "2023-09-01T12:52:09",
            "upload_time_iso_8601": "2023-09-01T12:52:09.235526Z",
            "url": "https://files.pythonhosted.org/packages/a6/da/7836a01668331ead6d25d9b66413f016ef2f6472708d3e85e269e53efcd5/Marl-Neon-Grid-0.1.4.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-09-01 12:52:09",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "romue404",
    "github_project": "marl-neon-grid",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "marl-neon-grid"
}
        
Elapsed time: 0.26938s