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
yoogottamk
Flatland
Commits
151b76b7
Commit
151b76b7
authored
5 years ago
by
u214892
Browse files
Options
Downloads
Patches
Plain Diff
#26 pydeps
parent
77398da5
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/temporary_example.py
+4
-7
4 additions, 7 deletions
examples/temporary_example.py
tests/test_rendertools.py
+2
-6
2 additions, 6 deletions
tests/test_rendertools.py
with
6 additions
and
13 deletions
examples/temporary_example.py
+
4
−
7
View file @
151b76b7
import
random
import
numpy
as
np
import
matplotlib.pyplot
as
plt
from
flatland.envs.rail_env
import
*
from
flatland.envs.generators
import
*
from
flatland.envs.observations
import
TreeObsForRailEnv
from
flatland.utils.rendertools
import
*
random
.
seed
(
0
)
...
...
@@ -94,7 +90,7 @@ env = RailEnv(width=7,
# print(env.obs_builder.distance_map[0, :, :, i])
# Print the observation vector for agent 0
obs
,
all_rewards
,
done
,
_
=
env
.
step
({
0
:
0
})
obs
,
all_rewards
,
done
,
_
=
env
.
step
({
0
:
0
})
for
i
in
range
(
env
.
get_num_agents
()):
env
.
obs_builder
.
util_print_obs_subtree
(
tree
=
obs
[
i
],
num_features_per_node
=
5
)
...
...
@@ -113,6 +109,7 @@ for step in range(100):
while
i
<
len
(
cmds
):
if
cmds
[
i
]
==
'
q
'
:
import
sys
sys
.
exit
()
elif
cmds
[
i
]
==
'
s
'
:
obs
,
all_rewards
,
done
,
_
=
env
.
step
(
action_dict
)
...
...
@@ -120,9 +117,9 @@ for step in range(100):
print
(
"
Rewards:
"
,
all_rewards
,
"
[done=
"
,
done
,
"
]
"
)
else
:
agent_id
=
int
(
cmds
[
i
])
action
=
int
(
cmds
[
i
+
1
])
action
=
int
(
cmds
[
i
+
1
])
action_dict
[
agent_id
]
=
action
i
=
i
+
1
i
=
i
+
1
i
+=
1
env_renderer
.
renderEnv
(
show
=
True
)
This diff is collapsed.
Click to expand it.
tests/test_rendertools.py
+
2
−
6
View file @
151b76b7
...
...
@@ -4,18 +4,14 @@
Tests for `flatland` package.
"""
from
flatland.envs.rail_env
import
RailEnv
,
random_rail_generator
import
numpy
as
np
#<<<<<<< HEAD
#=======
# import os
#>>>>>>> dc2fa1ee0244b15c76d89ab768c5e1bbd2716147
import
sys
import
matplotlib.pyplot
as
plt
import
numpy
as
np
import
flatland.utils.rendertools
as
rt
from
flatland.envs.observations
import
TreeObsForRailEnv
from
flatland.envs.rail_env
import
RailEnv
,
random_rail_generator
def
checkFrozenImage
(
oRT
,
sFileImage
,
resave
=
False
):
...
...
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