コード例 #1
0
 def __init__(self, n_agents, map_name='default_small'):
     self.n_agents = n_agents
     self.env = GatheringEnv(n_agents)
コード例 #2
0
                    type=int,
                    default=543,
                    metavar='N',
                    help='random seed (default: 543)')
parser.add_argument('--render',
                    default=True,
                    action='store_true',
                    help='render the environment')
parser.add_argument('--log-interval',
                    type=int,
                    default=2,
                    metavar='N',
                    help='interval between training status logs (default: 10)')
args = parser.parse_args()

env = GatheringEnv(2,
                   "default_small2")  #"mini_map")  # gym.make('CartPole-v1')
env.seed(args.seed)
torch.manual_seed(args.seed)

# agentParam =

model_name = "gathering_social_"  #gathering_1"
file_name = "save_weight/" + model_name
ifload = False
save_eps = 20
ifsave_model = True
# logger = Logger('./logs5')
agentParam = {
    "gamma": args.gamma,
    "LR": 1e-2,
    "device": device,
コード例 #3
0
                    type=int,
                    default=543,
                    metavar='N',
                    help='random seed (default: 543)')
parser.add_argument('--render',
                    action='store_true',
                    help='render the environment')
parser.add_argument('--log-interval',
                    type=int,
                    default=5,
                    metavar='N',
                    help='interval between training status logs (default: 10)')
args = parser.parse_args()

n_agents = 2
env = GatheringEnv(n_agents, "default_small2")
env.seed(args.seed)
torch.manual_seed(args.seed)

test_mode = False

names = {
    "social": "pg_social",
    "base": "pg_indi",
    "single": "pg_single_less",
    "forbid": "base_forbid"
}
mode = "base"
model_name = names[mode]
file_name = "train_para/" + model_name
agentParam = {
コード例 #4
0
                    type=int,
                    default=543,
                    metavar='N',
                    help='random seed (default: 543)')
parser.add_argument('--render',
                    default=True,
                    action='store_true',
                    help='render the environment')
parser.add_argument('--log-interval',
                    type=int,
                    default=2,
                    metavar='N',
                    help='interval between training status logs (default: 10)')
args = parser.parse_args()

env = GatheringEnv(2, "default_small2")
env.seed(args.seed)
torch.manual_seed(args.seed)

# agentParam =

model_name = "gathering_centIAC"  #"gathering_social_share"#"gathering_social_v1"#gathering_1"
file_name = "save_weight/" + model_name
ifload = False
save_eps = 20
ifsave_model = True
# logger = Logger('./logs5')
agentParam = {
    "gamma": args.gamma,
    "LR": 1e-2,
    "device": device,
コード例 #5
0
 def init_env():
     env = env_wrapper(GatheringEnv(
         2, "default_small2"))  #env_wrapper(CleanupEnv(num_agents=4))
     # env.seed(seed + rank * 1000)
     np.random.seed(seed + rank * 1000)
     return env
コード例 #6
0
parser.add_argument('--render',
                    default=False,
                    action='store_true',
                    help='render the environment')
parser.add_argument(
    '--log-interval',
    type=int,
    default=2,
    metavar='N',
    help='interval between training status logs0 (default: 10)')
args = parser.parse_args()

n_agents = 2
state_dim = 400
action_dim = 8
env = GatheringEnv(2, "default_small2")
torch.manual_seed(args.seed)

# agentParam =

model_name = "gathering_maac"  #"gathering_centIAC" #"gathering_social_v1"#gathering_1"
file_name = "save_weight/" + model_name
ifload = False
save_eps = 30
ifsave_model = True
agentParam = {
    "gamma": args.gamma,
    "LR": 1e-2,
    "device": device,
    "ifload": ifload,
    "filename": file_name
コード例 #7
0
                    type=int,
                    default=543,
                    metavar='N',
                    help='random seed (default: 543)')
parser.add_argument('--render',
                    default=True,
                    action='store_true',
                    help='render the environment')
parser.add_argument('--log-interval',
                    type=int,
                    default=2,
                    metavar='N',
                    help='interval between training status logs (default: 10)')
args = parser.parse_args()

env = GatheringEnv(2)  # gym.make('CartPole-v1')
env.seed(args.seed)
torch.manual_seed(args.seed)

agentParam = {"gamma": args.gamma, "LR": 1e-2, "device": device}
# agentParam =

model_name = "pg_social"
file_name = "/Users/xue/Desktop/Social Law/saved_weight/" + model_name
save_eps = 10
ifsave_model = True
# logger = Logger('./logs5')


class Agents():
    def __init__(self, agents):