Skip to content
Snippets Groups Projects
Commit ebe00ddc authored by spmohanty's avatar spmohanty
Browse files

Changes to the documentation

parent 61e22e63
No related branches found
No related tags found
No related merge requests found
...@@ -106,11 +106,16 @@ following code. Also, tree observation data is displayed by RenderTool by defaul ...@@ -106,11 +106,16 @@ following code. Also, tree observation data is displayed by RenderTool by defaul
.. code-block:: python .. code-block:: python
for i in range(env.get_num_agents()): for i in range(env.get_num_agents()):
env.obs_builder.util_print_obs_subtree(tree=obs[i], num_features_per_node=5) env.obs_builder.util_print_obs_subtree(
tree=obs[i],
num_features_per_node=5
)
The complete code for this part of the Getting Started guide can be found in The complete code for this part of the Getting Started guide can be found in
examples/simple_example_1.py, examples/simple_example_2.py and
examples/simple_example_3.py * `examples/simple_example_1.py <https://gitlab.aicrowd.com/flatland/flatland/blob/master/examples/simple_example_1.py>`_
* `examples/simple_example_2.py <https://gitlab.aicrowd.com/flatland/flatland/blob/master/examples/simple_example_2.py>`_
* `examples/simple_example_3.py <https://gitlab.aicrowd.com/flatland/flatland/blob/master/examples/simple_example_3.py>`_
...@@ -119,7 +124,7 @@ Part 2 : Training a Simple an Agent on Flatland ...@@ -119,7 +124,7 @@ Part 2 : Training a Simple an Agent on Flatland
This is a brief tutorial on how to train an agent on Flatland. This is a brief tutorial on how to train an agent on Flatland.
Here we use a simple random agent to illustrate the process on how to interact with the environment. Here we use a simple random agent to illustrate the process on how to interact with the environment.
The corresponding code can be found in examples/training_example.py and in the baselines repository The corresponding code can be found in examples/training_example.py and in the baselines repository
you find a tutorial to train a DQN agent to solve the navigation task. you find a tutorial to train a `DQN <https://arxiv.org/abs/1312.5602>`_ agent to solve the navigation task.
We start by importing the necessary Flatland libraries We start by importing the necessary Flatland libraries
...@@ -133,12 +138,17 @@ Next we configure the difficulty of our task by modifying the complex_rail_gener ...@@ -133,12 +138,17 @@ Next we configure the difficulty of our task by modifying the complex_rail_gener
.. code-block:: python .. code-block:: python
env = RailEnv(width=15, env = RailEnv( width=15,
height=15, height=15,
rail_generator=complex_rail_generator(nr_start_goal=10, nr_extra=10, min_dist=10, max_dist=99999, seed=0), rail_generator=complex_rail_generator(
number_of_agents=5) nr_start_goal=10,
nr_extra=10,
min_dist=10,
max_dist=99999,
seed=0),
number_of_agents=5)
The difficulty of a railway network depends on the dimensions (width x height) and the number of agents in the network. 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) 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. 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 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
...@@ -214,10 +224,10 @@ A RailEnv environment can then be created as usual: ...@@ -214,10 +224,10 @@ A RailEnv environment can then be created as usual:
obs_builder_object=CustomObs()) obs_builder_object=CustomObs())
As for generating custom rail maps, the RailEnv class accepts a rail_generator As for generating custom rail maps, the RailEnv class accepts a rail_generator
argument that must be a function with arguments 'width', 'height', 'num_agents', argument that must be a function with arguments `width`, `height`, `num_agents`,
and 'num_resets=0', and that has to return a GridTransitionMap object (the rail map), and `num_resets=0`, and that has to return a GridTransitionMap object (the rail map),
and three lists of tuples containing the (row,column) coordinates of each of and three lists of tuples containing the (row,column) coordinates of each of
num_agent agents, their initial orientation (0=North, 1=East, 2=South, 3=West), num_agent agents, their initial orientation **(0=North, 1=East, 2=South, 3=West)**,
and the position of their targets. and the position of their targets.
For example, the following custom rail map generator returns an empty map of For example, the following custom rail map generator returns an empty map of
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment