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
sfwatergit
Flatland
Commits
8cec2335
Commit
8cec2335
authored
5 years ago
by
Erik Nygren
Browse files
Options
Downloads
Patches
Plain Diff
updated action behavior at curve. deviation left and right not allowed at curve
parent
482a73e5
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/training_navigation.py
+1
-1
1 addition, 1 deletion
examples/training_navigation.py
flatland/core/env_observation_builder.py
+1
-1
1 addition, 1 deletion
flatland/core/env_observation_builder.py
flatland/envs/rail_env.py
+10
-5
10 additions, 5 deletions
flatland/envs/rail_env.py
with
12 additions
and
7 deletions
examples/training_navigation.py
+
1
−
1
View file @
8cec2335
...
...
@@ -112,7 +112,7 @@ for trials in range(1, n_trials + 1):
action
=
agent
.
act
(
np
.
array
(
obs
[
a
]),
eps
=
eps
)
action_prob
[
action
]
+=
1
action_dict
.
update
({
a
:
action
})
env
.
obs_builder
.
util_print_obs_subtree
(
tree
=
obs
[
a
],
num_features_per_node
=
5
)
#
env.obs_builder.util_print_obs_subtree(tree=obs[a], num_features_per_node=5)
# Environment step
next_obs
,
all_rewards
,
done
,
_
=
env
.
step
(
action_dict
)
for
a
in
range
(
env
.
number_of_agents
):
...
...
This diff is collapsed.
Click to expand it.
flatland/core/env_observation_builder.py
+
1
−
1
View file @
8cec2335
...
...
@@ -340,7 +340,7 @@ class TreeObsForRailEnv(ObservationBuilder):
elif
num_transitions
==
0
:
# Wrong cell type, but let's cover it and treat it as a dead-end, just in case
print
(
"
WRONG CELL TYPE detected in tree-search (0 transitions possible)
"
)
print
(
"
WRONG CELL TYPE detected in tree-search (0 transitions possible)
at cell
"
,
position
[
0
],
position
[
1
]
)
last_isTerminal
=
True
break
...
...
This diff is collapsed.
Click to expand it.
flatland/envs/rail_env.py
+
10
−
5
View file @
8cec2335
...
...
@@ -998,7 +998,7 @@ class RailEnv(Environment):
for
i
in
range
(
len
(
self
.
agents_handles
)):
handle
=
self
.
agents_handles
[
i
]
transition_isValid
=
None
if
handle
not
in
action_dict
:
continue
...
...
@@ -1027,9 +1027,13 @@ class RailEnv(Environment):
movement
=
direction
if
action
==
1
:
movement
=
direction
-
1
if
nbits
<=
2
:
transition_isValid
==
False
elif
action
==
3
:
movement
=
direction
+
1
if
nbits
<=
2
:
transition_isValid
==
False
if
movement
<
0
:
movement
+=
4
if
movement
>=
4
:
...
...
@@ -1089,9 +1093,10 @@ class RailEnv(Environment):
else
:
new_cell_isValid
=
False
transition_isValid
=
self
.
rail
.
get_transition
(
(
pos
[
0
],
pos
[
1
],
direction
),
movement
)
or
is_deadend
if
transition_isValid
==
None
:
transition_isValid
=
self
.
rail
.
get_transition
(
(
pos
[
0
],
pos
[
1
],
direction
),
movement
)
or
is_deadend
cell_isFree
=
True
for
j
in
range
(
self
.
number_of_agents
):
...
...
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