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
cb1980f8
Commit
cb1980f8
authored
5 years ago
by
Erik Nygren
Browse files
Options
Downloads
Patches
Plain Diff
added safety breaks in loops to prevent infinite loops.
parent
5a867edf
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
flatland/envs/generators.py
+16
-9
16 additions, 9 deletions
flatland/envs/generators.py
with
16 additions
and
9 deletions
flatland/envs/generators.py
+
16
−
9
View file @
cb1980f8
...
...
@@ -932,18 +932,25 @@ def realistic_rail_generator(nr_start_goal=1, seed=0, add_max_dead_end=4, two_tr
return
generator
def
sparse_rail_generator
(
num_cities
=
100
,
num_intersections
=
10
,
num_trainstations
=
2
,
min_node_dist
=
20
,
node_radius
=
2
,
num_neighb
=
4
,
realistic_mode
=
False
,
enhance_intersection
=
False
,
seed
=
0
):
def
sparse_rail_generator
(
num_cities
=
5
,
num_intersections
=
4
,
num_trainstations
=
2
,
min_node_dist
=
20
,
node_radius
=
2
,
num_neighb
=
3
,
realistic_mode
=
False
,
enhance_intersection
=
False
,
seed
=
0
):
'''
:param nr_train_stations:
:param num_cities:
:param mean_node_neighbours:
:param min_node_dist:
:param seed:
This is a level generator which generates complex sparse rail configurations
:param num_cities: Number of city node (can hold trainstations)
:param num_intersections: Number of intersection that city nodes can connect to
:param num_trainstations: Total number of trainstations in env
:param min_node_dist: Minimal distance between nodes
:param node_radius: Proximity of trainstations to center of city node
:param num_neighb: Number of neighbouring nodes each node connects to
:param realistic_mode: True -> NOdes evenly distirbuted in env, False-> Random distribution of nodes
:param enhance_intersection: True -> Extra rail elements added at intersections
:param seed: Random Seed
:return:
-------
numpy.ndarray of type numpy.uint16
The matrix with the correct 16-bit bitmaps for each cell.
'''
def
generator
(
width
,
height
,
num_agents
,
num_resets
=
0
):
if
num_agents
>
num_trainstations
:
...
...
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