Skip to content
Snippets Groups Projects
Commit 8dd6a225 authored by Erik Nygren's avatar Erik Nygren
Browse files

minor updates to example

parent 96f38175
No related branches found
No related tags found
No related merge requests found
...@@ -13,33 +13,35 @@ np.random.seed(1) ...@@ -13,33 +13,35 @@ np.random.seed(1)
# 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 # Use a the malfunction generator to break agents from time to time
stochastic_data = {'prop_malfunction': 0.0, # Percentage of defective agents stochastic_data = {'prop_malfunction': 0.1, # Percentage of defective agents
'malfunction_rate': 30, # Rate of malfunction occurence 'malfunction_rate': 30, # Rate of malfunction occurence
'min_duration': 3, # Minimal duration of malfunction 'min_duration': 3, # Minimal duration of malfunction
'max_duration': 10 # Max duration of malfunction 'max_duration': 20 # Max duration of malfunction
} }
# Custom observation builder
TreeObservation = TreeObsForRailEnv(max_depth=2, predictor=ShortestPathPredictorForRailEnv()) TreeObservation = TreeObsForRailEnv(max_depth=2, predictor=ShortestPathPredictorForRailEnv())
speed_ration_map = {1.: 0.1, # Fast passenger train # Different agent types (trains) with different speeds.
0.5: 0.2, # Slow commuter train speed_ration_map = {1.: 0.25, # Fast passenger train
0.25: 0.2, # Fast freight train 1. / 2.: 0.25, # Slow commuter train
0.125: 0.5} # Slow freight train 1. / 3.: 0.25, # Fast freight train
1. / 4.: 0.25} # Slow freight train
env = RailEnv(width=50, env = RailEnv(width=50,
height=50, height=50,
rail_generator=sparse_rail_generator(num_cities=10, # Number of cities in map (where train stations are) rail_generator=sparse_rail_generator(num_cities=10, # Number of cities in map (where train stations are)
num_intersections=5, # Number of intersections (no start / target) num_intersections=15, # Number of intersections (no start / target)
num_trainstations=15, # Number of possible start/targets on map num_trainstations=50, # Number of possible start/targets on map
min_node_dist=3, # Minimal distance of nodes min_node_dist=3, # Minimal distance of nodes
node_radius=3, # Proximity of stations to city center node_radius=3, # Proximity of stations to city center
num_neighb=2, # Number of connections to other cities/intersections num_neighb=3, # Number of connections to other cities/intersections
seed=15, # Random seed seed=15, # Random seed
realistic_mode=True, realistic_mode=True,
enhance_intersection=True enhance_intersection=True
), ),
schedule_generator=sparse_schedule_generator(speed_ration_map), schedule_generator=sparse_schedule_generator(speed_ration_map),
number_of_agents=5, number_of_agents=20,
stochastic_data=stochastic_data, # Malfunction data generator stochastic_data=stochastic_data, # Malfunction data generator
obs_builder_object=TreeObservation) obs_builder_object=TreeObservation)
......
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