HighwayEnv icon indicating copy to clipboard operation
HighwayEnv copied to clipboard

intersectionEnv: is the has_arrived function always checking for if the agents has arrived in inner left lane?

Open francissunny25 opened this issue 1 year ago • 2 comments

https://github.com/eleurent/highway-env/blob/742ce2e69bf00169f2b250e0388c6b9926c026ec/highway_env/envs/intersection_env.py#L260

Can this be the reason why the agent takes a u-turn after it reached the end of the lane and joined the outer lane?

For recreating I was using it with multiple agents (4) 0 initial vehicles count changed the terminal condition to all https://github.com/eleurent/highway-env/blob/742ce2e69bf00169f2b250e0388c6b9926c026ec/highway_env/envs/intersection_env.py#L99

increased duration (20) image

francissunny25 avatar Aug 17 '22 17:08 francissunny25

  • The agent makes the u-turn at the end of the lane because there is no next lane to follow. By default, in this situation, the agent is configured to follow the closest other lane, which is the one leading back to the intersection.
  • Normally, that does not happen because (in the single-player setting) the has_arrived condition is raised, which terminates the episode
  • I just realised there might be a bug in has_arrived(): it seems like I only test the west direction, and not other ones (probably because originally I was mostly testing the left turn for a single-agent coming from the south. I'll fix it.
  • Even with a fixed has_arrived condition, this will probably still happen if you set the terminal condition to all, since the first agents to arrive will have to keep driving. I'm not sure what a good solution to that must be... make the exit lanes longer? stop the agents?

eleurent avatar Aug 20 '22 09:08 eleurent

Even with a fixed has_arrived condition, this will probably still happen if you set the terminal condition to all, since the first agents to arrive will have to keep driving. I'm not sure what a good solution to that must be... make the exit lanes longer? stop the agents?

would it make sense to remove the agent out of the scene (from the list of controlled vehicles) on arriving at the destination?

francissunny25 avatar Aug 21 '22 10:08 francissunny25