Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
OUTDATED Verse-library
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
AutonomyCourse_ECEIllinois
OUTDATED Verse-library
Commits
f961fe31
Commit
f961fe31
authored
2 years ago
by
crides
Browse files
Options
Downloads
Patches
Plain Diff
dump tree
parent
caa88220
No related branches found
No related tags found
1 merge request
!9
Tutorial
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
demo/vehicle/demo7.py
+9
-7
9 additions, 7 deletions
demo/vehicle/demo7.py
verse/analysis/analysis_tree.py
+18
-0
18 additions, 0 deletions
verse/analysis/analysis_tree.py
with
27 additions
and
7 deletions
demo/vehicle/demo7.py
+
9
−
7
View file @
f961fe31
...
...
@@ -103,15 +103,17 @@ if __name__ == "__main__":
time
=
timeit
.
default_timer
()
traces
=
scenario
.
simulate
(
60
,
0.05
)
print
(
"
\x1b
[31mrun1
\x1b
[0m
"
,
timeit
.
default_timer
()
-
time
)
traces
.
dump_tree
()
fig
=
go
.
Figure
()
fig
=
simulation_tree
(
traces
,
tmp_map
,
fig
,
1
,
2
,
'
lines
'
,
'
trace
'
,
print_dim_list
=
[
1
,
2
])
fig
.
show
()
time
=
timeit
.
default_timer
()
traces
=
scenario
.
simulate
(
60
,
0.05
)
print
(
"
\x1b
[31mrun2
\x1b
[0m
"
,
timeit
.
default_timer
()
-
time
)
fig
=
go
.
Figure
()
fig
=
simulation_tree
(
traces
,
tmp_map
,
fig
,
1
,
2
,
'
lines
'
,
'
trace
'
,
print_dim_list
=
[
1
,
2
])
fig
.
show
()
# time = timeit.default_timer()
# traces = scenario.simulate(60, 0.05)
# print("\x1b[31mrun2\x1b[0m", timeit.default_timer() - time)
# traces.dump_tree()
# fig = go.Figure()
# fig = simulation_tree(traces, tmp_map, fig, 1,
# 2, 'lines', 'trace', print_dim_list=[1, 2])
# fig.show()
This diff is collapsed.
Click to expand it.
verse/analysis/analysis_tree.py
+
18
−
0
View file @
f961fe31
from
typing
import
List
,
Dict
,
Any
import
json
from
treelib
import
Tree
class
AnalysisTreeNode
:
"""
AnalysisTreeNode class
...
...
@@ -122,3 +123,20 @@ class AnalysisTree:
parent_node
.
child
.
append
(
child_node
)
queue
.
append
((
child_node_dict
,
child_node
))
return
AnalysisTree
(
root
)
def
dump_tree
(
self
):
tree
=
Tree
()
AnalysisTree
.
_dump_tree
(
self
.
root
,
tree
,
0
,
1
)
tree
.
show
()
@staticmethod
def
_dump_tree
(
node
,
tree
,
pid
,
id
):
n
=
"
\n
"
.
join
(
str
((
aid
,
*
node
.
mode
[
aid
],
*
node
.
init
[
aid
]))
for
aid
in
node
.
agent
)
if
pid
!=
0
:
tree
.
create_node
(
n
,
id
,
parent
=
pid
)
else
:
tree
.
create_node
(
n
,
id
)
nid
=
id
+
1
for
child
in
node
.
child
:
nid
=
AnalysisTree
.
_dump_tree
(
child
,
tree
,
id
,
nid
)
return
nid
+
1
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