Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Flatland
Flatland
Commits
8cec2335
Commit
8cec2335
authored
May 01, 2019
by
Erik Nygren
Browse files
updated action behavior at curve. deviation left and right not allowed at curve
parent
482a73e5
Pipeline
#459
failed with stage
in 1 minute and 52 seconds
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
examples/training_navigation.py
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
):
...
...
flatland/core/env_observation_builder.py
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
...
...
flatland/envs/rail_env.py
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,6 +1093,7 @@ class RailEnv(Environment):
else
:
new_cell_isValid
=
False
if
transition_isValid
==
None
:
transition_isValid
=
self
.
rail
.
get_transition
(
(
pos
[
0
],
pos
[
1
],
direction
),
movement
)
or
is_deadend
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment