8000 Gymnasium integration by LukasSchaefer · Pull Request #72 · uoe-agents/epymarl · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Gymnasium integration #72

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
247 changes: 149 additions & 98 deletions README.md

Large diffs are not rendered by default.

10 changes: 6 additions & 4 deletions env_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
lbforaging
rware
git+https://github.com/semitable/multiagent-particle-envs.git
git+https://github.com/uoe-agents/matrix-games.git
# lbforaging
# rware
pettingzoo
# git+https://github.com/uoe-agents/matrix-games.git
pysc2==3.0.0
s2clientprotocol==4.10.1.75800.0
git+https://github.com/oxwhirl/smac.git
git+https://github.com/oxwhirl/smacv2.git
# git+https://github.com/uoe-agents/smaclite.git
13 changes: 9 additions & 4 deletions plot_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,14 @@ def extract_alg_name_from_config(config):


def extract_env_name_from_config(config):
if "map" in config["env_args"]:
env_name = config["env_args"]["map"]
env = config["env"]
if "map_name" in config["env_args"]:
env_name = config["env_args"]["map_name"]
elif "key" in config["env_args"]:
env_name = config["env_args"]["key"]
else:
env_name = None
return env_name
return f"{env}_{env_name}"


def load_results(path, metric):
Expand All @@ -100,7 +101,11 @@ def load_results(path, metric):
for file in metrics_files:
# load json
with open(file, "r") as f:
metrics = json.load(f)
try:
metrics = json.load(f)
except json.JSONDecodeError:
warnings.warn(f"Could not load metrics from {file} --> skipping")
continue

# find corresponding config file
config_file = file.parent / "config.json"
Expand Down
5 changes: 3 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
absl-py
attrs
click
gym==0.21.0
gymnasium
idna==2.7
imageio
matplotlib
Expand All @@ -16,11 +16,12 @@ protobuf
py==1.6.0
pygame
pyparsing==2.2.2
pytest==4.3.1
pytest
python-dateutil==2.7.3
PyYAML==5.3.1
requests==2.19.1
sacred
seaborn
scipy
six==1.11.0
sk-video==1.1.10
Expand Down
13 changes: 13 additions & 0 deletions src/config/envs/sc2v2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
env: "sc2v2"

env_args:
map_name: null
time_limit: 150

test_greedy: True
test_nepisode: 100
test_interval: 50000
log_interval: 50000
runner_log_interval: 10000
learner_log_interval: 10000
t_max: 2050000
13 changes: 13 additions & 0 deletions src/config/envs/smaclite.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
env: "smaclite"

env_args:
map_name: null
time_limit: 150

test_greedy: True
test_nepisode: 100
test_interval: 50000
log_interval: 50000
runner_log_interval: 10000
learner_log_interval: 10000
t_max: 2050000
67 changes: 67 additions & 0 deletions src/config/envs/smacv2_configs/protoss_10_vs_10.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
env: sc2wrapped

env_args:
continuing_episode: False
difficulty: "7"
game_version: null
map_name: "10gen_protoss"
move_amount: 2
obs_all_health: True
obs_instead_of_state: False
obs_last_action: False
obs_own_health: True
obs_pathing_grid: False
obs_terrain_height: False
obs_timestep_number: False
reward_death_value: 10
reward_defeat: 0
reward_negative_scale: 0.5
reward_only_positive: True
reward_scale: True
reward_scale_rate: 20
reward_sparse: False
reward_win: 200
replay_dir: ""
replay_prefix: ""
conic_fov: False
use_unit_ranges: True
min_attack_range: 2
obs_own_pos: True
num_fov_actions: 12
capability_config:
n_units: 10
n_enemies: 10
team_gen:
dist_type: "weighted_teams"
unit_types:
- "stalker"
- "zealot"
- "colossus"
weights:
- 0.45
- 0.45
- 0.1
observe: True
start_positions:
dist_type: "surrounded_and_reflect"
p: 0.5
map_x: 32
map_y: 32

# enemy_mask:
# dist_type: "mask"
# mask_probability: 0.5
# n_enemies: 5
state_last_action: True
state_timestep_number: False
step_mul: 8
heuristic_ai: False
# heuristic_rest: False
debug: False

test_nepisode: 32
test_interval: 10000
log_interval: 2000
runner_log_interval: 2000
learner_log_interval: 2000
t_max: 10050000
67 changes: 67 additions & 0 deletions src/config/envs/smacv2_configs/protoss_10_vs_11.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
env: sc2wrapped

env_args:
continuing_episode: False
difficulty: "7"
game_version: null
map_name: "10gen_protoss"
move_amount: 2
obs_all_health: True
obs_instead_of_state: False
obs_last_action: False
obs_own_health: True
obs_pathing_grid: False
obs_terrain_height: False
obs_timestep_number: False
reward_death_value: 10
reward_defeat: 0
reward_negative_scale: 0.5
reward_only_positive: True
reward_scale: True
reward_scale_rate: 20
reward_sparse: False
reward_win: 200
replay_dir: ""
replay_prefix: ""
conic_fov: False
use_unit_ranges: True
min_attack_range: 2
obs_own_pos: True
num_fov_actions: 12
capability_config:
n_units: 10
n_enemies: 11
team_gen:
dist_type: "weighted_teams"
unit_types:
- "stalker"
- "zealot"
- "colossus"
weights:
- 0.45
- 0.45
- 0.1
observe: True
start_positions:
dist_type: "surrounded_and_reflect"
p: 0.5
map_x: 32
map_y: 32

# enemy_mask:
# dist_type: "mask"
# mask_probability: 0.5
# n_enemies: 5
state_last_action: True
state_timestep_number: False
step_mul: 8
heuristic_ai: False
# heuristic_rest: False
debug: False

test_nepisode: 32
test_interval: 10000
log_interval: 2000
runner_log_interval: 2000
learner_log_interval: 2000
t_max: 10050000
67 changes: 67 additions & 0 deletions src/config/envs/smacv2_configs/protoss_20_vs_20.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
env: sc2wrapped

env_args:
continuing_episode: False
difficulty: "7"
game_version: null
map_name: "10gen_protoss"
move_amount: 2
obs_all_health: True
obs_instead_of_state: False
obs_last_action: False
obs_own_health: True
obs_pathing_grid: False
obs_terrain_height: False
obs_timestep_number: False
reward_death_value: 10
reward_defeat: 0
reward_negative_scale: 0.5
reward_only_positive: True
reward_scale: True
reward_scale_rate: 20
reward_sparse: False
reward_win: 200
replay_dir: ""
replay_prefix: ""
conic_fov: False
use_unit_ranges: True
min_attack_range: 2
obs_own_pos: True
num_fov_actions: 12
capability_config:
n_units: 20
n_enemies: 20
team_gen:
dist_type: "weighted_teams"
unit_types:
- "stalker"
- "zealot"
- "colossus"
weights:
- 0.45
- 0.45
- 0.1
observe: True
start_positions:
dist_type: "surrounded_and_reflect"
p: 0.5
map_x: 32
map_y: 32

# enemy_mask:
# dist_type: "mask"
# mask_probability: 0.5
# n_enemies: 5
state_last_action: True
state_timestep_number: False
step_mul: 8
heuristic_ai: False
# heuristic_rest: False
debug: False

test_nepisode: 32
test_interval: 10000
log_interval: 2000
runner_log_interval: 2000
learner_log_interval: 2000
t_max: 10050000
67 changes: 67 additions & 0 deletions src/config/envs/smacv2_configs/protoss_20_vs_23.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
env: sc2wrapped

env_args:
continuing_episode: False
difficulty: "7"
game_version: null
map_name: "10gen_protoss"
move_amount: 2
obs_all_health: True
obs_instead_of_state: False
obs_last_action: False
obs_own_health: True
obs_pathing_grid: False
obs_terrain_height: False
obs_timestep_number: False
reward_death_value: 10
reward_defeat: 0
reward_negative_scale: 0.5
reward_only_positive: True
reward_scale: True
reward_scale_rate: 20
reward_sparse: False
reward_win: 200
replay_dir: ""
replay_prefix: ""
conic_fov: False
use_unit_ranges: True
min_attack_range: 2
obs_own_pos: True
num_fov_actions: 12
capability_config:
n_units: 20
n_enemies: 23
team_gen:
dist_type: "weighted_teams"
unit_types:
- "stalker"
- "zealot"
- "colossus"
weights:
- 0.45
- 0.45
- 0.1
observe: True
start_positions:
dist_type: "surrounded_and_reflect"
p: 0.5
map_x: 32
map_y: 32

# enemy_mask:
# dist_type: "mask"
# mask_probability: 0.5
# n_enemies: 5
state_last_action: True
state_timestep_number: False
step_mul: 8
heuristic_ai: False
# heuristic_rest: False
debug: False

test_nepisode: 32
test_interval: 10000
log_interval: 2000
runner_log_interval: 2000
learner_log_interval: 2000
t_max: 10050000
3D11
Loading
0