Пример #1
0

if __name__ == '__main__':
    config1 = config()
    # make env
    args = xworld_args.parser().parse_args()
    args.visible_radius_unit_side = config1.visible_radius_unit_side
    args.visible_radius_unit_front = config1.visible_radius_unit_front
    args.ego_centric = config1.ego_centric
    args.map_config = config1.map_config_file
    args.goal_id = 0
    args.israndom_goal = False
    env = xworld_navi_goal_obs_crop.XWorldNaviGoal(args)

    # exploration strategy
    exp_schedule = LinearExploration(env.agent.num_actions, config1.eps_begin,
                                     config1.eps_end, config1.eps_nsteps)

    # learning rate schedule
    lr_schedule = LinearSchedule(config1.lr_begin, config1.lr_end,
                                 config1.lr_nsteps)

    # train model
    g1 = tf.Graph()
    model = DRQN(env, config1, g1)

    g2 = tf.Graph()
    model2 = DRQN(env, config1, g2)

    #with g1.as_default():
    #    params = tf.get_collection(tf.GraphKeys.TRAINABLE_VARIABLES, scope='q')
    #print(params)
Пример #2
0
        self.evaluate()  


if __name__ == '__main__':
    # make env
    args = xworld_args.parser().parse_args()
    args.visible_radius_unit_side = config.visible_radius_unit_side
    args.visible_radius_unit_front = config.visible_radius_unit_front
    args.ego_centric = config.ego_centric
    args.map_config = config.map_config_file
    env = xworld_navi_goal.XWorldNaviGoal(args)
    env.teacher.israndom_goal = False
    env.teacher.goal_id = 0

    # exploration strategy
    exp_schedule = LinearExploration(env, config.eps_begin, 
            config.eps_end, config.eps_nsteps)

    # learning rate schedule
    lr_schedule  = LinearSchedule(config.lr_begin, config.lr_end,
            config.lr_nsteps)

    # train model
    model = DRQN(env, config)
    shutil.copyfile('./configs/drqn_xworld.py', config.output_path+'config.py')
    shutil.copy(os.path.realpath(__file__), config.output_path)
    shutil.copy(config.map_config_file, config.output_path)
    if config.deploy_only:
        model.deploy()
    else:
        model.run(exp_schedule, lr_schedule)
    args = xworld_args.parser().parse_args()
    args.visible_radius_unit_side = config_i.visible_radius_unit_side
    args.visible_radius_unit_front = config_i.visible_radius_unit_front
    args.ego_centric = config_i.ego_centric
    args.map_config = config_i.map_config_file
    args.goal_id = 0
    args.israndom_goal = False
    env_i = xworld_navi_goal_gt_dnc.XWorldNaviGoal(args)

    # load model
    g_a = tf.Graph()
    model_a = DRQN(env_a, config_a, g_a)
    model_a.initialize()

    # exploration strategy
    exp_schedule = LinearExploration(2, config_i.eps_begin, 
            config_i.eps_end, config_i.eps_nsteps)

    # learning rate schedule
    lr_schedule  = LinearSchedule(config_i.lr_begin, config_i.lr_end,
            config_i.lr_nsteps)

    # train model
    g_i = tf.Graph()
    model_i = DRQN_planner(env_i, config_i, g_i)

    '''
    model_i.initialize()
    nldms = []
    nins = 2
    nway = 5
    ndigits = 2