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
324a397e
Commit
324a397e
authored
5 years ago
by
Erik Nygren
Browse files
Options
Downloads
Patches
Plain Diff
updated agent fixed behavior
parent
31293020
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
flatland/envs/agent_utils.py
+2
-1
2 additions, 1 deletion
flatland/envs/agent_utils.py
flatland/envs/rail_env.py
+7
-4
7 additions, 4 deletions
flatland/envs/rail_env.py
with
9 additions
and
5 deletions
flatland/envs/agent_utils.py
+
2
−
1
View file @
324a397e
...
...
@@ -64,7 +64,8 @@ class EnvAgentStatic(object):
malfunction_datas
.
append
({
'
malfunction
'
:
0
,
'
malfunction_rate
'
:
schedule
.
agent_malfunction_rates
[
i
]
if
schedule
.
agent_malfunction_rates
is
not
None
else
0.
,
'
next_malfunction
'
:
0
,
'
nr_malfunctions
'
:
0
})
'
nr_malfunctions
'
:
0
,
'
fixed
'
:
False
})
return
list
(
starmap
(
EnvAgentStatic
,
zip
(
schedule
.
agent_positions
,
schedule
.
agent_directions
,
...
...
This diff is collapsed.
Click to expand it.
flatland/envs/rail_env.py
+
7
−
4
View file @
324a397e
...
...
@@ -407,13 +407,16 @@ class RailEnv(Environment):
return
True
# Restart fixed agents
if
agent
.
malfunction_data
[
'
malfunction
'
]
<
1
and
agent
.
malfunction_data
[
'
next_malfunction
'
]
>
0
:
if
agent
.
malfunction_data
[
'
malfunction
'
]
<
1
and
agent
.
malfunction_data
[
'
next_malfunction
'
]
>
0
and
not
agent
.
malfunction_data
[
'
fixed
'
]:
agent
.
malfunction_data
[
'
next_malfunction
'
]
-=
1
agent
.
malfunction_data
[
'
fixed
'
]
=
True
if
'
moving_before_malfunction
'
in
agent
.
malfunction_data
:
self
.
agents
[
i_agent
].
moving
=
agent
.
malfunction_data
[
'
moving_before_malfunction
'
]
return
False
# Agent has been running smoothly
elif
agent
.
malfunction_data
[
'
malfunction
'
]
<
1
and
agent
.
malfunction_data
[
'
next_malfunction
'
]
>
0
:
agent
.
malfunction_data
[
'
next_malfunction
'
]
-=
1
return
False
# Break agents that have next_malfunction
if
agent
.
malfunction_data
[
'
malfunction
'
]
<
1
and
agent
.
malfunction_data
[
'
next_malfunction
'
]
<
1
:
...
...
@@ -436,7 +439,7 @@ class RailEnv(Environment):
if
agent
.
malfunction_data
[
'
next_malfunction
'
]
>
0
and
agent
.
malfunction_data
[
'
malfunction
'
]
<
1
:
agent
.
malfunction_data
[
'
next_malfunction
'
]
-=
1
return
False
def
step
(
self
,
action_dict_
:
Dict
[
int
,
RailEnvActions
]):
"""
...
...
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