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
f3cfd61b
Commit
f3cfd61b
authored
5 years ago
by
spmohanty
Browse files
Options
Downloads
Patches
Plain Diff
Move random seeding of RailEnv to the reset function
parent
78c02452
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
+4
-9
4 additions, 9 deletions
flatland/envs/rail_env.py
requirements_dev.txt
+1
-0
1 addition, 0 deletions
requirements_dev.txt
with
5 additions
and
9 deletions
flatland/envs/rail_env.py
+
4
−
9
View file @
f3cfd61b
...
...
@@ -119,8 +119,7 @@ class RailEnv(Environment):
obs_builder_object
:
ObservationBuilder
=
TreeObsForRailEnv
(
max_depth
=
2
),
max_episode_steps
=
None
,
stochastic_data
=
None
,
remove_agents_at_target
=
False
,
random_seed
=
None
remove_agents_at_target
=
False
):
"""
Environment init.
...
...
@@ -154,9 +153,6 @@ class RailEnv(Environment):
remove_agents_at_target : bool
If remove_agents_at_target is set to true then the agents will be removed by placing to
RailEnv.DEPOT_POSITION when the agent has reach it
'
s target position.
random_seed : int or None
if None, then its ignored, else the random generators are seeded with this number to ensure
that stochastic operations are replicable across multiple operations
"""
super
().
__init__
()
...
...
@@ -192,9 +188,6 @@ class RailEnv(Environment):
self
.
action_space
=
[
1
]
self
.
_seed
()
self
.
random_seed
=
random_seed
if
self
.
random_seed
:
self
.
_seed
(
seed
=
random_seed
)
# Stochastic train malfunctioning parameters
if
stochastic_data
is
not
None
:
...
...
@@ -255,11 +248,13 @@ class RailEnv(Environment):
"""
self
.
agents
=
EnvAgent
.
list_from_static
(
self
.
agents_static
)
def
reset
(
self
,
regen_rail
=
True
,
replace_agents
=
True
,
activate_agents
=
False
):
def
reset
(
self
,
regen_rail
=
True
,
replace_agents
=
True
,
activate_agents
=
False
,
random_seed
=
None
):
"""
if regen_rail then regenerate the rails.
if replace_agents then regenerate the agents static.
Relies on the rail_generator returning agent_static lists (pos, dir, target)
"""
if
random_seed
:
self
.
_seed
(
random_seed
)
# TODO https://gitlab.aicrowd.com/flatland/flatland/issues/172
# can we not put 'self.rail_generator(..)' into 'if regen_rail or self.rail is None' condition?
...
...
This diff is collapsed.
Click to expand it.
requirements_dev.txt
+
1
−
0
View file @
f3cfd61b
...
...
@@ -20,3 +20,4 @@ six>=1.12.0
timeout-decorator>=0.4.1
attrs
ushlex
gym==0.14.0
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