Add Independent A2C implementation

This commit is contained in:
Julian Schönberger
2024-05-02 11:10:23 +02:00
parent 175a02f997
commit 55026eda12
4 changed files with 546 additions and 7 deletions

View File

@ -1,15 +1,19 @@
import copy
from pathlib import Path
from marl_factory_grid.algorithms.marl.iac import LoopIAC
from marl_factory_grid.algorithms.marl.a2c_dirt import A2C
from marl_factory_grid.algorithms.utils import load_yaml_file
if __name__ == '__main__':
cfg_path = Path('../marl_factory_grid/algorithms/marl/example_config.yaml')
cfg_path = Path('../marl_factory_grid/algorithms/marl/configs/dirt_quadrant_config.yaml')
cfg = load_yaml_file(cfg_path)
train_cfg = load_yaml_file(cfg_path)
# Use environment config with fixed spawnpoints for eval
eval_cfg = copy.deepcopy(train_cfg)
eval_cfg["env"]["env_name"] = "custom/dirt_quadrant" # Options: two_rooms_one_door_modified, dirt_quadrant
print("Training phase")
agent = LoopIAC(cfg)
agent = A2C(train_cfg, eval_cfg)
agent.train_loop()
agent.plot_reward_development()
print("Evaluation phase")
agent.eval_loop(10)