-
Notifications
You must be signed in to change notification settings - Fork 73
/
Copy pathensemble_algorithm_and_model.py
44 lines (36 loc) · 1.41 KB
/
ensemble_algorithm_and_model.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
from benchmarl.algorithms import EnsembleAlgorithmConfig, IppoConfig, MappoConfig
from benchmarl.environments import VmasTask
from benchmarl.experiment import Experiment, ExperimentConfig
from benchmarl.models import MlpConfig
from models import DeepsetsConfig, EnsembleModelConfig, GnnConfig
if __name__ == "__main__":
# Loads from "benchmarl/conf/experiment/base_experiment.yaml"
experiment_config = ExperimentConfig.get_from_yaml()
# Loads from "benchmarl/conf/task/vmas/simple_tag.yaml"
task = VmasTask.SIMPLE_TAG.get_from_yaml()
algorithm_config = EnsembleAlgorithmConfig(
{"agent": MappoConfig.get_from_yaml(), "adversary": IppoConfig.get_from_yaml()}
)
model_config = EnsembleModelConfig(
{"agent": MlpConfig.get_from_yaml(), "adversary": GnnConfig.get_from_yaml()}
)
critic_model_config = EnsembleModelConfig(
{
"agent": DeepsetsConfig.get_from_yaml(),
"adversary": MlpConfig.get_from_yaml(),
}
)
experiment = Experiment(
task=task,
algorithm_config=algorithm_config,
model_config=model_config,
critic_model_config=critic_model_config,
seed=0,
config=experiment_config,
)
experiment.run()