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
1d8a6479
Commit
1d8a6479
authored
5 years ago
by
Erik Nygren
Browse files
Options
Downloads
Patches
Plain Diff
updated city connection to avoid city centers
parent
5d8b904c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
examples/flatland_2_0_example.py
+2
-2
2 additions, 2 deletions
examples/flatland_2_0_example.py
flatland/core/grid/grid4_astar.py
+2
-1
2 additions, 1 deletion
flatland/core/grid/grid4_astar.py
flatland/envs/rail_generators.py
+0
-1
0 additions, 1 deletion
flatland/envs/rail_generators.py
with
4 additions
and
4 deletions
examples/flatland_2_0_example.py
+
2
−
2
View file @
1d8a6479
...
@@ -34,10 +34,10 @@ env = RailEnv(width=50,
...
@@ -34,10 +34,10 @@ env = RailEnv(width=50,
height
=
50
,
height
=
50
,
rail_generator
=
sparse_rail_generator
(
num_cities
=
9
,
# Number of cities in map (where train stations are)
rail_generator
=
sparse_rail_generator
(
num_cities
=
9
,
# Number of cities in map (where train stations are)
num_trainstations
=
50
,
# Number of possible start/targets on map
num_trainstations
=
50
,
# Number of possible start/targets on map
min_node_dist
=
8
,
# Minimal distance of nodes
min_node_dist
=
5
,
# Minimal distance of nodes
node_radius
=
3
,
# Proximity of stations to city center
node_radius
=
3
,
# Proximity of stations to city center
seed
=
15
,
# Random seed
seed
=
15
,
# Random seed
grid_mode
=
Fals
e
,
grid_mode
=
Tru
e
,
max_connection_points_per_side
=
2
,
max_connection_points_per_side
=
2
,
max_nr_connection_directions
=
4
max_nr_connection_directions
=
4
),
),
...
...
This diff is collapsed.
Click to expand it.
flatland/core/grid/grid4_astar.py
+
2
−
1
View file @
1d8a6479
...
@@ -98,10 +98,11 @@ def a_star(grid_map: GridTransitionMap,
...
@@ -98,10 +98,11 @@ def a_star(grid_map: GridTransitionMap,
# create new node
# create new node
new_node
=
AStarNode
(
node_pos
,
current_node
)
new_node
=
AStarNode
(
node_pos
,
current_node
)
# Skip paths through forbidden regions
.
# Skip paths through forbidden regions
if they are provided
if
forbidden_cells
is
not
None
:
if
forbidden_cells
is
not
None
:
if
node_pos
in
forbidden_cells
and
new_node
!=
start_node
and
new_node
!=
end_node
:
if
node_pos
in
forbidden_cells
and
new_node
!=
start_node
and
new_node
!=
end_node
:
continue
continue
children
.
append
(
new_node
)
children
.
append
(
new_node
)
# loop through children
# loop through children
...
...
This diff is collapsed.
Click to expand it.
flatland/envs/rail_generators.py
+
0
−
1
View file @
1d8a6479
...
@@ -576,7 +576,6 @@ def sparse_rail_generator(num_cities=5, num_trainstations=2, min_node_dist=20, n
...
@@ -576,7 +576,6 @@ def sparse_rail_generator(num_cities=5, num_trainstations=2, min_node_dist=20, n
node_positions
,
city_cells
=
_generate_node_positions_grid_mode
(
nb_nodes
,
height
,
width
)
node_positions
,
city_cells
=
_generate_node_positions_grid_mode
(
nb_nodes
,
height
,
width
)
else
:
else
:
node_positions
,
city_cells
=
_generate_node_positions_not_grid_mode
(
nb_nodes
,
height
,
width
)
node_positions
,
city_cells
=
_generate_node_positions_not_grid_mode
(
nb_nodes
,
height
,
width
)
print
(
city_cells
)
# reduce nb_nodes, _num_cities, _num_intersections if less were generated in not_grid_mode
# reduce nb_nodes, _num_cities, _num_intersections if less were generated in not_grid_mode
nb_nodes
=
len
(
node_positions
)
nb_nodes
=
len
(
node_positions
)
...
...
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