Skip to content

Commit

Permalink
Update docs from Gym to Gymnasium (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanbschneider committed May 20, 2023
1 parent b0eab32 commit a87339c
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 14 deletions.
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@

# mobile-env: An Open Environment for Autonomous Coordination in Mobile Networks

mobile-env is an open, minimalist OpenAI Gym environment for training and evaluating coordination algorithms in wireless mobile networks.
mobile-env is an open, minimalist environment for training and evaluating coordination algorithms in wireless mobile networks.
The environment allows modeling users moving around an area and can connect to one or multiple base stations.
Using the Gym interface, the environment can be used with any reinforcement learning framework (e.g., stable-baselines or Ray RLlib) or any custom (even non-RL) coordination approach.
Using the [Gymnasium](https://gymnasium.farama.org/) ([previously Gym](https://www.gymlibrary.dev/)) interface,
the environment can be used with any reinforcement learning framework (e.g., stable-baselines or Ray RLlib) or any custom (even non-RL) coordination approach.
The environment is highly configurable and can be easily extended (e.g., regarding users, movement patterns, channel models, etc.).

mobile-env supports multi-agent and centralized reinforcement learning policies. It provides various choices for rewards and observations. mobile-env is also easily extendable, so that anyone may add another channel models (e.g. path loss), movement patterns, utility functions, etc.
Expand Down Expand Up @@ -78,10 +79,10 @@ For dependencies for building docs, install the requirements in `docs`.
## Example Usage

```python
import gymnasium as gym
import gymnasium
import mobile_env

env = gym.make("mobile-medium-central-v0")
env = gymnasium.make("mobile-medium-central-v0")
obs, info = env.reset()
done = False

Expand All @@ -98,7 +99,7 @@ mobile-env supports custom channel models, movement patterns, arrival & departur
For example, replacing the default [Okumura–Hata](https://en.wikipedia.org/wiki/Hata_model) channel model by a (simplified) path loss model can be as easy as this:

```python
import gymnasium as gym
import gymnasium
import numpy as np
from mobile_env.core.base import MComCore
from mobile_env.core.channel import Channel
Expand All @@ -125,7 +126,7 @@ config['channel'] = PathLoss
config['channel_params'].update({'gamma': 2.0})

# create environment with custom channel model
env = gym.make('mobile-small-central-v0', config=config)
env = gymnasium.make('mobile-small-central-v0', config=config)
# ...
```

Expand Down
10 changes: 5 additions & 5 deletions docs/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@ We provide an in-depth example of mobile-env's usage on Google Colab! The notebo
[![Open in colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/stefanbschneider/mobile-env/blob/master/examples/demo.ipynb)

## Environment Creation
`mobile-env` follows the OpenAI Gym interface.
`mobile-env` follows the [Gymnasium interface](https://gymnasium.farama.org/).
Here is an example of how mobile-env's environments can be created:
```python
import gymnasium as gym
import gymnasium
import mobile_env

# small environment; centralized control
env = gym.make('mobile-small-central-v0')
env = gymnasium.make('mobile-small-central-v0')

# large environment; centralized control
env = gym.make('mobile-large-central-v0')
env = gymnasium.make('mobile-large-central-v0')

# small environment; multi-agent control
env = gym.make('mobile-large-ma-v0')
env = gymnasium.make('mobile-large-ma-v0')
...

# then run the environment
Expand Down
20 changes: 19 additions & 1 deletion examples/demo.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,15 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {
"pycharm": {
"name": "#%% md\n"
}
},
"source": [
"`mobile_env` comes with a set of predefined scenarios, registered as Gym environments, that can be used out of the box for quick experimentation."
"`mobile_env` comes with a set of predefined scenarios, registered as Gymnasium environments, that can be used out of the box for quick experimentation."
]
},
{
Expand Down Expand Up @@ -139,6 +140,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {
"pycharm": {
Expand Down Expand Up @@ -202,6 +204,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {
"pycharm": {
Expand Down Expand Up @@ -378,6 +381,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {
"pycharm": {
Expand Down Expand Up @@ -482,6 +486,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand Down Expand Up @@ -668,6 +673,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand Down Expand Up @@ -800,6 +806,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand Down Expand Up @@ -840,6 +847,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand Down Expand Up @@ -905,6 +913,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand Down Expand Up @@ -1025,6 +1034,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand Down Expand Up @@ -1133,6 +1143,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand Down Expand Up @@ -1217,6 +1228,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {
"pycharm": {
Expand Down Expand Up @@ -1329,6 +1341,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {
"pycharm": {
Expand Down Expand Up @@ -1387,6 +1400,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand Down Expand Up @@ -1523,6 +1537,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand Down Expand Up @@ -1737,6 +1752,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand Down Expand Up @@ -1783,6 +1799,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand Down Expand Up @@ -1841,6 +1858,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand Down
2 changes: 1 addition & 1 deletion examples/test.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
],
"source": [
"# apply random action to environment to run one step\n",
"# note the changed step() API with gym v26+: https://gymnasium.farama.org/content/migration-guide/\n",
"# note the changed step() API with gym v26+/gymnasium: https://gymnasium.farama.org/content/migration-guide/\n",
"obs, reward, terminated, truncated, info = env.step(random_action)\n",
"obs, reward, terminated, truncated, info"
]
Expand Down
2 changes: 1 addition & 1 deletion mobile_env/handlers/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@


class Handler:
"""Defines Gym interface methods called by core simulation."""
"""Defines Gymnasium interface methods called by core simulation."""

@classmethod
@abc.abstractmethod
Expand Down

0 comments on commit a87339c

Please sign in to comment.