'Returns the optimal action from the current node.'

def get_optimal_action(self, current_node_ids, step_number):

    goal_number = (step_number / self.task_params.num_steps)
    gtG = self.task.gtG
    a = np.zeros((len(current_node_ids), self.task_params.num_actions), dtype=np.int32)
    d_dict = self.episode.dist_to_goal[goal_number]
    for (i, c) in enumerate(current_node_ids):
        neigh = gtG.vertex(c).out_neighbours()
        neigh_edge = gtG.vertex(c).out_edges()
        ds = np.array([d_dict[i][int(x)] for x in neigh])
        ds_min = np.min(ds)
        for (i_, e) in enumerate(neigh_edge):
            if (ds[i_] == ds_min):
                _ = gtG.ep['action'][e]
                a[(i, _)] = 1
    return a
