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
35cbfa77
Commit
35cbfa77
authored
5 years ago
by
Erik Nygren
Browse files
Options
Downloads
Patches
Plain Diff
backwards compatibility with complex rail generator
parent
af5ed987
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
examples/training_example.py
+1
-1
1 addition, 1 deletion
examples/training_example.py
flatland/envs/grid4_generators_utils.py
+1
-1
1 addition, 1 deletion
flatland/envs/grid4_generators_utils.py
flatland/envs/rail_generators.py
+5
-2
5 additions, 2 deletions
flatland/envs/rail_generators.py
with
7 additions
and
4 deletions
examples/training_example.py
+
1
−
1
View file @
35cbfa77
...
...
@@ -16,7 +16,7 @@ TreeObservation = TreeObsForRailEnv(max_depth=2, predictor=ShortestPathPredictor
LocalGridObs
=
LocalObsForRailEnv
(
view_height
=
10
,
view_width
=
2
,
center
=
2
)
env
=
RailEnv
(
width
=
20
,
height
=
20
,
rail_generator
=
complex_rail_generator
(
nr_start_goal
=
10
,
nr_extra
=
1
,
min_dist
=
8
,
max_dist
=
99999
,
seed
=
0
),
rail_generator
=
complex_rail_generator
(
nr_start_goal
=
10
,
nr_extra
=
2
,
min_dist
=
8
,
max_dist
=
99999
,
seed
=
0
),
schedule_generator
=
complex_schedule_generator
(),
obs_builder_object
=
TreeObservation
,
number_of_agents
=
3
)
...
...
This diff is collapsed.
Click to expand it.
flatland/envs/grid4_generators_utils.py
+
1
−
1
View file @
35cbfa77
...
...
@@ -19,10 +19,10 @@ def connect_rail(
grid_map
:
GridTransitionMap
,
start
:
IntVector2D
,
end
:
IntVector2D
,
a_star_distance_function
:
IntVector2DDistance
=
Vec2d
.
get_manhattan_distance
,
flip_start_node_trans
=
False
,
flip_end_node_trans
=
False
,
nice
=
True
,
a_star_distance_function
:
IntVector2DDistance
=
Vec2d
.
get_manhattan_distance
,
forbidden_cells
=
None
)
->
IntVector2DArray
:
"""
...
...
This diff is collapsed.
Click to expand it.
flatland/envs/rail_generators.py
+
5
−
2
View file @
35cbfa77
...
...
@@ -7,6 +7,7 @@ import numpy as np
from
flatland.core.grid.grid4
import
Grid4TransitionsEnum
from
flatland.core.grid.grid4_utils
import
get_direction
,
mirror
from
flatland.core.grid.grid_utils
import
Vec2dOperations
as
Vec2d
from
flatland.core.grid.grid_utils
import
distance_on_rail
,
direction_to_city
,
IntVector2DArray
,
IntVector2D
,
\
Vec2dOperations
from
flatland.core.grid.rail_env_grid
import
RailEnvTransitions
...
...
@@ -125,7 +126,8 @@ def complex_rail_generator(nr_start_goal=1,
# we might as well give up at this point
break
new_path
=
connect_rail
(
rail_trans
,
grid_map
,
start
,
goal
,
flip_start_node_trans
=
True
,
new_path
=
connect_rail
(
rail_trans
,
grid_map
,
start
,
goal
,
Vec2d
.
get_chebyshev_distance
,
flip_start_node_trans
=
True
,
flip_end_node_trans
=
True
,
nice
=
True
,
forbidden_cells
=
None
)
if
len
(
new_path
)
>=
2
:
...
...
@@ -152,7 +154,8 @@ def complex_rail_generator(nr_start_goal=1,
break
if
not
all_ok
:
break
new_path
=
connect_rail
(
rail_trans
,
grid_map
,
start
,
goal
,
flip_start_node_trans
=
True
,
new_path
=
connect_rail
(
rail_trans
,
grid_map
,
start
,
goal
,
Vec2d
.
get_chebyshev_distance
,
flip_start_node_trans
=
True
,
flip_end_node_trans
=
True
,
nice
=
True
,
forbidden_cells
=
None
)
...
...
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