added changes from code submission branch and coin entity

This commit is contained in:
Chanumask
2024-09-06 11:01:42 +02:00
parent 33e40deecf
commit 5476f617c6
42 changed files with 1429 additions and 68 deletions

View File

@@ -1,10 +1,11 @@
import copy
from pathlib import Path
from marl_factory_grid.algorithms.marl.a2c_dirt import A2C
from marl_factory_grid.algorithms.rl.a2c_coin import A2C
from marl_factory_grid.algorithms.utils import load_yaml_file
def single_agent_training(config_name):
cfg_path = Path(f'../marl_factory_grid/algorithms/marl/configs/{config_name}_config.yaml')
cfg_path = Path(f'../marl_factory_grid/algorithms/rl/configs/{config_name}_config.yaml')
train_cfg = load_yaml_file(cfg_path)
# Use environment config with fixed spawnpoints for eval
@@ -21,7 +22,7 @@ def single_agent_training(config_name):
def single_agent_eval(config_name, run):
cfg_path = Path(f'../marl_factory_grid/algorithms/marl/configs/{config_name}_config.yaml')
cfg_path = Path(f'../marl_factory_grid/algorithms/rl/configs/{config_name}_config.yaml')
train_cfg = load_yaml_file(cfg_path)
# Use environment config with fixed spawnpoints for eval
@@ -34,7 +35,7 @@ def single_agent_eval(config_name, run):
def multi_agent_eval(config_name, runs, emergent_phenomenon=False):
cfg_path = Path(f'../marl_factory_grid/algorithms/marl/configs/MultiAgentConfigs/{config_name}_config.yaml')
cfg_path = Path(f'../marl_factory_grid/algorithms/rl/configs/MultiAgentConfigs/{config_name}_config.yaml')
train_cfg = load_yaml_file(cfg_path)
# Use environment config with fixed spawnpoints for eval
@@ -85,12 +86,14 @@ def two_rooms_one_door_modified_single_agent_eval(agent_name):
def dirt_quadrant_5_multi_agent_eval(emergent_phenomenon):
multi_agent_eval("dirt_quadrant", ["run4", "run5"], emergent_phenomenon)
def dirt_quadrant_5_multi_agent_ctde_eval(emergent_phenomenon): # run7 == run4
def dirt_quadrant_5_multi_agent_ctde_eval(emergent_phenomenon): # run7 == run4
multi_agent_eval("dirt_quadrant", ["run4", "run7"], emergent_phenomenon)
def two_rooms_one_door_modified_multi_agent_eval(emergent_phenomenon):
multi_agent_eval("two_rooms_one_door_modified", ["run2", "run3"], emergent_phenomenon)
if __name__ == '__main__':
dirt_quadrant_5_multi_agent_ctde_eval(True)
dirt_quadrant_5_multi_agent_ctde_eval(True)

View File

@@ -2,7 +2,7 @@ from marl_factory_grid.algorithms.utils import Checkpointer
from pathlib import Path
from marl_factory_grid.algorithms.utils import load_yaml_file, add_env_props, instantiate_class, load_class
# from algorithms.marl import LoopSNAC, LoopIAC, LoopSEAC
# from algorithms.rl import LoopSNAC, LoopIAC, LoopSEAC
for i in range(0, 5):

View File

@@ -5,7 +5,7 @@ from algorithms.utils import load_yaml_file
from tqdm import trange
study = 'example_config#0'
#study_root = Path(__file__).parent / study
study_root = Path('/Users/romue/PycharmProjects/EDYS/algorithms/marl/')
study_root = Path('/Users/romue/PycharmProjects/EDYS/algorithms/rl/')
#['L2NoAh_gru', 'L2NoCh_gru', 'nomix_gru']:
render = True