Commit 82d59c79 authored by nilabha's avatar nilabha

Merge branch 'flatland-paper-baselines' into 'flatland-paper-baselines'

Fixing minor bugs with namedtuples and ray versions

See merge request !16
parents 8450fb5c 90939b9e
Pipeline #5381 failed with stage
in 2 minutes and 48 seconds
......@@ -2,7 +2,7 @@ import logging
import gym
import numpy as np
from flatland.envs.malfunction_generators import no_malfunction_generator, malfunction_from_params
from flatland.envs.malfunction_generators import no_malfunction_generator, malfunction_from_params, MalfunctionParameters
from flatland.envs.rail_env import RailEnv
from flatland.envs.rail_generators import sparse_rail_generator
from flatland.envs.schedule_generators import sparse_schedule_generator
......@@ -59,11 +59,11 @@ class FlatlandSingle(gym.Env):
malfunction_generator = no_malfunction_generator()
if {'malfunction_rate', 'min_duration', 'max_duration'} <= self._config.keys():
stochastic_data = {
'malfunction_rate': self._config['malfunction_rate'],
'min_duration': self._config['malfunction_min_duration'],
'max_duration': self._config['malfunction_max_duration']
}
stochastic_data = MalfunctionParameters(
malfunction_generator=self._config['malfunction_rate'],
min_duration=self._config['malfunction_min_duration'],
max_duration=self._config['malfunction_max_duration']
)
malfunction_generator = malfunction_from_params(stochastic_data)
speed_ratio_map = None
......
......@@ -2,7 +2,8 @@ import logging
from pprint import pprint
import gym
from flatland.envs.malfunction_generators import malfunction_from_params, no_malfunction_generator
from flatland.envs.malfunction_generators import malfunction_from_params, no_malfunction_generator, \
MalfunctionParameters
# from flatland.envs.rail_env import RailEnv
from envs.flatland.utils.gym_env_wrappers import FlatlandRenderWrapper as RailEnv
......@@ -80,11 +81,11 @@ class FlatlandSparse(FlatlandBase):
malfunction_generator = no_malfunction_generator()
if {'malfunction_rate', 'malfunction_min_duration', 'malfunction_max_duration'} <= self._config.keys():
stochastic_data = {
'malfunction_rate': self._config['malfunction_rate'],
'min_duration': self._config['malfunction_min_duration'],
'max_duration': self._config['malfunction_max_duration']
}
stochastic_data = MalfunctionParameters(
malfunction_generator=self._config['malfunction_rate'],
min_duration=self._config['malfunction_min_duration'],
max_duration=self._config['malfunction_max_duration']
)
malfunction_generator = malfunction_from_params(stochastic_data)
speed_ratio_map = None
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment