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
0d09232d
Commit
0d09232d
authored
3 years ago
by
Dipam Chakraborty
Browse files
Options
Downloads
Patches
Plain Diff
bugfix for malfunction off map to stopped on action do nothing
parent
5f5c34d6
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
flatland/envs/rail_env.py
+3
-3
3 additions, 3 deletions
flatland/envs/rail_env.py
flatland/envs/step_utils/action_preprocessing.py
+1
-2
1 addition, 2 deletions
flatland/envs/step_utils/action_preprocessing.py
with
4 additions
and
5 deletions
flatland/envs/rail_env.py
+
3
−
3
View file @
0d09232d
...
@@ -540,8 +540,8 @@ class RailEnv(Environment):
...
@@ -540,8 +540,8 @@ class RailEnv(Environment):
new_position
,
new_direction
=
agent
.
position
,
agent
.
direction
new_position
,
new_direction
=
agent
.
position
,
agent
.
direction
# Add agent to the map if not on it yet
# Add agent to the map if not on it yet
elif
agent
.
position
is
None
and
agent
.
action_saver
.
is_action_saved
:
elif
agent
.
position
is
None
and
agent
.
action_saver
.
is_action_saved
:
new_position
=
agent
.
initial_position
new_position
=
agent
.
initial_position
new_direction
=
agent
.
initial_direction
new_direction
=
agent
.
initial_direction
# If movement is allowed apply saved action independent of other agents
# If movement is allowed apply saved action independent of other agents
elif
agent
.
action_saver
.
is_action_saved
and
position_update_allowed
:
elif
agent
.
action_saver
.
is_action_saved
and
position_update_allowed
:
saved_action
=
agent
.
action_saver
.
saved_action
saved_action
=
agent
.
action_saver
.
saved_action
...
@@ -553,7 +553,7 @@ class RailEnv(Environment):
...
@@ -553,7 +553,7 @@ class RailEnv(Environment):
preprocessed_action
=
saved_action
preprocessed_action
=
saved_action
else
:
else
:
new_position
,
new_direction
=
agent
.
position
,
agent
.
direction
new_position
,
new_direction
=
agent
.
position
,
agent
.
direction
temp_transition_data
[
i_agent
]
=
env_utils
.
AgentTransitionData
(
position
=
new_position
,
temp_transition_data
[
i_agent
]
=
env_utils
.
AgentTransitionData
(
position
=
new_position
,
direction
=
new_direction
,
direction
=
new_direction
,
preprocessed_action
=
preprocessed_action
)
preprocessed_action
=
preprocessed_action
)
...
...
This diff is collapsed.
Click to expand it.
flatland/envs/step_utils/action_preprocessing.py
+
1
−
2
View file @
0d09232d
...
@@ -17,7 +17,7 @@ def process_do_nothing(state: TrainState, saved_action: RailEnvActions):
...
@@ -17,7 +17,7 @@ def process_do_nothing(state: TrainState, saved_action: RailEnvActions):
elif
saved_action
:
elif
saved_action
:
action
=
saved_action
action
=
saved_action
else
:
else
:
action
=
RailEnvActions
.
STOP_MOV
ING
action
=
RailEnvActions
.
DO_NOTH
ING
return
action
return
action
...
@@ -40,7 +40,6 @@ def preprocess_raw_action(action, state, saved_action):
...
@@ -40,7 +40,6 @@ def preprocess_raw_action(action, state, saved_action):
"""
"""
Preprocesses actions to handle different situations of usage of action based on context
Preprocesses actions to handle different situations of usage of action based on context
- DO_NOTHING is converted to FORWARD if train is moving
- DO_NOTHING is converted to FORWARD if train is moving
- DO_NOTHING is converted to STOP_MOVING if train is moving
"""
"""
action
=
process_illegal_action
(
action
)
action
=
process_illegal_action
(
action
)
...
...
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