예제 #1
0
    ray.init(ignore_reinit_error=True)

    #### Register the environment ##############################
    temp_env_name = "this-aviary-v0"
    if ARGS.env == 'flock':
        register_env(
            temp_env_name, lambda _: FlockAviary(
                num_drones=ARGS.num_drones,
                aggregate_phy_steps=shared_constants.AGGR_PHY_STEPS,
                obs=ARGS.obs,
                act=ARGS.act))
    elif ARGS.env == 'leaderfollower':
        register_env(
            temp_env_name, lambda _: LeaderFollowerAviary(
                num_drones=ARGS.num_drones,
                aggregate_phy_steps=shared_constants.AGGR_PHY_STEPS,
                obs=ARGS.obs,
                act=ARGS.act))
    elif ARGS.env == 'meetup':
        register_env(
            temp_env_name, lambda _: MeetupAviary(
                num_drones=ARGS.num_drones,
                aggregate_phy_steps=shared_constants.AGGR_PHY_STEPS,
                obs=ARGS.obs,
                act=ARGS.act))
    elif ARGS.env == 'payloadcoop':
        register_env(
            temp_env_name, lambda _: PayloadCoop(
                num_drones=ARGS.num_drones,
                aggregate_phy_steps=shared_constants.AGGR_PHY_STEPS,
                obs=ARGS.obs,
예제 #2
0
    #### Register the custom centralized critic model ##########
    ModelCatalog.register_custom_model("cc_model", CustomTorchCentralizedCriticModel)

    #### Register the environment ##############################
    temp_env_name = "this-aviary-v0"
    if ARGS.exp.split("-")[1] == 'flock':
        register_env(temp_env_name, lambda _: FlockAviary(num_drones=NUM_DRONES,
                                                          aggregate_phy_steps=shared_constants.AGGR_PHY_STEPS,
                                                          obs=OBS,
                                                          act=ACT
                                                          )
                     )
    elif ARGS.exp.split("-")[1] == 'leaderfollower':
        register_env(temp_env_name, lambda _: LeaderFollowerAviary(num_drones=NUM_DRONES,
                                                                   aggregate_phy_steps=shared_constants.AGGR_PHY_STEPS,
                                                                   obs=OBS,
                                                                   act=ACT
                                                                   )
                     )
    elif ARGS.exp.split("-")[1] == 'meetup':
        register_env(temp_env_name, lambda _: MeetupAviary(num_drones=NUM_DRONES,
                                                           aggregate_phy_steps=shared_constants.AGGR_PHY_STEPS,
                                                           obs=OBS,
                                                           act=ACT
                                                           )
                     )
    else:
        print("[ERROR] environment not yet implemented")
        exit()

    #### Unused env to extract the act and obs spaces ##########