Farama-Foundation / HighwayEnv

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

Randint problem when loading racetrack environment #588

Open Agathe48 opened 2 months ago

Agathe48 commented 2 months ago

I notice there was sometimes a bug when loading the racetrack environment, the following error was shown: File highway_env\road\road.py", line 254, in random_lane_index _id = np_random.randint(len(self.graph[_from][_to])) AttributeError: 'numpy.random._generator.Generator' object has no attribute 'randint'

I managed to fix it in my local environment by changing this line in the file: highway_env\road\road.py", line 254, in random_lane_index I change the line _id = np_random.randint(len(self.graph[_from][_to])) to _id = np_random.integers(len(self.graph[_from][_to])).

I don't know if it's the best way to fix this bug but it works for me.

eleurent commented 2 months ago

Hi @Agathe48, Sorry about this, this has been fixed already in

https://github.com/Farama-Foundation/HighwayEnv/commit/b0a4a847b70e60fc6e00f746ce325d7f869c3a9e

(and yes you suggested the correct fix)

But it hasn't made it into a release yet, I guess I should probably make a hot fix