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
84d3dd8c
Commit
84d3dd8c
authored
5 years ago
by
Erik Nygren
Browse files
Options
Downloads
Patches
Plain Diff
minor changes
parent
f1e83f4b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
examples/flatland_2_0_example.py
+7
-7
7 additions, 7 deletions
examples/flatland_2_0_example.py
with
7 additions
and
7 deletions
examples/flatland_2_0_example.py
+
7
−
7
View file @
84d3dd8c
...
@@ -13,7 +13,7 @@ np.random.seed(1)
...
@@ -13,7 +13,7 @@ np.random.seed(1)
# Training on simple small tasks is the best way to get familiar with the environment
# Training on simple small tasks is the best way to get familiar with the environment
# Use a the malfunction generator to break agents from time to time
# Use a the malfunction generator to break agents from time to time
stochastic_data
=
{
'
prop_malfunction
'
:
0.
,
# Percentage of defective agents
stochastic_data
=
{
'
prop_malfunction
'
:
0.
3
,
# Percentage of defective agents
'
malfunction_rate
'
:
30
,
# Rate of malfunction occurence
'
malfunction_rate
'
:
30
,
# Rate of malfunction occurence
'
min_duration
'
:
3
,
# Minimal duration of malfunction
'
min_duration
'
:
3
,
# Minimal duration of malfunction
'
max_duration
'
:
20
# Max duration of malfunction
'
max_duration
'
:
20
# Max duration of malfunction
...
@@ -23,10 +23,10 @@ stochastic_data = {'prop_malfunction': 0., # Percentage of defective agents
...
@@ -23,10 +23,10 @@ stochastic_data = {'prop_malfunction': 0., # Percentage of defective agents
TreeObservation
=
TreeObsForRailEnv
(
max_depth
=
2
,
predictor
=
ShortestPathPredictorForRailEnv
())
TreeObservation
=
TreeObsForRailEnv
(
max_depth
=
2
,
predictor
=
ShortestPathPredictorForRailEnv
())
# Different agent types (trains) with different speeds.
# Different agent types (trains) with different speeds.
speed_ration_map
=
{
1.
:
1.
,
# Fast passenger train
speed_ration_map
=
{
1.
:
0.25
,
# Fast passenger train
1.
/
2.
:
0.
,
# Fast freight train
1.
/
2.
:
0.
25
,
# Fast freight train
1.
/
3.
:
0.
,
# Slow commuter train
1.
/
3.
:
0.
25
,
# Slow commuter train
1.
/
4.
:
0.
}
# Slow freight train
1.
/
4.
:
0.
25
}
# Slow freight train
env
=
RailEnv
(
width
=
50
,
env
=
RailEnv
(
width
=
50
,
height
=
50
,
height
=
50
,
...
@@ -36,14 +36,14 @@ env = RailEnv(width=50,
...
@@ -36,14 +36,14 @@ env = RailEnv(width=50,
max_inter_city_rails
=
2
,
max_inter_city_rails
=
2
,
max_tracks_in_city
=
4
,
max_tracks_in_city
=
4
,
),
),
schedule_generator
=
sparse_schedule_generator
(),
schedule_generator
=
sparse_schedule_generator
(
speed_ration_map
),
number_of_agents
=
50
,
number_of_agents
=
50
,
stochastic_data
=
stochastic_data
,
# Malfunction data generator
stochastic_data
=
stochastic_data
,
# Malfunction data generator
obs_builder_object
=
GlobalObsForRailEnv
(),
obs_builder_object
=
GlobalObsForRailEnv
(),
remove_agents_at_target
=
True
remove_agents_at_target
=
True
)
)
RailEnv
.
DEPOT_POSITION
=
lambda
agent
,
agent_handle
:
(
agent_handle
%
env
.
height
,
0
)
#
RailEnv.DEPOT_POSITION = lambda agent, agent_handle : (agent_handle % env.height,0)
env_renderer
=
RenderTool
(
env
,
gl
=
"
PILSVG
"
,
env_renderer
=
RenderTool
(
env
,
gl
=
"
PILSVG
"
,
...
...
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