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
sfwatergit
Flatland
Commits
bcd06459
Commit
bcd06459
authored
5 years ago
by
Erik Nygren
Browse files
Options
Downloads
Patches
Plain Diff
minor bugfixes. Simple distance map test (thanks Christian). This test will be enhanced soon.
parent
82c15121
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/observations.py
+4
-2
4 additions, 2 deletions
flatland/envs/observations.py
flatland/envs/rail_env.py
+23
-11
23 additions, 11 deletions
flatland/envs/rail_env.py
with
27 additions
and
13 deletions
flatland/envs/observations.py
+
4
−
2
View file @
bcd06459
...
@@ -16,8 +16,10 @@ class TreeObsForRailEnv(ObservationBuilder):
...
@@ -16,8 +16,10 @@ class TreeObsForRailEnv(ObservationBuilder):
TreeObsForRailEnv object.
TreeObsForRailEnv object.
This object returns observation vectors for agents in the RailEnv environment.
This object returns observation vectors for agents in the RailEnv environment.
The information is local to each agent and exploits the
tree
structure of the rail
The information is local to each agent and exploits the
graph
structure of the rail
network to simplify the representation of the state of the environment for each agent.
network to simplify the representation of the state of the environment for each agent.
For details about the features in the tree observation see the get() function.
"""
"""
observation_dim
=
9
observation_dim
=
9
...
@@ -204,7 +206,7 @@ class TreeObsForRailEnv(ObservationBuilder):
...
@@ -204,7 +206,7 @@ class TreeObsForRailEnv(ObservationBuilder):
[... from
'
right] +
[... from
'
right] +
[... from
'
back
'
]
[... from
'
back
'
]
Finally, e
ach node information is composed of
8
f
loating point valu
es:
E
ach node information is composed of
9
f
eatur
es:
#1: if own target lies on the explored branch the current distance from the agent in number of cells is stored.
#1: if own target lies on the explored branch the current distance from the agent in number of cells is stored.
...
...
This diff is collapsed.
Click to expand it.
flatland/envs/rail_env.py
+
23
−
11
View file @
bcd06459
"""
"""
Definition of the RailEnv environment and related level-generation functions.
Definition of the RailEnv environment.
Generator functions are functions that take width, height and num_resets as arguments and return
a GridTransitionMap object.
"""
"""
# TODO: _ this is a global method --> utils or remove later
# TODO: _ this is a global method --> utils or remove later
...
@@ -46,20 +43,35 @@ class RailEnv(Environment):
...
@@ -46,20 +43,35 @@ class RailEnv(Environment):
to avoid bottlenecks.
to avoid bottlenecks.
The valid actions in the environment are:
The valid actions in the environment are:
0: do nothing
1: turn left and move to the next cell; if the agent was not moving, movement is started
- 0: do nothing (continue moving or stay still)
2: move to the next cell in front of the agent; if the agent was not moving, movement is started
- 1: turn left at switch and move to the next cell; if the agent was not moving, movement is started
3: turn right and move to the next cell; if the agent was not moving, movement is started
- 2: move to the next cell in front of the agent; if the agent was not moving, movement is started
4: stop moving
- 3: turn right at switch and move to the next cell; if the agent was not moving, movement is started
- 4: stop moving
Moving forward in a dead-end cell makes the agent turn 180 degrees and step
Moving forward in a dead-end cell makes the agent turn 180 degrees and step
to the cell it came from.
to the cell it came from.
The actions of the agents are executed in order of their handle to prevent
The actions of the agents are executed in order of their handle to prevent
deadlocks and to allow them to learn relative priorities.
deadlocks and to allow them to learn relative priorities.
TODO: WRITE ABOUT THE REWARD FUNCTION, and possibly allow for alpha and
Reward Function:
beta to be passed as parameters to __init__().
It costs each agent a step_penalty for every time-step taken in the environment. Independent of the movement
of the agent. Currently all other penalties such as penalty for stopping, starting and invalid actions are set to 0.
alpha = 1
beta = 1
Reward function parameters:
- invalid_action_penalty = 0
- step_penalty = -alpha
- global_reward = beta
- stop_penalty = 0 # penalty for stopping a moving agent
- start_penalty = 0 # penalty for starting a stopped agent
"""
"""
def
__init__
(
self
,
def
__init__
(
self
,
...
...
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