def __init__(self, args):
     self.n_actions = args.n_actions
     self.n_agents = args.n_agents
     self.state_shape = args.state_shape
     self.obs_shape = args.obs_shape
     if args.alg == 'vdn':
         self.policy = VDN(args)
     elif args.alg == 'qmix':
         self.policy = QMIX(args)
     elif args.alg == 'coma':
         self.policy = COMA(args)
     elif args.alg == 'qtran_alt':
         self.policy = QtranAlt(args)
     elif args.alg == 'qtran_base':
         self.policy = QtranBase(args)
     elif args.alg == 'maven':
         self.policy = MAVEN(args)
     elif args.alg == 'central_v':
         self.policy = CentralV(args)
     elif args.alg == 'reinforce':
         self.policy = Reinforce(args)
     else:
         raise Exception("No such algorithm")
     self.args = args
     print('Init Agents')
Exemple #2
0
 def __init__(self, args):
     self.n_actions = args.n_actions
     self.n_agents = args.n_agents
     self.state_shape = args.state_shape
     self.obs_shape = args.obs_shape
     if args.alg == 'vdn':
         from policy.vdn import VDN
         self.policy = VDN(args)
     elif args.alg == 'iql':
         from policy.iql import IQL
         self.policy = IQL(args)
     elif args.alg == 'qmix':
         from policy.qmix import QMIX
         self.policy = QMIX(args)
     elif args.alg == 'coma':
         from policy.coma import COMA
         self.policy = COMA(args)
     elif args.alg == 'qtran_alt':
         from policy.qtran_alt import QtranAlt
         self.policy = QtranAlt(args)
     elif args.alg == 'qtran_base':
         from policy.qtran_base import QtranBase
         self.policy = QtranBase(args)
     elif args.alg == 'maven':
         from policy.maven import MAVEN
         self.policy = MAVEN(args)
     elif args.alg == 'central_v':
         from policy.central_v import CentralV
         self.policy = CentralV(args)
     elif args.alg == 'reinforce':
         from policy.reinforce import Reinforce
         self.policy = Reinforce(args)
     else:
         raise Exception("No such algorithm")
     self.args = args
Exemple #3
0
 def __init__(self, args):
     self.n_actions = args.n_actions
     self.n_agents = args.n_agents
     self.state_shape = args.state_shape
     self.obs_shape = args.obs_shape
     self.policy = COMA(args)
     self.args = args
Exemple #4
0
 def __init__(self, args):
     self.n_actions = args.n_actions
     self.n_agents = args.n_agents
     self.state_shape = args.state_shape
     self.obs_shape = args.obs_shape
     if args.alg == 'vdn':
         self.policy = VDN(args)
     elif args.alg == 'qmix':
         self.policy = QMIX(args)
     else:
         self.policy = COMA(args)
     self.args = args
Exemple #5
0
 def __init__(self, args):
     self.n_actions = args.n_actions
     self.n_agents = args.n_agents * 2
     self.state_shape = args.state_shape
     self.obs_shape = args.obs_shape
     self.idact_shape = args.id_dim + args.n_actions
     self.search_actions = np.eye(args.n_actions)
     self.search_ids = np.zeros(self.n_agents)
     if args.alg == 'vdn':
         self.policy = VDN(args)
     elif args.alg == 'qmix':
         self.policy = QMIX(args)
     elif args.alg == 'ours':
         self.policy = OURS(args)
     elif args.alg == 'coma':
         self.policy = COMA(args)
     elif args.alg == 'qtran_alt':
         self.policy = QtranAlt(args)
     elif args.alg == 'qtran_base':
         self.policy = QtranBase(args)
     elif args.alg == 'maven':
         self.policy = MAVEN(args)
     elif args.alg == 'central_v':
         self.policy = CentralV(args)
     elif args.alg == 'reinforce':
         self.policy = Reinforce(args)
     else:
         raise Exception("No such algorithm")
     if args.use_fixed_model:
         args_goal_a = get_common_args()
         args_goal_a.load_model = True
         args_goal_a = get_mixer_args(args_goal_a)
         args_goal_a.learn = False
         args_goal_a.epsilon = 0  # 1
         args_goal_a.min_epsilon = 0
         args_goal_a.map = 'battle'
         args_goal_a.n_actions = args.n_actions
         args_goal_a.episode_limit = args.episode_limit
         args_goal_a.n_agents = args.n_agents
         args_goal_a.state_shape = args.state_shape
         args_goal_a.feature_shape = args.feature_shape
         args_goal_a.view_shape = args.view_shape
         args_goal_a.obs_shape = args.obs_shape
         args_goal_a.real_view_shape = args.real_view_shape
         args_goal_a.load_num = args.load_num
         args_goal_a.use_ja = False
         args_goal_a.mlp_hidden_dim = [512, 512]
         self.fixed_policy = VDN_F(args_goal_a)
     self.args = args
     print('Init Agents')
Exemple #6
0
 def __init__(self, args):
     self.n_actions = args.n_actions
     self.n_agents = args.n_agents
     self.state_shape = args.state_shape
     self.obs_shape = args.obs_shape
     alg = args.alg
     if alg.find('reinforce') > -1:
         self.policy = Reinforce(args)
     elif alg.find('coma') > -1:
         self.policy = COMA(args)
     elif alg.find('central_v') > -1:
         self.policy = CentralV(args)
     else:
         raise Exception("No such algorithm")
     self.args = args
     print('Init CommAgents')
Exemple #7
0
 def __init__(self, args):
     self.n_actions = args.n_actions
     self.n_agents = args.n_agents
     self.state_shape = args.state_shape
     self.obs_shape = args.obs_shape
     if args.alg == 'vdn':
         self.policy = VDN(args)
     elif args.alg == 'qmix':
         self.policy = QMIX(args)
     elif args.alg == 'coma':
         self.policy = COMA(args)
     elif args.alg == 'qtran_alt':
         self.policy = QtranAlt(args)
     elif args.alg == 'qtran_base':
         self.policy = QtranBase(args)
     else:
         raise Exception("No such algorithm")
     self.args = args