From abc1ac6e7a8b18ac14f860de2ce0f326f9e721c6 Mon Sep 17 00:00:00 2001 From: MLErik <baerenjesus@gmail.com> Date: Sat, 17 Aug 2019 11:38:36 -0400 Subject: [PATCH] merged stochastic breaking branch for testing. --- examples/flatland_2_0_example.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/examples/flatland_2_0_example.py b/examples/flatland_2_0_example.py index 1b480a35..1d79de01 100644 --- a/examples/flatland_2_0_example.py +++ b/examples/flatland_2_0_example.py @@ -11,6 +11,13 @@ np.random.seed(1) # 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 +# 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()) env = RailEnv(width=50, height=50, @@ -23,6 +30,7 @@ env = RailEnv(width=50, seed=15, # Random seed ), number_of_agents=35, + stochastic_data=stochastic_data, # Malfunction generator data obs_builder_object=TreeObservation) env_renderer = RenderTool(env, gl="PILSVG", ) @@ -64,6 +72,7 @@ class RandomAgent: # 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) n_trials = 5 -- GitLab