Пример #1
0
params_filename = glob.glob(os.path.join(exp_dir, "params*"))[0]
params = ParameterServer(filename=params_filename, log_if_default=True)
params["ML"]["BaseAgent"]["SummaryPath"] = os.path.join(
    exp_dir, "agent/summaries")
params["ML"]["BaseAgent"]["CheckpointPath"] = os.path.join(
    exp_dir, "agent/checkpoints")

# load belief observer specifics
if is_belief_observer:
    splits = 2
    behavior_params_filename = glob.glob(
        os.path.join(exp_dir, "behavior_params*"))[0]
    params_behavior = ParameterServer(filename=behavior_params_filename,
                                      log_if_default=True)
    behavior_space = BehaviorSpace(params_behavior)

    hypothesis_set, hypothesis_params = behavior_space.create_hypothesis_set_fixed_split(
        split=splits)
    observer = BeliefObserver(params, hypothesis_set, splits=splits)
    behavior = BehaviorDiscreteMacroActionsML(params)
# if not, load default observer
else:
    behavior = BehaviorDiscreteMacroActionsML(params)
    observer = NearestAgentsObserver(params)

# load env
env_to_pass_observer_behavior = SingleAgentRuntime(ml_behavior=behavior,
                                                   observer=observer,
                                                   step_time=-1.0,
                                                   viewer=-1.0,