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
49746bc6
Commit
49746bc6
authored
5 years ago
by
u214892
Browse files
Options
Downloads
Patches
Plain Diff
#167 bugfix action_on_cellexit
parent
efc4c6b3
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
flatland/envs/rail_env.py
+6
-3
6 additions, 3 deletions
flatland/envs/rail_env.py
with
6 additions
and
3 deletions
flatland/envs/rail_env.py
+
6
−
3
View file @
49746bc6
...
@@ -262,7 +262,7 @@ class RailEnv(Environment):
...
@@ -262,7 +262,7 @@ class RailEnv(Environment):
agent
.
malfunction_data
[
'
malfunction
'
]
=
0
agent
.
malfunction_data
[
'
malfunction
'
]
=
0
self
.
_agent_malfunction
(
i_agent
,
RailEnvActions
.
DO_NOTHING
)
self
.
_agent_
new_
malfunction
(
i_agent
,
RailEnvActions
.
DO_NOTHING
)
self
.
num_resets
+=
1
self
.
num_resets
+=
1
self
.
_elapsed_steps
=
0
self
.
_elapsed_steps
=
0
...
@@ -277,7 +277,10 @@ class RailEnv(Environment):
...
@@ -277,7 +277,10 @@ class RailEnv(Environment):
# Return the new observation vectors for each agent
# Return the new observation vectors for each agent
return
self
.
_get_observations
()
return
self
.
_get_observations
()
def
_agent_malfunction
(
self
,
i_agent
,
action
)
->
bool
:
def
_agent_new_malfunction
(
self
,
i_agent
,
action
)
->
bool
:
"""
Returns true if the agent enters into malfunction. (False, if not broken down or already broken down before).
"""
agent
=
self
.
agents
[
i_agent
]
agent
=
self
.
agents
[
i_agent
]
# Decrease counter for next event
# Decrease counter for next event
...
@@ -345,7 +348,7 @@ class RailEnv(Environment):
...
@@ -345,7 +348,7 @@ class RailEnv(Environment):
action
=
RailEnvActions
.
DO_NOTHING
action
=
RailEnvActions
.
DO_NOTHING
# Check if agent breaks at this step
# Check if agent breaks at this step
new_malfunction
=
self
.
_agent_malfunction
(
i_agent
,
action
)
new_malfunction
=
self
.
_agent_
new_
malfunction
(
i_agent
,
action
)
# Is the agent at the beginning of the cell? Then, it can take an action
# Is the agent at the beginning of the cell? Then, it can take an action
# Design choice (Erik+Christian):
# Design choice (Erik+Christian):
...
...
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