Skip to content
Snippets Groups Projects
Commit abc1ac6e authored by Erik Nygren's avatar Erik Nygren :bullettrain_front:
Browse files

merged stochastic breaking branch for testing.

parent 3ee1556c
No related branches found
No related tags found
No related merge requests found
...@@ -11,6 +11,13 @@ np.random.seed(1) ...@@ -11,6 +11,13 @@ np.random.seed(1)
# Use the complex_rail_generator to generate feasible network configurations with corresponding tasks # Use the complex_rail_generator to generate feasible network configurations with corresponding tasks
# Training on simple small tasks is the best way to get familiar with the environment # Training on simple small tasks is the best way to get familiar with the environment
# Use a the malfunction generator to break agents from time to time
stochastic_data = {'prop_malfunction': 0.5,
'malfunction_rate': 30,
'min_duration': 3,
'max_duration': 10}
TreeObservation = TreeObsForRailEnv(max_depth=2, predictor=ShortestPathPredictorForRailEnv()) TreeObservation = TreeObsForRailEnv(max_depth=2, predictor=ShortestPathPredictorForRailEnv())
env = RailEnv(width=50, env = RailEnv(width=50,
height=50, height=50,
...@@ -23,6 +30,7 @@ env = RailEnv(width=50, ...@@ -23,6 +30,7 @@ env = RailEnv(width=50,
seed=15, # Random seed seed=15, # Random seed
), ),
number_of_agents=35, number_of_agents=35,
stochastic_data=stochastic_data, # Malfunction generator data
obs_builder_object=TreeObservation) obs_builder_object=TreeObservation)
env_renderer = RenderTool(env, gl="PILSVG", ) env_renderer = RenderTool(env, gl="PILSVG", )
...@@ -64,6 +72,7 @@ class RandomAgent: ...@@ -64,6 +72,7 @@ class RandomAgent:
# Initialize the agent with the parameters corresponding to the environment and observation_builder # Initialize the agent with the parameters corresponding to the environment and observation_builder
# Set action space to 4 to remove stop action
agent = RandomAgent(218, 4) agent = RandomAgent(218, 4)
n_trials = 5 n_trials = 5
......
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