Commit 72c69df1 authored by Erik Nygren's avatar Erik Nygren
Browse files

minor test in navigation training

parent c93115d5
Pipeline #483 passed with stage
in 2 minutes and 41 seconds
......@@ -12,19 +12,23 @@ np.random.seed(1)
# Example generate a rail given a manual specification,
# a map of tuples (cell_type, rotation)
transition_probability = [5, # empty cell - Case 0
15, # Case 1 - straight
1, # Case 1 - straight
5, # Case 2 - simple switch
1, # Case 3 - diamond crossing
1, # Case 4 - single slip
1, # Case 5 - double slip
1, # Case 6 - symmetrical
0] # Case 7 - dead end
0, # Case 7 - dead end
15, # Case 1b (8) - simple turn right
15, # Case 1c (9) - simple turn left
15] # Case 2b (10) - simple switch mirrored
# Example generate a random rail
env = RailEnv(width=10,
height=10,
rail_generator=random_rail_generator(cell_type_relative_proportion=transition_probability),
number_of_agents=1)
number_of_agents=3)
"""
env = RailEnv(width=20,
height=20,
......@@ -57,7 +61,7 @@ action_prob = [0] * 4
agent = Agent(state_size, action_size, "FC", 0)
agent.qnetwork_local.load_state_dict(torch.load('../flatland/baselines/Nets/avoid_checkpoint14900.pth'))
demo = True
demo = False
def max_lt(seq, val):
......
......@@ -250,7 +250,7 @@ def random_rail_generator(cell_type_relative_proportion=[1.0] * 8):
transitions_templates_ = []
transition_probabilities = []
for i in range(len(t_utils.transitions) - 4): # don't include dead-ends
for i in range(len(t_utils.transitions)-4): # don't include dead-ends
all_transitions = 0
for dir_ in range(4):
trans = t_utils.get_transitions(t_utils.transitions[i], dir_)
......
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