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
14729f22
Commit
14729f22
authored
5 years ago
by
Egli Adrian (IT-SCI-API-PFI)
Browse files
Options
Downloads
Patches
Plain Diff
demo
parent
13c34d6c
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
env-data/railway/example_network_003.pkl
+0
-0
0 additions, 0 deletions
env-data/railway/example_network_003.pkl
examples/demo.py
+6
-1
6 additions, 1 deletion
examples/demo.py
notebooks/Editor2.ipynb
+12
-21
12 additions, 21 deletions
notebooks/Editor2.ipynb
with
18 additions
and
22 deletions
env-data/railway/example_network_003.pkl
+
0
−
0
View file @
14729f22
No preview for this file type
This diff is collapsed.
Click to expand it.
examples/demo.py
+
6
−
1
View file @
14729f22
...
@@ -147,9 +147,14 @@ class Demo:
...
@@ -147,9 +147,14 @@ class Demo:
if
True
:
if
True
:
if
not
((
step
)
%
2
==
0
):
if
not
((
step
)
%
2
==
0
):
if
iAgent
%
2
==
1
:
if
iAgent
==
3
:
action
=
0
action
=
0
if
not
((
step
)
%
2
==
0
):
if
iAgent
==
4
:
action
=
0
if
False
:
if
False
:
agent
=
self
.
env
.
agents
[
iAgent
]
agent
=
self
.
env
.
agents
[
iAgent
]
trial
=
0
trial
=
0
...
...
This diff is collapsed.
Click to expand it.
notebooks/Editor2.ipynb
+
12
−
21
View file @
14729f22
...
@@ -9,18 +9,9 @@
...
@@ -9,18 +9,9 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 1
7
,
"execution_count": 1,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [],
{
"name": "stdout",
"output_type": "stream",
"text": [
"The autoreload extension is already loaded. To reload it, use:\n",
" %reload_ext autoreload\n"
]
}
],
"source": [
"source": [
"%load_ext autoreload\n",
"%load_ext autoreload\n",
"%autoreload 2"
"%autoreload 2"
...
@@ -28,7 +19,7 @@
...
@@ -28,7 +19,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count":
18
,
"execution_count":
2
,
"metadata": {},
"metadata": {},
"outputs": [],
"outputs": [],
"source": [
"source": [
...
@@ -41,7 +32,7 @@
...
@@ -41,7 +32,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count":
19
,
"execution_count":
3
,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
...
@@ -63,7 +54,7 @@
...
@@ -63,7 +54,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count":
20
,
"execution_count":
4
,
"metadata": {},
"metadata": {},
"outputs": [],
"outputs": [],
"source": [
"source": [
...
@@ -72,7 +63,7 @@
...
@@ -72,7 +63,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count":
21
,
"execution_count":
5
,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
...
@@ -107,7 +98,7 @@
...
@@ -107,7 +98,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count":
22
,
"execution_count":
6
,
"metadata": {
"metadata": {
"scrolled": false
"scrolled": false
},
},
...
@@ -115,7 +106,7 @@
...
@@ -115,7 +106,7 @@
{
{
"data": {
"data": {
"application/vnd.jupyter.widget-view+json": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "
d412a331f4af4b61a680cc7e79265499
",
"model_id": "
95562eba9d7b4a2794d8d65721413e04
",
"version_major": 2,
"version_major": 2,
"version_minor": 0
"version_minor": 0
},
},
...
@@ -133,7 +124,7 @@
...
@@ -133,7 +124,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count":
23
,
"execution_count":
7
,
"metadata": {
"metadata": {
"scrolled": false
"scrolled": false
},
},
...
@@ -141,7 +132,7 @@
...
@@ -141,7 +132,7 @@
{
{
"data": {
"data": {
"application/vnd.jupyter.widget-view+json": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "
125052fec212492e96b6114be02fdce0
",
"model_id": "
0fe475488df94151afbfe8dc1e1050e8
",
"version_major": 2,
"version_major": 2,
"version_minor": 0
"version_minor": 0
},
},
...
@@ -160,7 +151,7 @@
...
@@ -160,7 +151,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count":
24
,
"execution_count":
8
,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
...
@@ -169,7 +160,7 @@
...
@@ -169,7 +160,7 @@
"(0, 0)"
"(0, 0)"
]
]
},
},
"execution_count":
24
,
"execution_count":
8
,
"metadata": {},
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result"
}
}
...
...
%% Cell type:markdown id: tags:
%% Cell type:markdown id: tags:
# Rail Editor v0.2
# Rail Editor v0.2
%% Cell type:code id: tags:
%% Cell type:code id: tags:
```
python
```
python
%
load_ext
autoreload
%
load_ext
autoreload
%
autoreload
2
%
autoreload
2
```
```
%% Output
The autoreload extension is already loaded. To reload it, use:
%reload_ext autoreload
%% Cell type:code id: tags:
%% Cell type:code id: tags:
```
python
```
python
import
numpy
as
np
import
numpy
as
np
from
numpy
import
array
from
numpy
import
array
import
ipywidgets
import
ipywidgets
import
IPython
import
IPython
from
IPython.core.display
import
display
,
HTML
from
IPython.core.display
import
display
,
HTML
```
```
%% Cell type:code id: tags:
%% Cell type:code id: tags:
```
python
```
python
display
(
HTML
(
"
<style>.container { width:95% !important; }</style>
"
))
display
(
HTML
(
"
<style>.container { width:95% !important; }</style>
"
))
```
```
%% Output
%% Output
%% Cell type:code id: tags:
%% Cell type:code id: tags:
```
python
```
python
from
flatland.utils.editor
import
EditorMVC
,
EditorModel
,
View
,
Controller
from
flatland.utils.editor
import
EditorMVC
,
EditorModel
,
View
,
Controller
```
```
%% Cell type:code id: tags:
%% Cell type:code id: tags:
```
python
```
python
mvc
=
EditorMVC
(
sGL
=
"
PIL
"
)
# sGL="PIL")
mvc
=
EditorMVC
(
sGL
=
"
PIL
"
)
# sGL="PIL")
```
```
%% Output
%% Output
%% Cell type:markdown id: tags:
%% Cell type:markdown id: tags:
## Instructions
## Instructions
-
Drag to draw (improved dead-ends)
-
Drag to draw (improved dead-ends)
-
Shift-Drag to erase rails (erasing dead ends not yet automated - drag right across them)
-
Shift-Drag to erase rails (erasing dead ends not yet automated - drag right across them)
-
ctrl-click to add agent
-
ctrl-click to add agent
-
direction chosen randomly to fit rail
-
direction chosen randomly to fit rail
-
ctrl-shift-click to add target for last agent
-
ctrl-shift-click to add target for last agent
-
target can be moved by repeating
-
target can be moved by repeating
-
to Resize the env (cannot preserve work):
-
to Resize the env (cannot preserve work):
-
select "Regen" tab, set regen size slider, click regenerate.
-
select "Regen" tab, set regen size slider, click regenerate.
-
alt-click remove all rails from cell
-
alt-click remove all rails from cell
%% Cell type:code id: tags:
%% Cell type:code id: tags:
```
python
```
python
mvc
.
view
.
display
()
mvc
.
view
.
display
()
```
```
%% Output
%% Output
%% Cell type:code id: tags:
%% Cell type:code id: tags:
```
python
```
python
mvc
.
view
.
wOutput
.
clear_output
()
mvc
.
view
.
wOutput
.
clear_output
()
mvc
.
view
.
wOutput
mvc
.
view
.
wOutput
```
```
%% Output
%% Output
%% Cell type:code id: tags:
%% Cell type:code id: tags:
```
python
```
python
len
(
mvc
.
editor
.
env
.
agents
),
len
(
mvc
.
editor
.
env
.
agents_static
)
len
(
mvc
.
editor
.
env
.
agents
),
len
(
mvc
.
editor
.
env
.
agents_static
)
```
```
%% Output
%% Output
(0, 0)
(0, 0)
...
...
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