> Unavailable Routes

Hey,

infos lets us know the number of steps for which a route is unavailable. However, it only does it for routes that have agents on either the origin or destination.

Is there a way we can find the number of steps for which a route is going to be inactive, even if no agent is present at the source and destination?

Thanks

Posted by: alpra @ March 6, 2024, 2:14 p.m.

Hi Alpra,

You can do something along these lines:
graph = env.state()['route_map'][0] #0 is the airplane type [0,1,..]
for u, v, data in graph.edges(data=True):
print(f"Edge {u} to {v} data: {data}")

This should return: {'cost': 0.8926404272871225, 'plane_type': 0, 'time': 18, 'mal': 6, 'expected_mal_steps': 5.0, 'route_available': False} for all edges u and v

You can create your own dictionary of unavailable routes using: { (u, v): d['mal'] for u, v, d in graph.edges(data=True) if d['mal'] > 0 }

All the best,
Adis

Posted by: adelanovic @ March 6, 2024, 3:26 p.m.

Thank you!

Posted by: alpra @ March 6, 2024, 3:35 p.m.

Just to add to this. The routemap can be accessed through the observation, here is an example:

print(obs['a_0']['globalstate']['route_map']) # a_0 is the agent key, [a_0, a_1, a_2,..]

Calling env.state() won't work with remote evaluator services (since we don't allow access to the environment directly). It can still be used locally for debugging just in the submission the routemap should be accessed via the observation.

All the best,
Adis

Posted by: adelanovic @ March 6, 2024, 4:33 p.m.
Post in this thread