Comments (4)
Hi, I found out why, it is because of the handler, because I clone the source code and tried to make some changes and forgot that the default from the base
file is central handler. So maybe we can close this issue for now.
from mobile-env.
It seems like the problem with the function reset
in mobile_env/wrappers/multi_agent.py
? It is really strange cause it works if I run the following :
import gymnasium
from ray.tune.registry import register_env
# use the mobile-env RLlib wrapper for RLlib
def register(config):
# importing mobile_env registers the included environments
import mobile_env
from mobile_env.wrappers.multi_agent import RLlibMAWrapper
env = gymnasium.make("mobile-small-ma-v0")
return RLlibMAWrapper(env)
# register the predefined scenario with RLlib
register_env("mobile-small-ma-v0", register)
import ray
# init ray with available CPUs (and GPUs) and init ray
ray.init(
num_cpus=5, # change to your available number of CPUs
include_dashboard=False,
ignore_reinit_error=True,
log_to_driver=False,
)
import ray.air
from ray.rllib.algorithms.ppo import PPOConfig
from ray.rllib.policy.policy import PolicySpec
from ray.tune.stopper import MaximumIterationStopper
# Create an RLlib config using multi-agent PPO on mobile-env's small scenario.
config = (
PPOConfig()
.environment(env="mobile-small-ma-v0")
# Here, we configure all agents to share the same policy.
.multi_agent(
policies={'shared_policy': PolicySpec()},
policy_mapping_fn=lambda agent_id, episode, worker, **kwargs: 'shared_policy',
)
# RLlib needs +1 CPU than configured below (for the driver/traininer?)
.resources(num_cpus_per_worker=4)
.rollouts(num_rollout_workers=1)
)
# Create the Trainer/Tuner and define how long to train
tuner = ray.tune.Tuner(
"PPO",
run_config=ray.air.RunConfig(
# Save the training progress and checkpoints locally under the specified subfolder.
storage_path="./CTDE_1m",
# Control training length by setting the number of iterations. 1 iter = 4000 time steps by default.
stop=MaximumIterationStopper(max_iter=1),
checkpoint_config=ray.air.CheckpointConfig(checkpoint_at_end=True),
),
param_space=config,
)
# Run training and save the result
result_grid = tuner.fit()
which I did not overwrite anything just use the default env.
from mobile-env.
I think the issue is in how you register and pass your custom Env to RLlib.
I'm also always a bit unsure how to do that. As a reference, here is how the pre-defined scenarios are registered: https://github.com/stefanbschneider/mobile-env/blob/main/mobile_env/scenarios/registry.py
You shouldn't use the same name for your new custom env as one of the existing env names (eg, "mobile-small-ma-v0").
from mobile-env.
@stefanbschneider :
Thanks for replying, I actually tried to use a different name. It still show me the same problem.
from ray.tune.registry import register_env
# use the mobile-env RLlib wrapper for RLlib
def register(config):
# importing mobile_env registers the included environments
from mobile_env.wrappers.multi_agent import RLlibMAWrapper
env = Env1(config={"seed": 68},render_mode="rgb_array")
return RLlibMAWrapper(env)
# register the predefined scenario with RLlib
register_env("TEST1", register)
This is really strange. I am still testing it. Since as I mentioned in the other issue. I assigned one agent to each BS. And that works when I register my custom Env. So I do not know why this happen.
Thanks for replying.
from mobile-env.
Related Issues (16)
- Collect and write metrics for evaluation HOT 8
- Thank you & Using NS3 or OMNeT++? HOT 3
- Allocate Physical Cell Identifier (PCI) to BS HOT 4
- Can this implement ue to ue connection? HOT 1
- Feature Request: migrate from gym to gymnasium HOT 4
- Link mobile-env paper
- Refactor environment to wrappers for multi-agent and central setting
- Update to stable-baselines3 v2.0+ HOT 2
- Add separate Ray RLlib example HOT 2
- Update readme from Gym to Gymnasium HOT 1
- Action space definition HOT 7
- RLlib resource error in demo notebook HOT 15
- How to specify custom SINR calculation HOT 11
- Limit mobile-env to single-cell selection HOT 8
- env.load() halts HOT 1
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 mobile-env.