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
1ffa1266
Commit
1ffa1266
authored
May 01, 2019
by
Erik Nygren
Browse files
Bug fixing in curve detection. Still an issue with nbits in curve detection
parent
e8ba8172
Pipeline
#465
failed with stage
in 1 minute and 51 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
examples/training_navigation.py
View file @
1ffa1266
...
...
@@ -30,13 +30,13 @@ env = RailEnv(width=20,
rail_generator=complex_rail_generator(nr_start_goal=20, min_dist=10, max_dist=99999, seed=0),
number_of_agents=5)
"""
env
=
RailEnv
(
width
=
20
,
height
=
20
,
rail_generator
=
rail_from_list_of_saved_GridTransitionMap_generator
(
[
'../env-data/tests/circle.npy'
]),
number_of_agents
=
1
)
"""
env_renderer
=
RenderTool
(
env
,
gl
=
"QT"
)
handle
=
env
.
get_agent_handles
()
...
...
@@ -109,7 +109,7 @@ for trials in range(1, n_trials + 1):
for
a
in
range
(
env
.
number_of_agents
):
if
demo
:
eps
=
0
action
=
agent
.
act
(
np
.
array
(
obs
[
a
]),
eps
=
eps
)
action
=
2
#
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)
...
...
flatland/envs/rail_env.py
View file @
1ffa1266
...
...
@@ -1024,17 +1024,17 @@ class RailEnv(Environment):
while
tmp
>
0
:
nbits
+=
(
tmp
&
1
)
tmp
=
tmp
>>
1
print
(
nbits
)
movement
=
direction
if
action
==
1
:
movement
=
direction
-
1
if
nbits
<=
2
:
transition_isValid
=
=
False
transition_isValid
=
False
elif
action
==
3
:
movement
=
direction
+
1
if
nbits
<=
2
:
transition_isValid
=
=
False
transition_isValid
=
False
if
movement
<
0
:
movement
+=
4
if
movement
>=
4
:
...
...
@@ -1080,6 +1080,7 @@ class RailEnv(Environment):
movement
=
curv_dir
curv_dir
=
(
curv_dir
+
1
)
%
4
new_position
=
self
.
_new_position
(
pos
,
movement
)
# Is it a legal move? 1) transition allows the movement in the
# cell, 2) the new cell is not empty (case 0), 3) the cell is
...
...
notebooks/CanvasEditor.ipynb
View file @
1ffa1266
...
...
@@ -310,7 +310,7 @@
{
"data"
:
{
"application/vnd.jupyter.widget-view+json"
:
{
"model_id"
:
"
fbe86fd356b949c3846636fbdfe839f9
"
,
"model_id"
:
"
b9dd949deac8442e861062288de2645e
"
,
"version_major"
:
2
,
"version_minor"
:
0
},
...
...
@@ -359,12 +359,12 @@
{
"data"
:
{
"application/vnd.jupyter.widget-view+json"
:
{
"model_id"
:
"
fb76bfd340e34fe8be29569d5c41786a
"
,
"model_id"
:
"
12cc530aba7e471f9c79001b23d64c8d
"
,
"version_major"
:
2
,
"version_minor"
:
0
},
"text/plain"
:
[
"Output(
outputs=({'output_type': 'stream', 'text':
\"
filename = C:/Users/u224870/Projekte_Git/flatland/env-data…
"
"Output(
)
"
]
},
"metadata"
:
{},
...
...
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