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
109955eb
Commit
109955eb
authored
2 years ago
by
keyis2
Browse files
Options
Downloads
Patches
Plain Diff
del equality checker.
parent
04eb6c0d
No related branches found
No related tags found
2 merge requests
!16
Parallel
,
!21
Arch2023 merged
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
verse/analysis/analysis_tree.py
+0
-62
0 additions, 62 deletions
verse/analysis/analysis_tree.py
with
0 additions
and
62 deletions
verse/analysis/analysis_tree.py
+
0
−
62
View file @
109955eb
...
...
@@ -99,62 +99,6 @@ class AnalysisTreeNode:
type
=
data
[
'
type
'
],
)
def
quick_check
(
self
,
other
:
"
AnalysisTreeNode
"
,
atol
=
1e-5
)
->
bool
:
if
not
(
# self.init==other.init and
self
.
mode
==
other
.
mode
and
self
.
agent
==
other
.
agent
and
self
.
start_time
==
other
.
start_time
and
self
.
assert_hits
==
other
.
assert_hits
and
self
.
type
==
other
.
type
and
# self.static==other.static and
# self.uncertain_param==other.uncertain_param and
len
(
self
.
child
)
==
len
(
other
.
child
)
and
True
# self.id==other.id
):
return
False
# for agent in self.agent:
# if not np.allclose(trace, trace_other, 0, atol, equal_nan=True):
# return False
return
True
def
check_inclusion
(
self
,
other
:
"
AnalysisTreeNode
"
,
atol
=
1e-5
)
->
bool
:
# for simtrace, return True iff self and other are the same with the error toleration
# for reachtube, return True iff the trace of self contains trace of other with the same structure and error toleration
if
not
self
.
quick_check
(
other
,
atol
):
return
False
# atol = pow(10, -num_digits)
if
self
.
type
==
'
simtrace
'
:
for
agent
,
trace
in
self
.
trace
.
items
():
trace_other
=
other
.
trace
[
agent
]
assert
trace
.
shape
==
trace_other
.
shape
# absolute(a - b) <= (atol + rtol * absolute(b))
if
not
np
.
allclose
(
trace
,
trace_other
,
0
,
atol
,
equal_nan
=
True
):
return
False
elif
self
.
type
==
'
reachtube
'
:
for
agent
,
trace
in
self
.
trace
.
items
():
# trace = np.around(trace, num_digits)
# trace_other = np.around(other.trace[agent], num_digits)
assert
trace
.
shape
==
trace_other
.
shape
# when considering error, a - b >= -error is trusted as a>=b
ge_other
=
np
.
subtract
(
trace
,
trace_other
)
+
atol
>=
0
le_other
=
np
.
subtract
(
trace
,
trace_other
)
-
atol
<=
0
# exclude the time dim
if
not
((
np
.
all
(
le_other
[
0
::
2
,
1
:])
==
False
)
and
(
np
.
all
(
ge_other
[
1
::
2
,
1
:])
==
True
)):
return
False
else
:
raise
ValueError
child_match
=
0
for
child
in
self
.
child
:
for
child_other
in
other
.
child
:
if
child
.
check_inclusion
(
child_other
):
child_match
+=
1
break
if
child_match
==
len
(
self
.
child
):
return
True
return
False
class
AnalysisTree
:
def
__init__
(
self
,
root
):
...
...
@@ -227,9 +171,3 @@ class AnalysisTree:
return
nid
+
1
def
__eq__
(
self
,
other
:
object
)
->
bool
:
assert
isinstance
(
other
,
AnalysisTree
)
if
len
(
self
.
nodes
)
!=
len
(
other
.
nodes
):
return
False
return
self
.
root
.
check_inclusion
(
other
.
root
)
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