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
Package Registry
Model registry
Operate
Environments
Terraform modules
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
elrichgro
Flatland
Commits
ce24706b
Commit
ce24706b
authored
5 years ago
by
Erik Nygren
Browse files
Options
Downloads
Patches
Plain Diff
included warning message if predictor or observation builder does not provide cells to render.
parent
525f1464
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
examples/training_example.py
+1
-1
1 addition, 1 deletion
examples/training_example.py
flatland/envs/predictions.py
+1
-1
1 addition, 1 deletion
flatland/envs/predictions.py
flatland/utils/rendertools.py
+10
-2
10 additions, 2 deletions
flatland/utils/rendertools.py
with
12 additions
and
4 deletions
examples/training_example.py
+
1
−
1
View file @
ce24706b
...
@@ -84,7 +84,7 @@ for trials in range(1, n_trials + 1):
...
@@ -84,7 +84,7 @@ for trials in range(1, n_trials + 1):
# Environment step which returns the observations for all agents, their corresponding
# Environment step which returns the observations for all agents, their corresponding
# reward and whether their are done
# reward and whether their are done
next_obs
,
all_rewards
,
done
,
_
=
env
.
step
(
action_dict
)
next_obs
,
all_rewards
,
done
,
_
=
env
.
step
(
action_dict
)
env_renderer
.
render_env
(
show
=
True
,
show_observations
=
Fals
e
,
show_predictions
=
True
)
env_renderer
.
render_env
(
show
=
True
,
show_observations
=
Tru
e
,
show_predictions
=
True
)
# Update replay buffer and train agent
# Update replay buffer and train agent
for
a
in
range
(
env
.
get_num_agents
()):
for
a
in
range
(
env
.
get_num_agents
()):
...
...
This diff is collapsed.
Click to expand it.
flatland/envs/predictions.py
+
1
−
1
View file @
ce24706b
...
@@ -163,7 +163,7 @@ class ShortestPathPredictorForRailEnv(PredictionBuilder):
...
@@ -163,7 +163,7 @@ class ShortestPathPredictorForRailEnv(PredictionBuilder):
# prediction is ready
# prediction is ready
prediction
[
index
]
=
[
index
,
*
new_position
,
new_direction
,
0
]
prediction
[
index
]
=
[
index
,
*
new_position
,
new_direction
,
0
]
visited
.
add
((
new_position
[
0
],
new_position
[
1
],
new_direction
))
visited
.
add
((
new_position
[
0
],
new_position
[
1
],
new_direction
))
#
self.env.dev_pred_dict[agent.handle] = visited
self
.
env
.
dev_pred_dict
[
agent
.
handle
]
=
visited
prediction_dict
[
agent
.
handle
]
=
prediction
prediction_dict
[
agent
.
handle
]
=
prediction
# cleanup: reset initial position
# cleanup: reset initial position
...
...
This diff is collapsed.
Click to expand it.
flatland/utils/rendertools.py
+
10
−
2
View file @
ce24706b
...
@@ -280,7 +280,9 @@ class RenderTool(object):
...
@@ -280,7 +280,9 @@ class RenderTool(object):
# Check if the observation builder provides an observation
# Check if the observation builder provides an observation
if
len
(
observation_dict
)
<
1
:
if
len
(
observation_dict
)
<
1
:
warnings
.
warn
(
"
Observation Builder did not provide an observation_dict of all observed cells.
"
)
warnings
.
warn
(
"
Predictor did not provide any predicted cells to render.
\
Observaiton builder needs to populate: env.dev_obs_dict
"
)
else
:
else
:
for
agent
in
agent_handles
:
for
agent
in
agent_handles
:
color
=
self
.
gl
.
get_agent_color
(
agent
)
color
=
self
.
gl
.
get_agent_color
(
agent
)
...
@@ -299,7 +301,13 @@ class RenderTool(object):
...
@@ -299,7 +301,13 @@ class RenderTool(object):
"""
"""
rt
=
self
.
__class__
rt
=
self
.
__class__
if
len
(
prediction_dict
)
<
1
:
if
len
(
prediction_dict
)
<
1
:
warnings
.
warn
(
"
Predictor did not provide any predicted cells to render.
"
)
warnings
.
warn
(
"
Predictor did not provide any predicted cells to render.
\
Predictors builder needs to populate: env.dev_pred_dict
"
)
else
:
else
:
for
agent
in
agent_handles
:
for
agent
in
agent_handles
:
color
=
self
.
gl
.
get_agent_color
(
agent
)
color
=
self
.
gl
.
get_agent_color
(
agent
)
...
...
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