Comments (3)
I've run into the same problem and now I'm halfway through. It is possible to introduce a custom environment by doing the following steps:
-
You have to manually wrap your gym-like environment with
MultiAgentEnv
. You can refer to any other existing env under pathenvs/base_env/xxx.py
. Aside from the standardreset
,step
,close
method, you have to implement a method calledget_env_info
to return information like obs_space, action_space, etc. Also, the env class needs to include two memberself.num_agents
andself.agents
. A globalpolicy_mapping_dict
should also be created and exposed, this will affect how Ray manage all those policies. -
You have to define a default env config file under
envs/base_env/config
, it should be something like:env: your_env env_args: map_name: "default" # other options any_other_config_needed_by_your_env: ... mask_flag: True global_state_flag: True opp_action_in_cc: False
-
Register your env in
envs/base_env/__init__.py
:try: from envs.base_env.your_env import CustomEnv ENV_REGISTRY["your_env"] = CustomEnv except Exception as e: ENV_REGISTRY["your_env"] = str(e)
-
[Optional] You can customize algorithm configuration that fit your environment by putting it under
marl/algos/hyperparams/finetuned/your_env
-
Run your custom env by
python marl/main.py --algo_config=mappo [--finetuned] --env_config=your_env [with env_args.map_name=custom]
By doing these steps above, I've successfully registered a Carla Environment to MARLlib. However, I said I was halfway through because the training is no good. I can't find a document explaining the exact meaning of "state", "obs" in observation space, and all the other configurations. It would be great to have complete documentation about customization.
from marllib.
Guys, have a quick glance of our new api design and instance of customize new environments.
from marllib.
Thank you very much!
from marllib.
Related Issues (20)
- Access Value Function After algo.Fit HOT 2
- Discrete action space switching continuous action space problem in custom environment HOT 1
- How ma_policy works? and How I can use it?
- "MulBackward0 returned nan values" error when launch HATRPO after HAPPO
- How MARLlib works with ray algorithms like PPO? HOT 1
- Update to newest RLlib version? HOT 5
- Doing Counterfactual Experience Replay HOT 9
- JointQ not work in custom env HOT 1
- Trouble implementing custom environment HOT 3
- Episodes_this_iter parameter
- Supporting Individual Action Spaces
- How to export trained model as a .pt (pytorch ) or ONNX model. HOT 2
- How do I get an agent's position in the environment in the `postprocess_trajectory` method? HOT 1
- IQL setup for Custom Env
- Can the qmix algorithm solve the AirCombat problem and does Marllib support it?
- Training agents with IQL HOT 3
- Query Regarding num_workers Setting Resulting in Multiple Concurrent Environments During Training
- Inferencing the learned Policies HOT 2
- Inter-agent communication before compute_actions HOT 1
- How to set up exploration strategies for Agents?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from marllib.