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
a96ddb70
Commit
a96ddb70
authored
5 years ago
by
Erik Nygren
Browse files
Options
Downloads
Patches
Plain Diff
updated documentation
parent
11e21c81
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
docs/gettingstarted.rst
+2
-0
2 additions, 0 deletions
docs/gettingstarted.rst
examples/training_example.py
+6
-4
6 additions, 4 deletions
examples/training_example.py
with
8 additions
and
4 deletions
docs/gettingstarted.rst
+
2
−
0
View file @
a96ddb70
...
...
@@ -139,6 +139,8 @@ Next we configure the difficulty of our task by modifying the complex_rail_gener
The difficulty of a railway network depends on the dimensions (width x height) and the number of agents in the network.
By varying the number of start and goal connections (nr_start_goal) and the number of extra railway elements added (nr_extra)
the number of alternative paths of each agents can be modified. The more possible paths an agent has to reach its target the easier the task becomes.
Here we don't specify any observation builder but rather use the standard tree observation. If you would like to use a custom obervation please follow
the instructions in the next tutorial.
Feel free to vary these parameters to see how your own agent holds up on different setting. The evalutation set of railway configurations will
cover the whole spectrum from easy to complex tasks.
...
...
This diff is collapsed.
Click to expand it.
examples/training_example.py
+
6
−
4
View file @
a96ddb70
...
...
@@ -45,13 +45,13 @@ class RandomAgent:
return
#
Load
the agent with the parameters corresponding to the environment and observation_builder
agent
=
RandomAgent
(
env
.
get_observation_size
(),
env
.
get_action_size
()
)
#
Initialize
the agent with the parameters corresponding to the environment and observation_builder
agent
=
RandomAgent
(
218
,
4
)
n_trials
=
1000
# Empty dictionary for all agent action
action_dict
=
dict
()
print
(
"
Starting Training...
"
)
for
trials
in
range
(
1
,
n_trials
+
1
):
# Reset environment and get initial observations for all agents
...
...
@@ -72,9 +72,11 @@ for trials in range(1, n_trials + 1):
next_obs
,
all_rewards
,
done
,
_
=
env
.
step
(
action_dict
)
# Update replay buffer and train agent
agent
.
step
(
obs
[
a
],
action_dict
[
a
],
all_rewards
[
a
],
next_obs
[
a
],
done
[
a
])
agent
.
step
(
(
obs
[
a
],
action_dict
[
a
],
all_rewards
[
a
],
next_obs
[
a
],
done
[
a
])
)
score
+=
all_rewards
[
a
]
obs
=
next_obs
.
copy
()
if
done
[
'
__all__
'
]:
break
print
(
'
Episode Nr. {}
'
.
format
(
trials
))
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