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
58f7caf0
"README.md" did not exist on "c987c81693c3a1f623a44d144c74496456951ea8"
Commit
58f7caf0
authored
5 years ago
by
Erik Nygren
Browse files
Options
Downloads
Patches
Plain Diff
minor updates to training files
parent
417678af
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
examples/training_navigation.py
+16
-14
16 additions, 14 deletions
examples/training_navigation.py
flatland/baselines/Nets/avoid_checkpoint15000.pth
+0
-0
0 additions, 0 deletions
flatland/baselines/Nets/avoid_checkpoint15000.pth
flatland/envs/generators.py
+1
-1
1 addition, 1 deletion
flatland/envs/generators.py
with
17 additions
and
15 deletions
examples/training_navigation.py
+
16
−
14
View file @
58f7caf0
...
...
@@ -11,38 +11,39 @@ np.random.seed(1)
# Example generate a rail given a manual specification,
# a map of tuples (cell_type, rotation)
transition_probability
=
[
5
,
# empty cell - Case 0
1
,
# Case 1 - straight
transition_probability
=
[
1
5
,
# empty cell - Case 0
5
,
# Case 1 - straight
5
,
# Case 2 - simple switch
1
,
# Case 3 - diamond crossing
1
,
# Case 4 - single slip
1
,
# Case 5 - double slip
1
,
# Case 6 - symmetrical
0
,
# Case 7 - dead end
1
5
,
# Case 1b (8) - simple turn right
1
5
,
# Case 1c (9) - simple turn left
1
5
]
# Case 2b (10) - simple switch mirrored
1
,
# Case 1b (8) - simple turn right
1
,
# Case 1c (9) - simple turn left
1
]
# Case 2b (10) - simple switch mirrored
# Example generate a random rail
"""
env = RailEnv(width=10,
height=10,
rail_generator=random_rail_generator(cell_type_relative_proportion=transition_probability),
number_of_agents
=
3
)
number_of_agents=
1
)
"""
env = RailEnv(width=
20
,
height=
20
,
rail_generator=complex_rail_generator(nr_start_goal=
20
, min_dist=
10
, max_dist=99999, seed=0),
number_of_agents=
5
)
env
=
RailEnv
(
width
=
15
,
height
=
15
,
rail_generator
=
complex_rail_generator
(
nr_start_goal
=
15
,
min_dist
=
5
,
max_dist
=
99999
,
seed
=
0
),
number_of_agents
=
10
)
"""
env = RailEnv(width=20,
height=20,
rail_generator=rail_from_list_of_saved_GridTransitionMap_generator(
[
'
../notebooks/testing_11.npy
'
]),
number_of_agents
=
1
)
[
'
../notebooks/temp.npy
'
]),
number_of_agents=3)
"""
env_renderer
=
RenderTool
(
env
,
gl
=
"
QT
"
)
handle
=
env
.
get_agent_handles
()
...
...
@@ -125,7 +126,8 @@ for trials in range(1, n_trials + 1):
next_obs
[
a
]
=
np
.
clip
(
np
.
array
(
next_obs
[
a
])
/
norm
,
-
1
,
1
)
# Update replay buffer and train agent
for
a
in
range
(
env
.
number_of_agents
):
agent
.
step
(
obs
[
a
],
action_dict
[
a
],
all_rewards
[
a
],
next_obs
[
a
],
done
[
a
])
if
not
demo
:
agent
.
step
(
obs
[
a
],
action_dict
[
a
],
all_rewards
[
a
],
next_obs
[
a
],
done
[
a
])
score
+=
all_rewards
[
a
]
obs
=
next_obs
.
copy
()
...
...
This diff is collapsed.
Click to expand it.
flatland/baselines/Nets/avoid_checkpoint15000.pth
+
0
−
0
View file @
58f7caf0
No preview for this file type
This diff is collapsed.
Click to expand it.
flatland/envs/generators.py
+
1
−
1
View file @
58f7caf0
...
...
@@ -123,7 +123,7 @@ def complex_rail_generator(nr_start_goal=1, min_dist=2, max_dist=99999, seed=0):
# print("failed...")
created_sanity
+=
1
print
(
"
\n
> Complex Rail Gen: Created #
"
,
len
(
start_goal
),
"
pairs
"
)
#
print("\n> Complex Rail Gen: Created #", len(start_goal), "pairs")
# print(start_goal)
agents_position
=
[
sg
[
0
]
for
sg
in
start_goal
]
...
...
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