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
sfwatergit
Flatland
Commits
8e3d61a9
Commit
8e3d61a9
authored
5 years ago
by
spiglerg
Browse files
Options
Downloads
Patches
Plain Diff
random generator with turns
parent
e2c3a494
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/temporary_example.py
+5
-1
5 additions, 1 deletion
examples/temporary_example.py
flatland/envs/generators.py
+5
-2
5 additions, 2 deletions
flatland/envs/generators.py
with
10 additions
and
3 deletions
examples/temporary_example.py
+
5
−
1
View file @
8e3d61a9
...
@@ -17,7 +17,11 @@ transition_probability = [1.0, # empty cell - Case 0
...
@@ -17,7 +17,11 @@ transition_probability = [1.0, # empty cell - Case 0
0.5
,
# Case 4 - single slip
0.5
,
# Case 4 - single slip
0.5
,
# Case 5 - double slip
0.5
,
# Case 5 - double slip
0.2
,
# Case 6 - symmetrical
0.2
,
# Case 6 - symmetrical
0.0
]
# Case 7 - dead end
0.0
,
# Case 7 - dead end
0.2
,
# Case 8 - turn left
0.2
,
# Case 9 - turn right
1.0
]
# Case 10 - mirrored switch
"""
"""
# Example generate a random rail
# Example generate a random rail
env = RailEnv(width=20,
env = RailEnv(width=20,
...
...
This diff is collapsed.
Click to expand it.
flatland/envs/generators.py
+
5
−
2
View file @
8e3d61a9
...
@@ -227,7 +227,7 @@ def generate_rail_from_list_of_manual_specifications(list_of_specifications)
...
@@ -227,7 +227,7 @@ def generate_rail_from_list_of_manual_specifications(list_of_specifications)
"""
"""
def
random_rail_generator
(
cell_type_relative_proportion
=
[
1.0
]
*
8
):
def
random_rail_generator
(
cell_type_relative_proportion
=
[
1.0
]
*
11
):
"""
"""
Dummy random level generator:
Dummy random level generator:
- fill in cells at random in [width-2, height-2]
- fill in cells at random in [width-2, height-2]
...
@@ -266,7 +266,10 @@ def random_rail_generator(cell_type_relative_proportion=[1.0] * 8):
...
@@ -266,7 +266,10 @@ def random_rail_generator(cell_type_relative_proportion=[1.0] * 8):
transitions_templates_
=
[]
transitions_templates_
=
[]
transition_probabilities
=
[]
transition_probabilities
=
[]
for
i
in
range
(
len
(
t_utils
.
transitions
)
-
4
):
# don't include dead-ends
for
i
in
range
(
len
(
t_utils
.
transitions
)):
# don't include dead-ends
if
t_utils
.
transitions
[
i
]
==
int
(
'
0010000000000000
'
,
2
):
continue
all_transitions
=
0
all_transitions
=
0
for
dir_
in
range
(
4
):
for
dir_
in
range
(
4
):
trans
=
t_utils
.
get_transitions
(
t_utils
.
transitions
[
i
],
dir_
)
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