LucasAlegre / sumo-rl

Reinforcement Learning environments for Traffic Signal Control with SUMO. Compatible with Gymnasium, PettingZoo, and popular RL libraries.
https://lucasalegre.github.io/sumo-rl
MIT License
746 stars 201 forks source link

Applying fixed time control to SumoEnvironmentPZ class #197

Closed Loveen01 closed 7 months ago

Loveen01 commented 7 months ago

Hi, I am using SUMO-RL for my masters project it has been very useful, and I have 2 questions to ask.

I can see that the fixed time traffic control can be enabled in the SumoEnvironmentclass by enabling the parameter fixed_ts = True, and we see that self.step() will change the phases one after the other within a fixed time after self.delta_time seconds has passed (if we additionally pass no actions_dict to the def step() function).

if action is None or action == {}:
      for _ in range(self.delta_time):
                self._sumo_step()

My 2 questions are:

  1. Can you please clarify how exactly this fixed time control parameters ensure that each phase is played for a fixed time?
  2. Is there a way we can allow the SumoEnvironmentPZ to support this feature too? The step() in SumoEnvironmentPZ overrides the SumoEnvironment.step() but does not seem to accept an empty action dictionary to be passed into it, in contrast to the SumoEnvironment.step() function.

Thanks alot for your time.

LucasAlegre commented 7 months ago

Hi, I'm glad sumo-rl is being useful!

1) When you set fixed_ts=True, the simulation uses the traffic signal configuration and phase durations defined in the .net file. In this case, delta_time does not affect the duration of the phases. 2) Yes, I just implemented this: https://github.com/LucasAlegre/sumo-rl/commit/0e741e3422437605b2809b1ea36e8f73fddd26ad :)

Loveen01 commented 7 months ago

amazing thank you!