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
df2c483d
Commit
df2c483d
authored
5 years ago
by
Erik Nygren
Browse files
Options
Downloads
Patches
Plain Diff
updated the way connected directions are chosen.
parent
80d4a184
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
+12
-3
12 additions, 3 deletions
flatland/envs/rail_generators.py
with
12 additions
and
3 deletions
flatland/envs/rail_generators.py
+
12
−
3
View file @
df2c483d
...
...
@@ -688,6 +688,7 @@ def sparse_rail_generator(num_cities=5, num_trainstations=2, min_node_dist=20, n
max_nr_connection_points
=
2
*
node_size
+
1
for
node_position
in
node_positions
:
# Chose the directions where close cities are situated
neighb_dist
=
[]
for
neighb_node
in
node_positions
:
...
...
@@ -696,9 +697,17 @@ def sparse_rail_generator(num_cities=5, num_trainstations=2, min_node_dist=20, n
# Store the directions to these neighbours
connection_sides_idx
=
[]
for
idx
in
range
(
1
,
min
(
len
(
neighb_dist
)
-
1
,
max_nr_connection_directions
)
+
1
):
connection_sides_idx
.
append
(
closest_direction
(
node_position
,
node_positions
[
closest_neighb_idx
[
idx
]]))
idx
=
1
# TODO: Change the way this code works! Check that we get sufficient direction.
# TODO: Check if this works as expected
while
len
(
connection_sides_idx
)
<
max_nr_connection_directions
and
idx
<
len
(
neighb_dist
):
if
closest_direction
(
node_position
,
node_positions
[
closest_neighb_idx
[
idx
]])
not
in
connection_sides_idx
:
connection_sides_idx
.
append
(
closest_direction
(
node_position
,
node_positions
[
closest_neighb_idx
[
idx
]]))
idx
+=
1
else
:
idx
+=
1
# set the number of connection points for each direction
connections_per_direction
=
np
.
zeros
(
4
,
dtype
=
int
)
...
...
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