Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Flatland
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
yoogottamk
Flatland
Commits
72c69df1
Commit
72c69df1
authored
5 years ago
by
Erik Nygren
Browse files
Options
Downloads
Patches
Plain Diff
minor test in navigation training
parent
c93115d5
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
examples/training_navigation.py
+8
-4
8 additions, 4 deletions
examples/training_navigation.py
flatland/envs/generators.py
+1
-1
1 addition, 1 deletion
flatland/envs/generators.py
with
9 additions
and
5 deletions
examples/training_navigation.py
+
8
−
4
View file @
72c69df1
...
...
@@ -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
1
5
,
# 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
=
Tru
e
demo
=
Fals
e
def
max_lt
(
seq
,
val
):
...
...
This diff is collapsed.
Click to expand it.
flatland/envs/generators.py
+
1
−
1
View file @
72c69df1
...
...
@@ -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_
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment