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
pranjal_dhole
Flatland
Commits
a968c5bf
Commit
a968c5bf
authored
5 years ago
by
u214892
Browse files
Options
Downloads
Patches
Plain Diff
#168 #163 multispeed and penalty testing
parent
0782bb70
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
benchmarks/run_all_examples.py
+0
-1
0 additions, 1 deletion
benchmarks/run_all_examples.py
tests/test_flatland_malfunction.py
+5
-5
5 additions, 5 deletions
tests/test_flatland_malfunction.py
with
5 additions
and
6 deletions
benchmarks/run_all_examples.py
+
0
−
1
View file @
a968c5bf
...
...
@@ -20,7 +20,6 @@ if __name__ == '__main__':
not
pkg_resources
.
resource_isdir
(
'
examples
'
,
entry
)
and
entry
.
endswith
(
"
.py
"
)
and
'
__init__
'
not
in
entry
and
'
demo.py
'
not
in
entry
and
'
DELETE
'
not
in
entry
]:
with
path
(
'
examples
'
,
entry
)
as
file_in
:
...
...
This diff is collapsed.
Click to expand it.
tests/test_flatland_malfunction.py
+
5
−
5
View file @
a968c5bf
import
random
from
typing
import
Dict
import
numpy
as
np
...
...
@@ -52,7 +53,7 @@ class SingleAgentNavigationObs(TreeObsForRailEnv):
min_distances
.
append
(
np
.
inf
)
observation
=
[
0
,
0
,
0
]
observation
[
np
.
argmin
(
min_distances
)]
=
1
observation
[
np
.
argmin
(
min_distances
)
[
0
]
]
=
1
return
observation
...
...
@@ -81,7 +82,6 @@ def test_malfunction_process():
agent_halts
=
0
total_down_time
=
0
agent_malfunctioning
=
False
agent_old_position
=
env
.
agents
[
0
].
position
for
step
in
range
(
100
):
actions
=
{}
...
...
@@ -140,12 +140,12 @@ def test_malfunction_process_statistically():
env
.
reset
()
nb_malfunction
=
0
for
step
in
range
(
100
):
action_dict
=
{}
action_dict
:
Dict
[
int
,
RailEnvActions
]
=
{}
for
agent
in
env
.
agents
:
if
agent
.
malfunction_data
[
'
malfunction
'
]
>
0
:
nb_malfunction
+=
1
# We randomly select an action
action_dict
[
agent
.
handle
]
=
np
.
random
.
randint
(
4
)
action_dict
[
agent
.
handle
]
=
RailEnvActions
(
np
.
random
.
randint
(
4
)
)
env
.
step
(
action_dict
)
...
...
@@ -329,7 +329,7 @@ def test_initial_malfunction_stop_moving():
run_replay_config
(
env
,
[
replay_config
])
def
test_initial_malfunction_do_nothing
(
rendering
=
True
):
def
test_initial_malfunction_do_nothing
():
random
.
seed
(
0
)
np
.
random
.
seed
(
0
)
...
...
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