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
b1600440
Commit
b1600440
authored
5 years ago
by
Erik Nygren
Browse files
Options
Downloads
Patches
Plain Diff
node connection fixes
parent
bc3b52ae
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
flatland/envs/grid4_generators_utils.py
+2
-2
2 additions, 2 deletions
flatland/envs/grid4_generators_utils.py
tests/test_flatland_env_sparse_rail_generator.py
+4
-1
4 additions, 1 deletion
tests/test_flatland_env_sparse_rail_generator.py
with
6 additions
and
3 deletions
flatland/envs/grid4_generators_utils.py
+
2
−
2
View file @
b1600440
...
...
@@ -125,7 +125,7 @@ def connect_from_nodes(rail_trans, rail_array, start, end):
if
new_trans
==
0
:
# end-point
# need to flip direction because of how end points are defined
new_trans
=
rail_trans
.
set_transition
(
new_trans
,
current_dir
,
new_dir
,
1
)
new_trans
=
0
else
:
# into existing rail
new_trans
=
rail_trans
.
set_transition
(
new_trans
,
current_dir
,
new_dir
,
1
)
...
...
@@ -187,7 +187,7 @@ def connect_to_nodes(rail_trans, rail_array, start, end):
new_trans_e
=
rail_array
[
end_pos
]
if
new_trans_e
==
0
:
# end-point
new_trans_e
=
rail_trans
.
set_transition
(
new_trans_e
,
new_dir
,
new_dir
,
1
)
new_trans_e
=
0
else
:
# into existing rail
new_trans_e
=
rail_trans
.
set_transition
(
new_trans_e
,
new_dir
,
new_dir
,
1
)
...
...
This diff is collapsed.
Click to expand it.
tests/test_flatland_env_sparse_rail_generator.py
+
4
−
1
View file @
b1600440
import
time
import
numpy
as
np
from
flatland.envs.generators
import
sparse_rail_generator
,
realistic_rail_generator
...
...
@@ -31,8 +33,9 @@ def test_sparse_rail_generator():
num_neighb
=
2
,
# Number of connections to other cities
seed
=
5
,
# Random seed
),
number_of_agents
=
1
0
,
number_of_agents
=
1
,
obs_builder_object
=
GlobalObsForRailEnv
())
# reset to initialize agents_static
env_renderer
=
RenderTool
(
env
,
gl
=
"
PILSVG
"
,
)
env_renderer
.
render_env
(
show
=
True
,
show_observations
=
True
,
show_predictions
=
False
)
time
.
sleep
(
2
)
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