Skip to content
Snippets Groups Projects
Commit 62b3fbd0 authored by u229589's avatar u229589
Browse files

implement review points

parent d33c5582
No related branches found
No related tags found
No related merge requests found
...@@ -9,10 +9,10 @@ Changes since Flatland 2.0.0 ...@@ -9,10 +9,10 @@ Changes since Flatland 2.0.0
### Changes in rail generator and `RailEnv` ### Changes in rail generator and `RailEnv`
- renaming of `distance_maps` into `distance_map` - renaming of `distance_maps` into `distance_map`
- by default the reset method of RailEnv is not called in the constructor of RailEnv anymore. Therefore the reset method needs to be called after the creation of a RailEnv object - by default the reset method of RailEnv is not called in the constructor of RailEnv anymore (compliance for OpenAI Gym). Therefore the reset method needs to be called after the creation of a RailEnv object
### Changes in schedule generation ### Changes in schedule generation
- return value of schedule generator has changed to the named tuple `Schedule` - return value of schedule generator has changed to the named tuple `Schedule`. From the point of view of a consumer, nothing has changed, this is just a type hint which is introduced where the attributes of `Schedule` have names.
Changes since Flatland 1.0.0 Changes since Flatland 1.0.0
-------------------------- --------------------------
......
...@@ -711,3 +711,5 @@ RailEnv._max_episode_steps = timedelay_factor * alpha * (env.width + env.height ...@@ -711,3 +711,5 @@ RailEnv._max_episode_steps = timedelay_factor * alpha * (env.width + env.height
``` ```
where the following default values are used `timedelay_factor=4`, `alpha=2` and `ratio_nr_agents_to_nr_cities=20` where the following default values are used `timedelay_factor=4`, `alpha=2` and `ratio_nr_agents_to_nr_cities=20`
If participants want to use their own formula they have to overwrite the method `compute_max_episode_steps()` from the class `RailEnv`
...@@ -250,8 +250,7 @@ class RailEnv(Environment): ...@@ -250,8 +250,7 @@ class RailEnv(Environment):
self.agents = EnvAgent.list_from_static(self.agents_static) self.agents = EnvAgent.list_from_static(self.agents_static)
@staticmethod @staticmethod
def compute_max_episode_steps(width: int, height: int, timedelay_factor: int = 4, alpha: int = 2, def compute_max_episode_steps(width: int, height: int, ratio_nr_agents_to_nr_cities: float = 20.0) -> int:
ratio_nr_agents_to_nr_cities: float = 20.0) -> int:
""" """
compute_max_episode_steps(width, height, ratio_nr_agents_to_nr_cities, timedelay_factor, alpha) compute_max_episode_steps(width, height, ratio_nr_agents_to_nr_cities, timedelay_factor, alpha)
...@@ -265,10 +264,6 @@ class RailEnv(Environment): ...@@ -265,10 +264,6 @@ class RailEnv(Environment):
height of environment height of environment
ratio_nr_agents_to_nr_cities : float, optional ratio_nr_agents_to_nr_cities : float, optional
number_of_agents/number_of_cities number_of_agents/number_of_cities
timedelay_factor : int, optional
timedelay_factor
alpha : int, optional
alpha
Returns Returns
------- -------
...@@ -276,6 +271,8 @@ class RailEnv(Environment): ...@@ -276,6 +271,8 @@ class RailEnv(Environment):
maximum number of episode steps maximum number of episode steps
""" """
timedelay_factor = 4
alpha = 2
return int(timedelay_factor * alpha * (width + height + ratio_nr_agents_to_nr_cities)) return int(timedelay_factor * alpha * (width + height + ratio_nr_agents_to_nr_cities))
def reset(self, regen_rail=True, replace_agents=True, activate_agents=False, random_seed=None): def reset(self, regen_rail=True, replace_agents=True, activate_agents=False, random_seed=None):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment