Flatland issueshttps://gitlab.aicrowd.com/flatland/flatland/-/issues2023-06-06T13:37:46Zhttps://gitlab.aicrowd.com/flatland/flatland/-/issues/340Trouble installing flatland2023-06-06T13:37:46ZnkouamelaTrouble installing flatlandI followed the instruction for setup (prerequisite and stable realease), but this is what i get when i try running flatland-demo
`(flatland-rl) root@LAPTOP-AOPAAUOQ:~# flatland-demo ...I followed the instruction for setup (prerequisite and stable realease), but this is what i get when i try running flatland-demo
`(flatland-rl) root@LAPTOP-AOPAAUOQ:~# flatland-demo open_window - pyglet Traceback (most recent call last): File "/root/anaconda3/envs/flatland-rl/lib/python3.7/site-packages/pyglet/__init__.py", line 378, in __getattr__ return getattr(self._module, name) AttributeError: 'NoneType' object has no attribute 'Window' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/root/anaconda3/envs/flatland-rl/bin/flatland-demo", line 8, in <module> sys.exit(demo()) File "/root/anaconda3/envs/flatland-rl/lib/python3.7/site-packages/click/core.py", line 1128, in __call__ return self.main(*args, **kwargs) File "/root/anaconda3/envs/flatland-rl/lib/python3.7/site-packages/click/core.py", line 1053, in main rv = self.invoke(ctx) File "/root/anaconda3/envs/flatland-rl/lib/python3.7/site-packages/click/core.py", line 1395, in invoke return ctx.invoke(self.callback, **ctx.params) File "/root/anaconda3/envs/flatland-rl/lib/python3.7/site-packages/click/core.py", line 754, in invoke return __callback(*args, **kwargs) File "/root/anaconda3/envs/flatland-rl/lib/python3.7/site-packages/flatland/cli.py", line 53, in demo show_predictions=False File "/root/anaconda3/envs/flatland-rl/lib/python3.7/site-packages/flatland/utils/rendertools.py", line 63, in render_env show_predictions, show_rowcols, frames, episode, step, selected_agent, return_image) File "/root/anaconda3/envs/flatland-rl/lib/python3.7/site-packages/flatland/utils/rendertools.py", line 533, in render_env return_image=return_image File "/root/anaconda3/envs/flatland-rl/lib/python3.7/site-packages/flatland/utils/rendertools.py", line 761, in render_env_svg self.gl.show() File "/root/anaconda3/envs/flatland-rl/lib/python3.7/site-packages/flatland/utils/graphics_pgl.py", line 56, in show self.open_window() File "/root/anaconda3/envs/flatland-rl/lib/python3.7/site-packages/flatland/utils/graphics_pgl.py", line 24, in open_window self.window = pgl.window.Window(resizable=True, vsync=False, width=1200, height=800) File "/root/anaconda3/envs/flatland-rl/lib/python3.7/site-packages/pyglet/__init__.py", line 384, in __getattr__ __import__(import_name) File "/root/anaconda3/envs/flatland-rl/lib/python3.7/site-packages/pyglet/window/__init__.py", line 1896, in <module> gl._create_shadow_window() File "/root/anaconda3/envs/flatland-rl/lib/python3.7/site-packages/pyglet/gl/__init__.py", line 208, in _create_shadow_window _shadow_window = Window(width=1, height=1, visible=False) File "/root/anaconda3/envs/flatland-rl/lib/python3.7/site-packages/pyglet/window/xlib/__init__.py", line 166, in __init__ super(XlibWindow, self).__init__(*args, **kwargs) File "/root/anaconda3/envs/flatland-rl/lib/python3.7/site-packages/pyglet/window/__init__.py", line 501, in __init__ display = get_platform().get_default_display() File "/root/anaconda3/envs/flatland-rl/lib/python3.7/site-packages/pyglet/window/__init__.py", line 1845, in get_default_display return pyglet.canvas.get_display() File "/root/anaconda3/envs/flatland-rl/lib/python3.7/site-packages/pyglet/canvas/__init__.py", line 82, in get_display return Display() File "/root/anaconda3/envs/flatland-rl/lib/python3.7/site-packages/pyglet/canvas/xlib.py", line 86, in __init__ raise NoSuchDisplayException('Cannot connect to "%s"' % name) pyglet.canvas.xlib.NoSuchDisplayException: Cannot connect to "None"`https://gitlab.aicrowd.com/flatland/flatland/-/issues/338macOS "Can't find OpenGL" error - newer version of pyglet needed2021-09-30T19:49:30Zmiroslav_matochamacOS "Can't find OpenGL" error - newer version of pyglet neededHello,
I am getting following error when trying to run flatland builded from the source on macOs Big Sur Version 11.1. I am pretty sure OpenGL is installed. I found that this was a common problem when using older versions of pyglet, but ...Hello,
I am getting following error when trying to run flatland builded from the source on macOs Big Sur Version 11.1. I am pretty sure OpenGL is installed. I found that this was a common problem when using older versions of pyglet, but it was repaired in version 1.5.11. However, I cannot use this version, as gym 0.14.0 has requirement for lower versions of this library. Is there any easy fix available for this trouble?
```
(flatland) Miroslavs-MacBook-Pro:project miroslavmatocha$ flatland-demo
open_window - pyglet
Traceback (most recent call last):
File "/Users/miroslavmatocha/miniconda3/envs/flatland/lib/python3.9/site-packages/pyglet/__init__.py", line 378, in __getattr__
return getattr(self._module, name)
AttributeError: 'NoneType' object has no attribute 'Window'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/miroslavmatocha/miniconda3/envs/flatland/lib/python3.9/site-packages/pyglet/__init__.py", line 378, in __getattr__
return getattr(self._module, name)
AttributeError: 'NoneType' object has no attribute '_create_shadow_window'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/miroslavmatocha/miniconda3/envs/flatland/bin/flatland-demo", line 33, in <module>
sys.exit(load_entry_point('flatland-rl', 'console_scripts', 'flatland-demo')())
File "/Users/miroslavmatocha/miniconda3/envs/flatland/lib/python3.9/site-packages/click/core.py", line 1137, in __call__
return self.main(*args, **kwargs)
File "/Users/miroslavmatocha/miniconda3/envs/flatland/lib/python3.9/site-packages/click/core.py", line 1062, in main
rv = self.invoke(ctx)
File "/Users/miroslavmatocha/miniconda3/envs/flatland/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Users/miroslavmatocha/miniconda3/envs/flatland/lib/python3.9/site-packages/click/core.py", line 763, in invoke
return __callback(*args, **kwargs)
File "/Users/miroslavmatocha/AAU/project/flatland/flatland/cli.py", line 49, in demo
env_renderer.render_env(
File "/Users/miroslavmatocha/AAU/project/flatland/flatland/utils/rendertools.py", line 62, in render_env
return self.renderer.render_env(show, show_agents, show_inactive_agents, show_observations,
File "/Users/miroslavmatocha/AAU/project/flatland/flatland/utils/rendertools.py", line 526, in render_env
return self.render_env_svg(show=show,
File "/Users/miroslavmatocha/AAU/project/flatland/flatland/utils/rendertools.py", line 761, in render_env_svg
self.gl.show()
File "/Users/miroslavmatocha/AAU/project/flatland/flatland/utils/graphics_pgl.py", line 56, in show
self.open_window()
File "/Users/miroslavmatocha/AAU/project/flatland/flatland/utils/graphics_pgl.py", line 24, in open_window
self.window = pgl.window.Window(resizable=True, vsync=False, width=1200, height=800)
File "/Users/miroslavmatocha/miniconda3/envs/flatland/lib/python3.9/site-packages/pyglet/__init__.py", line 384, in __getattr__
__import__(import_name)
File "/Users/miroslavmatocha/miniconda3/envs/flatland/lib/python3.9/site-packages/pyglet/window/__init__.py", line 1896, in <module>
gl._create_shadow_window()
File "/Users/miroslavmatocha/miniconda3/envs/flatland/lib/python3.9/site-packages/pyglet/__init__.py", line 384, in __getattr__
__import__(import_name)
File "/Users/miroslavmatocha/miniconda3/envs/flatland/lib/python3.9/site-packages/pyglet/gl/__init__.py", line 100, in <module>
from pyglet.gl.lib import GLException
File "/Users/miroslavmatocha/miniconda3/envs/flatland/lib/python3.9/site-packages/pyglet/gl/lib.py", line 141, in <module>
from pyglet.gl.lib_agl import link_GL, link_GLU, link_AGL
File "/Users/miroslavmatocha/miniconda3/envs/flatland/lib/python3.9/site-packages/pyglet/gl/lib_agl.py", line 48, in <module>
gl_lib = pyglet.lib.load_library(
File "/Users/miroslavmatocha/miniconda3/envs/flatland/lib/python3.9/site-packages/pyglet/lib.py", line 118, in load_library
return self.load_framework(kwargs['framework'])
File "/Users/miroslavmatocha/miniconda3/envs/flatland/lib/python3.9/site-packages/pyglet/lib.py", line 286, in load_framework
raise ImportError("Can't find framework %s." % path)
ImportError: Can't find framework /System/Library/Frameworks/OpenGL.framework.
```https://gitlab.aicrowd.com/flatland/flatland/-/issues/337Agent counts itself as ``other_agent_encountered`` in dead end2021-08-26T08:48:21Zoussama_aAgent counts itself as ``other_agent_encountered`` in dead endHello,
In the following example:
[frame_2](/uploads/5ffcdd715d3aeeb906d2ca4c1a9faa77/frame_2.bmp)
the train has the following observation:
```
Node(dist_own_target_encountered=0, dist_other_target_encountered=0, dist_other_agent_enco...Hello,
In the following example:
[frame_2](/uploads/5ffcdd715d3aeeb906d2ca4c1a9faa77/frame_2.bmp)
the train has the following observation:
```
Node(dist_own_target_encountered=0, dist_other_target_encountered=0, dist_other_agent_encountered=0,
dist_potential_conflict=0, dist_unusable_switch=0, dist_to_next_branch=0, dist_min_to_target=5.0,
num_agents_same_direction=0, num_agents_opposite_direction=0, num_agents_malfunctioning=0, speed_min_fractional=1.0,
num_agents_ready_to_depart=0, position=(1, 1), childs={'L': -inf, 'F': Node(dist_own_target_encountered=inf,
dist_other_target_encountered=inf, dist_other_agent_encountered=inf, dist_potential_conflict=inf, dist_unusable_switch=inf, dist_to_next_branch=1, dist_min_to_target=4.0, num_agents_same_direction=0,
num_agents_opposite_direction=0, num_agents_malfunctioning=0, speed_min_fractional=1.0,
num_agents_ready_to_depart=0, position=(1, 0), childs={'L': -inf, 'F': Node(dist_own_target_encountered=5,
dist_other_target_encountered=inf, **dist_other_agent_encountered=2**, dist_potential_conflict=inf,
dist_unusable_switch=inf, dist_to_next_branch=5, dist_min_to_target=0, num_agents_same_direction=0,
num_agents_opposite_direction=1, num_agents_malfunctioning=0, speed_min_fractional=1.0,
num_agents_ready_to_depart=0, position=(1, 4), childs={'L': -inf, 'F': -inf, 'R': -inf, 'B': -inf}), 'R': -inf, 'B': -inf}), 'R': -inf, 'B': -inf})
```
As you can see, the agent does not distinguish itself from other agents that is why we have `dist_other_agent_encountered=2`.
In the `TreeObsForRailEnv._explore_branch` method the following code is responsible for saving the distance to other encountered agents:
```
if position in self.location_has_agent:
if tot_dist < other_agent_encountered:
other_agent_encountered = tot_dist
```
So I think it would be better if `self.location_has_agent` stores the `id` of the agent if it is occupied and check if it is the same as the `handle` passed to the `TreeObsForRailEnv.get` method.
Thank you in advance,https://gitlab.aicrowd.com/flatland/flatland/-/issues/331Separate utilities in wrappers from Rllib2021-07-02T14:28:28ZmmartiSeparate utilities in wrappers from Rllibhttps://gitlab.aicrowd.com/flatland/flatland/-/issues/329actions prior to malfunction cannot be cancelled2020-12-15T16:26:45Zhagrid67actions prior to malfunction cannot be cancelledA competitor grumbled that an action sent to an agent before it malfunctioned, would always be performed after the malfunction completed.
Erik has commented that some actions do have this semantic, eg turning, because the "points" at a j...A competitor grumbled that an action sent to an agent before it malfunctioned, would always be performed after the malfunction completed.
Erik has commented that some actions do have this semantic, eg turning, because the "points" at a junction may already be set. However there is a case for allowing an agent to issue a "stop", prior to resumption of power. We would then need to implement something to remember that the agent is committed to turning left, travelling forward, etc.https://gitlab.aicrowd.com/flatland/flatland/-/issues/327Invalid agent directions while visiting cells with ShortestPathPredictorForRa...2020-09-16T13:19:03ZakopaczInvalid agent directions while visiting cells with ShortestPathPredictorForRailEnvSometimes, the agent's direction of the last visited cell generated by the `ShortestPathPredictorForRailEnv` marks an invalid direction - the cell does not permit that transition.
Possible source of the problem that the initial agent di...Sometimes, the agent's direction of the last visited cell generated by the `ShortestPathPredictorForRailEnv` marks an invalid direction - the cell does not permit that transition.
Possible source of the problem that the initial agent direction is appended to the list of visited cells when reaching the `agent.target` position (link: https://gitlab.aicrowd.com/flatland/flatland/blob/master/flatland/envs/predictions.py#L163).
```pyhton
for index in range(1, self.max_depth + 1):
# if we're at the target, stop moving until max_depth is reached
if new_position == agent.target or not shortest_path:
prediction[index] = [index, *new_position, new_direction, RailEnvActions.STOP_MOVING]
visited.add((*new_position, agent.direction))
continue
```
Suggestion: Change `agent.direction` to the `new_direction` variable, so the list of the visited cells would contain the directions of the agent's path.
Version: flatland-rl==2.2.1https://gitlab.aicrowd.com/flatland/flatland/-/issues/326where is the `observation_utils`?2023-09-21T10:48:24Zxzhaomawhere is the `observation_utils`?following the tutorial here:
https://flatland.aicrowd.com/getting-started/rl/single-agent.html
The fourth line of :
```
from flatland.envs.rail_env import RailEnv
from flatland.envs.rail_generators import sparse_rail_generator
from fla...following the tutorial here:
https://flatland.aicrowd.com/getting-started/rl/single-agent.html
The fourth line of :
```
from flatland.envs.rail_env import RailEnv
from flatland.envs.rail_generators import sparse_rail_generator
from flatland.envs.schedule_generators import sparse_schedule_generator
from utils.observation_utils import normalize_observation
from flatland.envs.observations import TreeObsForRailEnv
```
there is actually no `utils`.
And under `flatland.utils`, there's no `observation_utils`...
Is the project updated? Where should I find that function?https://gitlab.aicrowd.com/flatland/flatland/-/issues/324RailEnv Persistence - store SparseRailGenerator agents_hints like num_cities2020-07-03T17:03:40Zhagrid67RailEnv Persistence - store SparseRailGenerator agents_hints like num_citiesSparse_rail_generator returns a key `agents_hints` in its second return value, a dict known as "optionals" in RailEnv.
env.reset() passes the optionals["agents_hints"] to the schedule_generator. optionals["agent_hints"]["num_cities"] is...Sparse_rail_generator returns a key `agents_hints` in its second return value, a dict known as "optionals" in RailEnv.
env.reset() passes the optionals["agents_hints"] to the schedule_generator. optionals["agent_hints"]["num_cities"] is used in the formula for the max_episode_steps calculated by sparse_schedule_generator.
However when the env is persisted this information is currently lost.
The latter versions of `persistence.py` do save the max_step_size in its own key in the pickled env_dict.
This is enough for the schedule_from_file schedule generator.
(Earlier versions left this out and result in a max_steps of zero; this is affecting the 97 IL envs)
The sparse rail info may be useful for explaining env difficulty.
How to get hold of the hints and save them is not immediately obvious. It could form part of a re-factoring of the generators.https://gitlab.aicrowd.com/flatland/flatland/-/issues/323Unordered close-following agents2020-07-29T11:45:12Zhagrid67Unordered close-following agentsAs requested by Guillaume Sartoretti - the agents should be able to directly follow each other in any order.
Currently they can only follow in agent_id / handle order, because each agent is moved atomically in that order.
- Positions / ...As requested by Guillaume Sartoretti - the agents should be able to directly follow each other in any order.
Currently they can only follow in agent_id / handle order, because each agent is moved atomically in that order.
- Positions / cell locks are recorded in `rail_env.agent_positions`
- when an agent moves, its current cell is unlocked, and the new one locked.
- when the next agent moves, it checks the partially updated table before moving (thus "cross-over" conflicts are avoided)
- it means a higher-id agent can step into the cell vacated by a lower-id one, but not vice-versa.
**Implementation**
- use / copy existing loop over agents to check speed, valid actions, malfunction, etc
- for each agent ready to move cell (ie whose agent.speed_data position_fraction = 1) create an edge in a DiGraph from the existing cell (row,col) to the new one.
- Check the graph for agent conflicts:
- self loops mean the agent is stationary and this takes priority.
- cell swaps appear as loops of size 2. Mark both agents as cannot move.
- agents trying to move into a cell occupied by a stationary agent are blocked.
- agents *close_following* another agent are allowed to move, however this means we need to:
- check that chains of agents which are *close_following* are not blocked.
- A chain of *close_following* agents can be blocked by a stationary agent, or a cell-swap.
- a chain of *close_following* agents can be branching so the whole tree is affected by a block at the head.
- Special rule for two agents both trying to move into the same cell:
- The agent with the lower index wins
- Implication: an agent can "butt into" a close-following chain if it has a lower index than the one it will block.
- Implication: at a branch-point in a merging tree of agents, the agent with the lower index goes first.
In the diagram below,
- a black node indicates a moving agent (really the agent is the edge, and the two nodes are its current and next positions)
- a self-loop edge indicates a stationary agent.
- a red node indicates a cell containing a stopped / blocked agent.
- a purple node indicates a cell containing a stopped agent in an attempted swap-over pair.
- a blue node indicates an empty contended cell (two or more agents trying to move into it)
- a magenta node (slightly brighter purple) indicates an occupied contended cell, where the occupying agent is moving out, but two or more agents are trying to move in.
![image](/uploads/a8eed7d6dba3d0956241c5eab85ed8d0/image.png)hagrid67hagrid67https://gitlab.aicrowd.com/flatland/flatland/-/issues/322Exception error while running flatland-evaluator2020-09-20T05:08:45ZatutejException error while running flatland-evaluatorError : env_client.step called before env_client.env_create() call
Traceback (most recent call last):
File "/home/[user]/anaconda3/lib/python3.7/site-packages/flatland/evaluators/service.py", line 873, in run
self.handle_env_step(...Error : env_client.step called before env_client.env_create() call
Traceback (most recent call last):
File "/home/[user]/anaconda3/lib/python3.7/site-packages/flatland/evaluators/service.py", line 873, in run
self.handle_env_step(command)
File "/home/[user]/anaconda3/lib/python3.7/site-packages/flatland/evaluators/service.py", line 588, in handle_env_step
"env_client.step called before env_client.env_create() call")
Exception: env_client.step called before env_client.env_create() call
What's interesting is I haven't modified service.py in any manner.https://gitlab.aicrowd.com/flatland/flatland/-/issues/321Group by scores in the evaluation service by the test groups2020-06-05T13:53:41ZmohantyGroup by scores in the evaluation service by the test groupsAt the moment, the evaluation service simply takes a mean of rewards across all the episodes.
We want to compute the final scores by grouping all the envs by the test groups. So the final scores will be mean of mean of the said score in ...At the moment, the evaluation service simply takes a mean of rewards across all the episodes.
We want to compute the final scores by grouping all the envs by the test groups. So the final scores will be mean of mean of the said score in a single test group.https://gitlab.aicrowd.com/flatland/flatland/-/issues/320msgpack loads agent data as garbage bytes2020-06-03T09:44:18Zhagrid67msgpack loads agent data as garbage bytesWhen loading an env with msgpack we seem to get binary garbage in the agent data.
We know that msgpack doesn't handle typing.NamedTuple - it recreates a (unnamed) tuple. See #282. There is a workaround in agent_utils for this. But the...When loading an env with msgpack we seem to get binary garbage in the agent data.
We know that msgpack doesn't handle typing.NamedTuple - it recreates a (unnamed) tuple. See #282. There is a workaround in agent_utils for this. But the data loaded still appears as garbage.
I haven't been able to reproduce this in a standalone test case (saving a named tuple etc) but can reproduce in flatland.
I believe this this did work at some point (no thanks to me).
More details to follow.https://gitlab.aicrowd.com/flatland/flatland/-/issues/319Add a separate initial-planning timeout2020-06-02T23:35:36ZmohantyAdd a separate initial-planning timeoutWe currently implement a single per-step timeout in the evaluator service. We want to add a separate intial-planning-timeout for each environment instantiation to have different values for both the timeouts.We currently implement a single per-step timeout in the evaluator service. We want to add a separate intial-planning-timeout for each environment instantiation to have different values for both the timeouts.mohantymohantyhttps://gitlab.aicrowd.com/flatland/flatland/-/issues/318Record fine grained metrics in the evaluator service2020-06-02T22:09:39ZmohantyRecord fine grained metrics in the evaluator serviceRecord fine grained metrics in the evaluation service, which can be used later for more granular analysis of all the submissions.Record fine grained metrics in the evaluation service, which can be used later for more granular analysis of all the submissions.https://gitlab.aicrowd.com/flatland/flatland/-/issues/316Merge Pyglet and persistence from jeremy_merge into master2020-06-02T15:08:53Zhagrid67Merge Pyglet and persistence from jeremy_merge into master@Erik @Florian Laurent
I've done a manual merge from the branch 223_UpdateEditor_55_notebooks into a copy of master called jeremy_merge with various stuff from the last few months plus your changes from master. I would like to merge ...@Erik @Florian Laurent
I've done a manual merge from the branch 223_UpdateEditor_55_notebooks into a copy of master called jeremy_merge with various stuff from the last few months plus your changes from master. I would like to merge this back into master.
I've run the training on the branch with the "small_v0" in Florian's rig and all seems well AFAICT. (https://app.wandb.ai/masterscrat/flatland/runs/38lr3gsv)
I've done the merge manually with BeyondCompare (side by side comparison tool) rather than cryptic git commands, so I bring each change across myself. (the commit log would be in the 223_UpdateEditor_55_notebooks branch)
- moved persistence calls to msgpack and pickle out of rail_env and generators (the "*_from_file" methods) into a separate module `flatland.envs.persistence` (there was something a bit broken with the duplicated msgpack code)
This needed some *cyclic imports* (rail_env imports generators, generators import persistence, persistence imports rail_env) which meant I needed to change the import statements a bit (to import modules rather than objects / classes from modules)
- Ability to save episode agent positions and actions in the env file. (Useful for imitation learning saving the OR solutions, and reconstructing agent behaviours, etc)
- various minor graphics changes including the pyglet rendering and the ill-fated javascript renderer is in there (sort of working but not a priority right now)
I haven't fixed all the tests but I believe I haven't broken any more (12 fails).
I haven't updated the notebooks because they are too unfocussed and superseded.https://gitlab.aicrowd.com/flatland/flatland/-/issues/315Problem in Implementation of Tree Observation2020-02-16T14:25:43Zarpit23697Problem in Implementation of Tree ObservationIn the file observations.py, in class TreeObsForRailEnv , in function _explore_branch (line no. 298 , 307) ,I think there is problem in other_agent_same_direction update.
I think `other_agent_same_direction` should just be incremented b...In the file observations.py, in class TreeObsForRailEnv , in function _explore_branch (line no. 298 , 307) ,I think there is problem in other_agent_same_direction update.
I think `other_agent_same_direction` should just be incremented by 1, since one cell can hold only one agent at a time, and its direction is same as the direction in which we are exploring.
`other_agent_opposite_direction` should not be modified.https://gitlab.aicrowd.com/flatland/flatland/-/issues/313Agent does not change cell even when the cell is available2020-01-13T09:52:15Zeli_meiromAgent does not change cell even when the cell is availableIn order to reproduce this, please use the following:
```
width = 60 # With of map
height = 60 # Height of map
nr_trains = 15 # Number of trains that have an assigned task in the env
cities_in_map = 8 # Number of cities where agent...In order to reproduce this, please use the following:
```
width = 60 # With of map
height = 60 # Height of map
nr_trains = 15 # Number of trains that have an assigned task in the env
cities_in_map = 8 # Number of cities where agents can start or end
seed = 22 # Random seed
grid_distribution_of_cities = False # Type of city distribution, if False cities are randomly placed
max_rails_between_cities = 2 # Max number of tracks allowed between cities. This is number of entry point to a city
max_rail_in_cities = 6 # Max number of parallel tracks within a city, representing a realistic trainstation
rail_generator = sparse_rail_generator(max_num_cities=cities_in_map,
seed=seed,
grid_mode=grid_distribution_of_cities,
max_rails_between_cities=max_rails_between_cities,
max_rails_in_city=max_rail_in_cities,
)
# The schedule generator can make very basic schedules with a start point, end point and a speed profile for each agent.
# The speed profiles can be adjusted directly as well as shown later on. We start by introducing a statistical
# distribution of speed profiles
# Different agent types (trains) with different speeds.
speed_ration_map = {1. : 0.25, # Fast passenger train
1. / 2.: 0.25, # Fast freight train
1. / 3.: 0.25, # Slow commuter train
1. / 4.: 0.25} # Slow freight train
# We can now initiate the schedule generator with the given speed profiles
schedule_generator = sparse_schedule_generator(speed_ration_map)
# We can furthermore pass stochastic data to the RailEnv constructor which will allow for stochastic malfunctions
# during an episode.
stochastic_data = {'prop_malfunction': 0.3, # Percentage of defective agents
'malfunction_rate': 30, # Rate of malfunction occurence
'min_duration' : 3, # Minimal duration of malfunction
'max_duration' : 20 # Max duration of malfunction
}
```
And then the following sequence of action described in the text file.[moves.txt](/uploads/4d8829539f6fbb53447ab19e7a894b27/moves.txt)
At step 17 (or 16, depends on your notation), agent 11 transition from (7,34) to (7,35), but agent 1, which has a fractional position value of 4.0, does not move from (7,33) to (7,34) even though it is available.https://gitlab.aicrowd.com/flatland/flatland/-/issues/312Examples Repository2020-01-22T20:05:24ZErik NygrenExamples RepositoryWe want to make a seperate Example Repository where we can keep flatland version and examples synchronized.
Tasks:
* Make Repository
* Add Examples to Repository
* Check that examples are compatible with PyPi packageWe want to make a seperate Example Repository where we can keep flatland version and examples synchronized.
Tasks:
* Make Repository
* Add Examples to Repository
* Check that examples are compatible with PyPi packageMasterScratMasterScrathttps://gitlab.aicrowd.com/flatland/flatland/-/issues/305Remove unused parameters and Variables2019-11-19T18:28:35ZErik NygrenRemove unused parameters and VariablesClean up the project from unused parameters and variables.Clean up the project from unused parameters and variables.https://gitlab.aicrowd.com/flatland/flatland/-/issues/304service.py - self.current_step bug2019-11-16T12:51:10ZVetandvetand2013@yandex.ruservice.py - self.current_step bugHi Flatland team!
I want to report a bug in sevice.py. It seems that you don't update the `self.current_step` parameter anywhere. Thus, it is always equal to zero and when the timeout exception is raised (line 265), system makes followi...Hi Flatland team!
I want to report a bug in sevice.py. It seems that you don't update the `self.current_step` parameter anywhere. Thus, it is always equal to zero and when the timeout exception is raised (line 265), system makes following log:
`Exception: Timeout in step 0 of simulation X` - but that can occur not only in the first step.
Thanks for fixing that!