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
31a8ef11
Commit
31a8ef11
authored
5 years ago
by
Erik Nygren
Browse files
Options
Downloads
Patches
Plain Diff
randomized through path found
parent
3c12890c
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
flatland/envs/rail_generators.py
+5
-3
5 additions, 3 deletions
flatland/envs/rail_generators.py
with
5 additions
and
3 deletions
flatland/envs/rail_generators.py
+
5
−
3
View file @
31a8ef11
...
...
@@ -768,13 +768,15 @@ def sparse_rail_generator(num_cities=5, grid_mode=False, max_inter_city_rails=4,
for
current_city
in
range
(
len
(
node_positions
)):
all_outer_connection_points
=
[
item
for
sublist
in
outer_connection_points
[
current_city
]
for
item
in
sublist
]
city_boarder
=
_city_boarder
(
node_positions
[
current_city
],
node_radius
)
for
boarder
in
range
(
4
):
random_boarders
=
np
.
random
.
choice
(
np
.
arange
(
4
),
4
,
False
)
# TODO: Only look at the relevant boarders (Only two at the moment)
for
boarder
in
random_boarders
:
for
source
in
inner_connection_points
[
current_city
][
boarder
]:
for
other_boarder
in
ran
ge
(
4
)
:
for
other_boarder
in
ran
dom_boarders
:
if
boarder
!=
other_boarder
and
len
(
inner_connection_points
[
current_city
][
other_boarder
])
>
0
:
for
target
in
inner_connection_points
[
current_city
][
other_boarder
]:
city_boarder
=
_city_boarder
(
node_positions
[
current_city
],
node_radius
)
current_track
=
connect_cities
(
rail_trans
,
grid_map
,
source
,
target
,
city_boarder
)
if
target
in
all_outer_connection_points
and
source
in
\
all_outer_connection_points
and
len
(
through_path_cells
[
current_city
])
<
1
:
...
...
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