Examples¶
Example on Google Colab¶
We provide an in-depth example of mobile-env’s usage on Google Colab! The notebook shows how to train multi-agent reinforcement learning policies with RLlib and centralized control policies with stable-baselines3.
Environment Creation¶
mobile-env
follows the OpenAI Gym interface.
Here is an example of how mobile-env’s environments can be created:
import gymnasium as gym
import mobile_env
# small environment; centralized control
env = gym.make('mobile-small-central-v0')
# large environment; centralized control
env = gym.make('mobile-large-central-v0')
# small environment; multi-agent control
env = gym.make('mobile-large-ma-v0')
...
# then run the environment
obs, info = env.reset()
done = False
while not done:
action = ... # Your agent code here
obs, reward, terminated, truncated, info = env.step(action)
done = terminated or truncated
env.render()