Error in baseline

In the util module split_tree does not have num_features_per_node as paramter, but you have used it as a paramter in

# As defined in

def split_tree(tree, current_depth=0):
    num_features_per_node = TreeObsForRailEnv.observation_dim

    if len(tree) < num_features_per_node:
        return [], [], []

    depth = 0
    tmp = len(tree) / num_features_per_

# Code in
        # Split the observation tree into its parts and normalize the observation using the utility functions.
        # Build agent specific local observation
        for a in range(env.get_num_agents()):
            rail_data, distance_data, agent_data = split_tree(tree=np.array(obs[a]),
            rail_data = norm_obs_clip(rail_data)
            distance_data = norm_obs_clip(distance_data)
            agent_data = np.clip(agent_data, -1, 1)
            agent_obs[a] = np.concatenate((np.concatenate((rail_data, distance_data)), agent_data))

when the parameter is removed, I get the following error.

AttributeError: type object 'TreeObsForRailEnv' has no attribute 'observation_dim'

I then manually specified num_features_per_node = 9 in observation_utils, but then the state size reduces to 45 from 168 (Using the code from for env generation).

Hi mrugankakarte

In we only use num_features_per_node to set the dimension size for the agent. I will also fix the attribute error. I saw it was implemented wrongly in the observation builder.

best regards


Hi Mrugankakarte

It should now be fixed in the baselines repo. If it is not working yet then you have to clone the git repo of flatland and install it. We will push a new version of flatland soon. All fixes will be in there.

best regards,