Skip to content

Commit

Permalink
amend
Browse files Browse the repository at this point in the history
  • Loading branch information
matteobettini committed Jun 10, 2024
1 parent f113546 commit 397b322
Show file tree
Hide file tree
Showing 40 changed files with 78 additions and 58 deletions.
1 change: 0 additions & 1 deletion benchmarl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
def _load_hydra_schemas():
from hydra.core.config_store import ConfigStore

import benchmarl.environments
from benchmarl.algorithms import algorithm_config_registry
from benchmarl.environments import _task_class_registry
from benchmarl.experiment import ExperimentConfig
Expand Down
2 changes: 1 addition & 1 deletion benchmarl/conf/task/pettingzoo/multiwalker.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
defaults:
- _self_
- pettingzoo_multiwalker_config
- _self_

task: "multiwalker_v9"
# number of bipedal walker agents in environment
Expand Down
3 changes: 2 additions & 1 deletion benchmarl/conf/task/pettingzoo/simple_adversary.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
defaults:
- _self_
- pettingzoo_simple_adversary_config
- _self_


task: "simple_adversary_v3"
N: 2
Expand Down
3 changes: 2 additions & 1 deletion benchmarl/conf/task/pettingzoo/simple_crypto.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
defaults:
- _self_
- pettingzoo_simple_crypto_config
- _self_


task: "simple_crypto_v3"
max_cycles: 100
3 changes: 2 additions & 1 deletion benchmarl/conf/task/pettingzoo/simple_push.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
defaults:
- pettingzoo_simple_push_config
- _self_
- pettingzoo_simple_push_config


task: "simple_push_v3"
max_cycles: 100
3 changes: 2 additions & 1 deletion benchmarl/conf/task/pettingzoo/simple_reference.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
defaults:
- _self_
- pettingzoo_simple_reference_config
- _self_


task: "simple_reference_v3"
max_cycles: 100
Expand Down
3 changes: 2 additions & 1 deletion benchmarl/conf/task/pettingzoo/simple_speaker_listener.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
defaults:
- _self_
- pettingzoo_simple_speaker_listener_config
- _self_


task: "simple_speaker_listener_v4"
max_cycles: 100
3 changes: 2 additions & 1 deletion benchmarl/conf/task/pettingzoo/simple_spread.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
defaults:
- _self_
- pettingzoo_simple_spread_config
- _self_


task: "simple_spread_v3"
max_cycles: 100
Expand Down
3 changes: 2 additions & 1 deletion benchmarl/conf/task/pettingzoo/simple_tag.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
defaults:
- _self_
- pettingzoo_simple_tag_config
- _self_


task: "simple_tag_v3"
num_good: 2
Expand Down
3 changes: 2 additions & 1 deletion benchmarl/conf/task/pettingzoo/simple_world_comm.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
defaults:
- _self_
- pettingzoo_simple_world_comm_config
- _self_


task: "simple_world_comm_v3"
num_good: 2
Expand Down
3 changes: 2 additions & 1 deletion benchmarl/conf/task/pettingzoo/waterworld.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
defaults:
- _self_
- pettingzoo_waterworld_config
- _self_


task: "waterworld_v4"
max_cycles: 500
Expand Down
3 changes: 1 addition & 2 deletions benchmarl/conf/task/vmas/balance.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
defaults:
- _self_
- vmas_balance_config

- _self_

max_steps: 100
n_agents: 4
Expand Down
2 changes: 1 addition & 1 deletion benchmarl/conf/task/vmas/ball_passage.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
defaults:
- _self_
- vmas_ball_passage_config
- _self_

max_steps: 500
n_passages: 1
Expand Down
3 changes: 2 additions & 1 deletion benchmarl/conf/task/vmas/ball_trajectory.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
defaults:
- _self_
- vmas_ball_trajectory_config
- _self_


max_steps: 100
joints: True
3 changes: 2 additions & 1 deletion benchmarl/conf/task/vmas/buzz_wire.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
defaults:
- _self_
- vmas_buzz_wire_config
- _self_


max_steps: 100
random_start_angle: True
Expand Down
3 changes: 2 additions & 1 deletion benchmarl/conf/task/vmas/discovery.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
defaults:
- _self_
- vmas_discovery_config
- _self_


max_steps: 100
n_agents: 5
Expand Down
3 changes: 2 additions & 1 deletion benchmarl/conf/task/vmas/dispersion.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
defaults:
- _self_
- vmas_dispersion_config
- _self_



max_steps: 100
Expand Down
3 changes: 2 additions & 1 deletion benchmarl/conf/task/vmas/dropout.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
defaults:
- _self_
- vmas_dropout_config
- _self_



max_steps: 100
Expand Down
3 changes: 2 additions & 1 deletion benchmarl/conf/task/vmas/flocking.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
defaults:
- _self_
- vmas_flocking_config
- _self_


max_steps: 100
n_agents: 4
Expand Down
3 changes: 2 additions & 1 deletion benchmarl/conf/task/vmas/give_way.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
defaults:
- _self_
- vmas_give_way_config
- _self_


max_steps: 100
mirror_passage: False
Expand Down
3 changes: 2 additions & 1 deletion benchmarl/conf/task/vmas/joint_passage.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
defaults:
- _self_
- vmas_joint_passage_config
- _self_


max_steps: 500
n_passages: 1
Expand Down
3 changes: 2 additions & 1 deletion benchmarl/conf/task/vmas/joint_passage_size.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
defaults:
- _self_
- vmas_joint_passage_size_config
- _self_


max_steps: 500
n_passages: 3
Expand Down
3 changes: 2 additions & 1 deletion benchmarl/conf/task/vmas/multi_give_way.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
defaults:
- _self_
- vmas_multi_give_way_config
- _self_


max_steps: 200
agent_collision_penalty: -0.1
3 changes: 2 additions & 1 deletion benchmarl/conf/task/vmas/navigation.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
defaults:
- _self_
- vmas_navigation_config
- _self_



max_steps: 100
Expand Down
3 changes: 2 additions & 1 deletion benchmarl/conf/task/vmas/passage.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
defaults:
- _self_
- vmas_passage_config
- _self_


max_steps: 500
n_passages: 1
Expand Down
3 changes: 2 additions & 1 deletion benchmarl/conf/task/vmas/reverse_transport.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
defaults:
- _self_
- vmas_reverse_transport_config
- _self_


max_steps: 100
n_agents: 4
Expand Down
3 changes: 2 additions & 1 deletion benchmarl/conf/task/vmas/sampling.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
defaults:
- _self_
- vmas_sampling_config
- _self_



max_steps: 100
Expand Down
3 changes: 2 additions & 1 deletion benchmarl/conf/task/vmas/simple_adversary.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
defaults:
- _self_
- vmas_simple_adversary_config
- _self_


max_steps: 100
n_agents: 3
Expand Down
3 changes: 2 additions & 1 deletion benchmarl/conf/task/vmas/simple_crypto.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
defaults:
- _self_
- vmas_simple_crypto_config
- _self_


max_steps: 100
dim_c: 4
3 changes: 2 additions & 1 deletion benchmarl/conf/task/vmas/simple_push.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
defaults:
- _self_
- vmas_simple_push_config
- _self_


max_steps: 100
3 changes: 2 additions & 1 deletion benchmarl/conf/task/vmas/simple_reference.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
defaults:
- _self_
- vmas_simple_reference_config
- _self_


max_steps: 100
3 changes: 2 additions & 1 deletion benchmarl/conf/task/vmas/simple_speaker_listener.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
defaults:
- _self_
- vmas_simple_speaker_listener_config
- _self_


max_steps: 100
3 changes: 2 additions & 1 deletion benchmarl/conf/task/vmas/simple_spread.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
defaults:
- _self_
- vmas_simple_spread_config
- _self_


max_steps: 100
n_agents: 3
Expand Down
3 changes: 2 additions & 1 deletion benchmarl/conf/task/vmas/simple_tag.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
defaults:
- _self_
- vmas_simple_tag_config
- _self_


max_steps: 100
num_good_agents: 1
Expand Down
3 changes: 2 additions & 1 deletion benchmarl/conf/task/vmas/simple_world_comm.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
defaults:
- _self_
- vmas_simple_world_comm_config
- _self_


max_steps: 100
num_good_agents: 2
Expand Down
3 changes: 2 additions & 1 deletion benchmarl/conf/task/vmas/transport.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
defaults:
- _self_
- vmas_transport_config
- _self_



max_steps: 100
Expand Down
3 changes: 2 additions & 1 deletion benchmarl/conf/task/vmas/wheel.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
defaults:
- _self_
- vmas_wheel_config
- _self_


max_steps: 100
n_agents: 4
Expand Down
3 changes: 2 additions & 1 deletion benchmarl/conf/task/vmas/wind_flocking.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
defaults:
- _self_
- vmas_wind_flocking_config
- _self_


max_steps: 100
horizon: 100
Expand Down
24 changes: 6 additions & 18 deletions benchmarl/environments/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
from __future__ import annotations

import importlib
import os
import os.path as osp

import warnings
from enum import Enum
from pathlib import Path
Expand Down Expand Up @@ -41,23 +40,12 @@ def _type_check_task_config(


def _get_task_config_class(environemnt_name: str, task_name: str):
if not task_name.endswith(".py"):
task_name += ".py"

pathname = None
for dirpath, _, filenames in os.walk(
Path(osp.dirname(__file__)) / environemnt_name
):
if task_name in filenames:
pathname = os.path.join(dirpath, task_name)
break

if pathname is not None:
spec = importlib.util.spec_from_file_location("", pathname)
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)
try:
module = importlib.import_module(
f"{'.'.join(__name__.split('.')[:-1])}.{environemnt_name}.{task_name}"
)
return module.TaskConfig
else:
except ModuleNotFoundError:
return None


Expand Down
2 changes: 1 addition & 1 deletion examples/extending/task/conf/task/customenv/task_1.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
defaults:
- _self_
- customenv_task_1_config
- _self_

n_borks: 3
win_on_dork: True

0 comments on commit 397b322

Please sign in to comment.