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
af698037
Commit
af698037
authored
5 years ago
by
Erik Nygren
Browse files
Options
Downloads
Patches
Plain Diff
minor bugfixes and added TODO for observation speed up
parent
a355b142
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
examples/training_navigation.py
+3
-2
3 additions, 2 deletions
examples/training_navigation.py
flatland/core/env_observation_builder.py
+1
-1
1 addition, 1 deletion
flatland/core/env_observation_builder.py
with
4 additions
and
3 deletions
examples/training_navigation.py
+
3
−
2
View file @
af698037
...
@@ -109,9 +109,10 @@ for trials in range(1, n_trials + 1):
...
@@ -109,9 +109,10 @@ for trials in range(1, n_trials + 1):
for
a
in
range
(
env
.
number_of_agents
):
for
a
in
range
(
env
.
number_of_agents
):
if
demo
:
if
demo
:
eps
=
0
eps
=
0
action
=
2
#
agent.act(np.array(obs[a]), eps=eps)
action
=
agent
.
act
(
np
.
array
(
obs
[
a
]),
eps
=
eps
)
action_prob
[
action
]
+=
1
action_prob
[
action
]
+=
1
action_dict
.
update
({
a
:
action
})
action_dict
.
update
({
a
:
action
})
env
.
obs_builder
.
util_print_obs_subtree
(
tree
=
obs
[
a
],
num_features_per_node
=
5
)
# Environment step
# Environment step
next_obs
,
all_rewards
,
done
,
_
=
env
.
step
(
action_dict
)
next_obs
,
all_rewards
,
done
,
_
=
env
.
step
(
action_dict
)
for
a
in
range
(
env
.
number_of_agents
):
for
a
in
range
(
env
.
number_of_agents
):
...
@@ -126,7 +127,7 @@ for trials in range(1, n_trials + 1):
...
@@ -126,7 +127,7 @@ for trials in range(1, n_trials + 1):
if
done
[
'
__all__
'
]:
if
done
[
'
__all__
'
]:
env_done
=
1
env_done
=
1
break
break
# Epsi
o
ln decay
# Epsil
o
n decay
eps
=
max
(
eps_end
,
eps_decay
*
eps
)
# decrease epsilon
eps
=
max
(
eps_end
,
eps_decay
*
eps
)
# decrease epsilon
done_window
.
append
(
env_done
)
done_window
.
append
(
env_done
)
...
...
This diff is collapsed.
Click to expand it.
flatland/core/env_observation_builder.py
+
1
−
1
View file @
af698037
...
@@ -326,7 +326,7 @@ class TreeObsForRailEnv(ObservationBuilder):
...
@@ -326,7 +326,7 @@ class TreeObsForRailEnv(ObservationBuilder):
if
not
last_isDeadEnd
:
if
not
last_isDeadEnd
:
# Keep walking through the tree along `direction'
# Keep walking through the tree along `direction'
exploring
=
True
exploring
=
True
# TODO: Remove below calculation, this is computed already above and could be reused
for
i
in
range
(
4
):
for
i
in
range
(
4
):
if
cell_transitions
[
i
]:
if
cell_transitions
[
i
]:
position
=
self
.
_new_position
(
position
,
i
)
position
=
self
.
_new_position
(
position
,
i
)
...
...
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