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
pranjal_dhole
Flatland
Commits
c4747283
Commit
c4747283
authored
5 years ago
by
Erik Nygren
Browse files
Options
Downloads
Patches
Plain Diff
moved split_tree into baseline repo
parent
2de81f41
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
flatland/envs/observations.py
+0
-36
0 additions, 36 deletions
flatland/envs/observations.py
notebooks/Scene_Editor.ipynb
+1
-1
1 addition, 1 deletion
notebooks/Scene_Editor.ipynb
with
1 addition
and
37 deletions
flatland/envs/observations.py
+
0
−
36
View file @
c4747283
...
@@ -557,42 +557,6 @@ class TreeObsForRailEnv(ObservationBuilder):
...
@@ -557,42 +557,6 @@ class TreeObsForRailEnv(ObservationBuilder):
prompt
=
prompt_
[
children
],
prompt
=
prompt_
[
children
],
current_depth
=
current_depth
+
1
)
current_depth
=
current_depth
+
1
)
def
split_tree
(
self
,
tree
,
num_features_per_node
=
8
,
current_depth
=
0
):
"""
:param tree:
:param num_features_per_node:
:param prompt:
:param current_depth:
:return:
"""
if
len
(
tree
)
<
num_features_per_node
:
return
[],
[],
[]
depth
=
0
tmp
=
len
(
tree
)
/
num_features_per_node
-
1
pow4
=
4
while
tmp
>
0
:
tmp
-=
pow4
depth
+=
1
pow4
*=
4
child_size
=
(
len
(
tree
)
-
num_features_per_node
)
//
4
tree_data
=
tree
[:
4
].
tolist
()
distance_data
=
[
tree
[
4
]]
agent_data
=
tree
[
5
:
num_features_per_node
].
tolist
()
for
children
in
range
(
4
):
child_tree
=
tree
[(
num_features_per_node
+
children
*
child_size
):
(
num_features_per_node
+
(
children
+
1
)
*
child_size
)]
tmp_tree_data
,
tmp_distance_data
,
tmp_agent_data
=
self
.
split_tree
(
child_tree
,
num_features_per_node
,
current_depth
=
current_depth
+
1
)
if
len
(
tmp_tree_data
)
>
0
:
tree_data
.
extend
(
tmp_tree_data
)
distance_data
.
extend
(
tmp_distance_data
)
agent_data
.
extend
(
tmp_agent_data
)
return
tree_data
,
distance_data
,
agent_data
def
_set_env
(
self
,
env
):
def
_set_env
(
self
,
env
):
self
.
env
=
env
self
.
env
=
env
if
self
.
predictor
:
if
self
.
predictor
:
...
...
This diff is collapsed.
Click to expand it.
notebooks/Scene_Editor.ipynb
+
1
−
1
View file @
c4747283
...
@@ -111,7 +111,7 @@
...
@@ -111,7 +111,7 @@
"name": "python",
"name": "python",
"nbconvert_exporter": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"pygments_lexer": "ipython3",
"version": "3.6.
8
"
"version": "3.6.
5
"
},
},
"latex_envs": {
"latex_envs": {
"LaTeX_envs_menu_present": true,
"LaTeX_envs_menu_present": true,
...
...
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