Skip to content
Snippets Groups Projects
Commit 47bd274e authored by Erik Nygren's avatar Erik Nygren
Browse files

Minor updates

parent feb3684c
No related branches found
No related tags found
No related merge requests found
......@@ -36,8 +36,8 @@ env = RailEnv(width=20,
"""
env = RailEnv(width=15,
height=15,
rail_generator=complex_rail_generator(nr_start_goal=6, nr_extra=30, min_dist=10, max_dist=99999, seed=0),
number_of_agents=3)
rail_generator=complex_rail_generator(nr_start_goal=10, nr_extra=10, min_dist=10, max_dist=99999, seed=0),
number_of_agents=10)
"""
env = RailEnv(width=20,
......@@ -145,7 +145,7 @@ for trials in range(1, n_trials + 1):
for step in range(100):
if demo:
env_renderer.renderEnv(show=True)
time.sleep(0.1)
# print(step)
# Action
for a in range(env.get_num_agents()):
......
%% Cell type:markdown id: tags:
# Rail Editor v0.2
%% Cell type:code id: tags:
``` python
%load_ext autoreload
%autoreload 2
```
%% Cell type:code id: tags:
``` python
import numpy as np
from numpy import array
import ipywidgets
import IPython
from IPython.core.display import display, HTML
```
%% Cell type:code id: tags:
``` python
display(HTML("<style>.container { width:95% !important; }</style>"))
```
%% Output
%% Cell type:code id: tags:
``` python
from flatland.utils.editor import EditorMVC, EditorModel, View, Controller
```
%% Output
cpu
%% Cell type:code id: tags:
``` python
mvc = EditorMVC(sGL="PIL" ) # sGL="PIL")
```
%% Output
%% Cell type:markdown id: tags:
## Instructions
- Drag to draw (improved dead-ends)
- Shift-Drag to erase rails (erasing dead ends not yet automated - drag right across them)
- ctrl-click to add agent
- direction chosen randomly to fit rail
- ctrl-shift-click to add target for last agent
- target can be moved by repeating
- to Resize the env (cannot preserve work):
- select "Regen" tab, set regen size slider, click regenerate.
%% Cell type:code id: tags:
``` python
mvc.view.display()
```
%% Output
---------------------------------------------------------------------------
FileNotFoundError Traceback (most recent call last)
c:\users\u224870\appdata\local\programs\python\python36\lib\site-packages\flatland_rl-0.1.1-py3.6.egg\flatland\utils\editor.py in regenerate(self, event)
309 method = self.view.wRegenMethod.value
310 nAgents = self.view.wNAgents.value
--> 311 self.model.regenerate(method, nAgents)
312
313 def setRegenSize(self, event):
c:\users\u224870\appdata\local\programs\python\python36\lib\site-packages\flatland_rl-0.1.1-py3.6.egg\flatland\utils\editor.py in regenerate(self, method, nAgents)
582 self.fix_env()
583 self.set_env(self.env)
--> 584 self.player = Player(self.env)
585 self.view.new_env()
586 self.redraw()
c:\users\u224870\appdata\local\programs\python\python36\lib\site-packages\flatland_rl-0.1.1-py3.6.egg\examples\play_model.py in __init__(self, env)
30 # self.agent.qnetwork_local.load_state_dict(torch.load('../flatland/baselines/Nets/avoid_checkpoint9900.pth'))
31 self.agent.qnetwork_local.load_state_dict(torch.load(
---> 32 '../flatland/flatland/baselines/Nets/avoid_checkpoint15000.pth'))
33
34 self.iFrame = 0
c:\users\u224870\appdata\local\programs\python\python36\lib\site-packages\torch\serialization.py in load(f, map_location, pickle_module)
354 (sys.version_info[0] == 3 and isinstance(f, pathlib.Path)):
355 new_fd = True
--> 356 f = open(f, 'rb')
357 try:
358 return _load(f, map_location, pickle_module)
FileNotFoundError: [Errno 2] No such file or directory: '../flatland/flatland/baselines/Nets/avoid_checkpoint15000.pth'
%% Cell type:code id: tags:
``` python
mvc.view.wOutput.clear_output()
mvc.view.wOutput
```
%% Output
%% Cell type:code id: tags:
``` python
len(mvc.editor.env.agents), len(mvc.editor.env.agents_static)
```
%% Output
(0, 0)
......
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