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
f5e750a2
Commit
f5e750a2
authored
5 years ago
by
Erik Nygren
Browse files
Options
Downloads
Patches
Plain Diff
more parameters more problems ;)
parent
ce5dc1a6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
examples/flatland_2_0_example.py
+2
-1
2 additions, 1 deletion
examples/flatland_2_0_example.py
flatland/envs/rail_generators.py
+5
-5
5 additions, 5 deletions
flatland/envs/rail_generators.py
with
7 additions
and
6 deletions
examples/flatland_2_0_example.py
+
2
−
1
View file @
f5e750a2
...
@@ -40,7 +40,8 @@ env = RailEnv(width=50,
...
@@ -40,7 +40,8 @@ env = RailEnv(width=50,
num_neighb
=
3
,
# Number of connections to other cities/intersections
num_neighb
=
3
,
# Number of connections to other cities/intersections
seed
=
15
,
# Random seed
seed
=
15
,
# Random seed
grid_mode
=
True
,
grid_mode
=
True
,
enhance_intersection
=
False
nr_inter_connections
=
1
,
max_nr_connection_points
=
8
),
),
schedule_generator
=
sparse_schedule_generator
(),
schedule_generator
=
sparse_schedule_generator
(),
number_of_agents
=
50
,
number_of_agents
=
50
,
...
...
This diff is collapsed.
Click to expand it.
flatland/envs/rail_generators.py
+
5
−
5
View file @
f5e750a2
...
@@ -529,7 +529,7 @@ def random_rail_generator(cell_type_relative_proportion=[1.0] * 11) -> RailGener
...
@@ -529,7 +529,7 @@ def random_rail_generator(cell_type_relative_proportion=[1.0] * 11) -> RailGener
def
sparse_rail_generator
(
num_cities
=
5
,
num_intersections
=
4
,
num_trainstations
=
2
,
min_node_dist
=
20
,
node_radius
=
2
,
def
sparse_rail_generator
(
num_cities
=
5
,
num_intersections
=
4
,
num_trainstations
=
2
,
min_node_dist
=
20
,
node_radius
=
2
,
num_neighb
=
3
,
nr_inter_connections
=
2
,
grid_mode
=
False
,
enhance_intersection
=
False
,
num_neighb
=
3
,
nr_inter_connections
=
2
,
grid_mode
=
False
,
max_nr_connection_points
=
4
,
seed
=
0
)
->
RailGenerator
:
seed
=
0
)
->
RailGenerator
:
"""
"""
This is a level generator which generates complex sparse rail configurations
This is a level generator which generates complex sparse rail configurations
...
@@ -598,7 +598,7 @@ def sparse_rail_generator(num_cities=5, num_intersections=4, num_trainstations=2
...
@@ -598,7 +598,7 @@ def sparse_rail_generator(num_cities=5, num_intersections=4, num_trainstations=2
available_nodes
=
np
.
arange
(
nb_nodes
)
available_nodes
=
np
.
arange
(
nb_nodes
)
# Set up connection points for all cities
# Set up connection points for all cities
connection_points
=
_generate_node_connection_points
(
node_positions
,
node_radius
,
max_nr_connection_points
=
8
)
connection_points
=
_generate_node_connection_points
(
node_positions
,
node_radius
,
max_nr_connection_points
)
# Start at some node
# Start at some node
current_node
=
np
.
random
.
randint
(
len
(
available_nodes
))
current_node
=
np
.
random
.
randint
(
len
(
available_nodes
))
...
@@ -745,9 +745,9 @@ def sparse_rail_generator(num_cities=5, num_intersections=4, num_trainstations=2
...
@@ -745,9 +745,9 @@ def sparse_rail_generator(num_cities=5, num_intersections=4, num_trainstations=2
if
len
(
conn
)
>
0
:
if
len
(
conn
)
>
0
:
to_be_deleted
.
append
(
disjunct_node
)
to_be_deleted
.
append
(
disjunct_node
)
for
tbd
in
to_be_deleted
:
for
tbd
in
to_be_deleted
:
boarder_connections
.
remove
(
tbd
)
boarder_connections
.
remove
(
tbd
)
print
(
boarder_connections
)
print
(
boarder_connections
)
# Fix all nodes with illegal transition maps
# Fix all nodes with illegal transition maps
flat_trainstation_list
=
[
item
for
sublist
in
train_stations
for
item
in
sublist
]
flat_trainstation_list
=
[
item
for
sublist
in
train_stations
for
item
in
sublist
]
for
cell_to_fix
in
flat_trainstation_list
:
for
cell_to_fix
in
flat_trainstation_list
:
...
...
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