Farama-Foundation / HighwayEnv

A minimalist environment for decision-making in autonomous driving
https://highway-env.farama.org/
MIT License
2.64k stars 754 forks source link

Multiple questions about the intersection model(Plz Help me) #374

Closed LittleDevHo closed 1 year ago

LittleDevHo commented 2 years ago

Hello, I am a graduate student who is impressed by your research and wants to do my own research based on it. I have a few questions for you.

  1. Can I measure the speed profile graph of Ego-vehicle, throughput over time, and mean speed measurement in detail? Also, I would appreciate your advice on how to draw a graph.

  2. I would appreciate it if you could tell me how to approach the DQN+Attention mechanism to upgrade further.

Thanks to your research, I found that reinforcement learning is a really fun study.

eleurent commented 2 years ago

Hello,

You can get the current speed of the ego-vehicle using env.vehicle.speed. However, you may want to increase the policy frequency to match the simulation frequency, such that you are able to measure the speed at every step. Otherwise, you'd have to edit the _simulate() method of AbstractEnv to store the speeds at intermediate simulation frames (between two actions), and return them at the end of env.step in the info field.

I am not sure I fully understand your question 2., what is it that you would like to know?

LittleDevHo commented 2 years ago

Thank you for your answer.

About env.vehicle.speed using for current speed graph, Can you make some example code for it?

Also, I wanna know some more features by each model, like traffic flow per hour, collision rate during model, average speed.

How can I build them?

You don't have to worry about question 2. It was just asking for insights on how to change the reinforcement learning model for the better.

eleurent commented 2 years ago

About env.vehicle.speed using for current speed graph, Can you make some example code for it?

env = gym.make('highway-v0')
env.reset()
for _ in range(5):
  env.step(3)
  print(env.vehicle.speed)

traffic flow per hour, collision rate during model, average speed

These are not available as of now. You can compute the average speed and collision rate yourself by accessing the instantaneous speed and collision variables and computing averages across episodes. And I think this may not be the best environment to measure the traffic flow, as it focuses on small scenes with a few interacting agents (intersection, merge, etc.) but it not suited for larger scale traffic simulations.