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
0dcd1e57
Commit
0dcd1e57
authored
5 years ago
by
Erik Nygren
Browse files
Options
Downloads
Patches
Plain Diff
updated tests
parent
c9dc6e10
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test_flatland_malfunction.py
+19
-18
19 additions, 18 deletions
tests/test_flatland_malfunction.py
with
19 additions
and
18 deletions
tests/test_flatland_malfunction.py
+
19
−
18
View file @
0dcd1e57
...
...
@@ -110,7 +110,7 @@ def test_malfunction_process():
total_down_time
+=
env
.
agents
[
0
].
malfunction_data
[
'
malfunction
'
]
# Check that the appropriate number of malfunctions is achieved
assert
env
.
agents
[
0
].
malfunction_data
[
'
nr_malfunctions
'
]
==
2
2
,
"
Actual {}
"
.
format
(
assert
env
.
agents
[
0
].
malfunction_data
[
'
nr_malfunctions
'
]
==
2
3
,
"
Actual {}
"
.
format
(
env
.
agents
[
0
].
malfunction_data
[
'
nr_malfunctions
'
])
# Check that malfunctioning data was standing around
...
...
@@ -141,16 +141,16 @@ def test_malfunction_process_statistically():
env
.
agents
[
0
].
target
=
(
0
,
0
)
# Next line only for test generation
#agent_malfunction_list = [[] for i in range(10)]
agent_malfunction_list
=
[[
0
,
5
,
4
,
3
,
2
,
1
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
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[
0
,
5
,
4
,
3
,
2
,
1
,
0
,
0
,
0
,
5
,
4
,
3
,
2
,
1
,
0
,
5
,
4
,
3
,
2
,
1
],
[
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
5
,
4
,
3
,
2
,
1
,
0
,
0
,
0
,
0
,
0
,
0
,
0
],
[
0
,
0
,
0
,
0
,
0
,
0
,
5
,
4
,
3
,
2
,
1
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
],
[
0
,
0
,
0
,
0
,
0
,
5
,
4
,
3
,
2
,
1
,
0
,
0
,
0
,
0
,
0
,
5
,
4
,
3
,
2
,
1
],
[
0
,
0
,
0
,
5
,
4
,
3
,
2
,
1
,
0
,
0
,
5
,
4
,
3
,
2
,
1
,
0
,
5
,
4
,
3
,
2
],
[
5
,
4
,
3
,
2
,
1
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
],
[
5
,
4
,
3
,
2
,
1
,
0
,
0
,
0
,
0
,
5
,
4
,
3
,
2
,
1
,
0
,
0
,
0
,
0
,
0
,
0
]]
for
step
in
range
(
20
):
action_dict
:
Dict
[
int
,
RailEnvActions
]
=
{}
...
...
@@ -167,7 +167,7 @@ def test_malfunction_process_statistically():
def
test_malfunction_before_entry
():
"""
Tests that malfunctions are working properly for agents before entering the environment!
"""
# Set fixed malfunction duration for this test
stochastic_data
=
{
'
malfunction_rate
'
:
0.0001
,
stochastic_data
=
{
'
malfunction_rate
'
:
2
,
'
min_duration
'
:
10
,
'
max_duration
'
:
10
}
...
...
@@ -190,16 +190,17 @@ def test_malfunction_before_entry():
# we want different next_malfunction values for the agents
assert
env
.
agents
[
0
].
malfunction_data
[
'
malfunction
'
]
==
0
assert
env
.
agents
[
1
].
malfunction_data
[
'
malfunction
'
]
==
0
assert
env
.
agents
[
2
].
malfunction_data
[
'
malfunction
'
]
==
0
assert
env
.
agents
[
2
].
malfunction_data
[
'
malfunction
'
]
==
1
0
assert
env
.
agents
[
3
].
malfunction_data
[
'
malfunction
'
]
==
0
assert
env
.
agents
[
4
].
malfunction_data
[
'
malfunction
'
]
==
0
assert
env
.
agents
[
5
].
malfunction_data
[
'
malfunction
'
]
==
1
0
assert
env
.
agents
[
5
].
malfunction_data
[
'
malfunction
'
]
==
0
assert
env
.
agents
[
6
].
malfunction_data
[
'
malfunction
'
]
==
0
assert
env
.
agents
[
7
].
malfunction_data
[
'
malfunction
'
]
==
0
assert
env
.
agents
[
8
].
malfunction_data
[
'
malfunction
'
]
==
0
assert
env
.
agents
[
9
].
malfunction_data
[
'
malfunction
'
]
==
0
# for a in range(10):
# print("assert env.agents[{}].malfunction_data['malfunction'] == {}".format(a,env.agents[a].malfunction_data['malfunction']))
assert
env
.
agents
[
8
].
malfunction_data
[
'
malfunction
'
]
==
10
assert
env
.
agents
[
9
].
malfunction_data
[
'
malfunction
'
]
==
10
#for a in range(10):
# print("assert env.agents[{}].malfunction_data['malfunction'] == {}".format(a,env.agents[a].malfunction_data['malfunction']))
def
test_malfunction_values_and_behavior
():
...
...
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