fix negation bug in robustness
This commit is contained in:
parent
a8e84a3761
commit
6093767772
2 changed files with 5 additions and 3 deletions
|
|
@ -41,7 +41,7 @@ def _(stl):
|
||||||
|
|
||||||
@pointwise_robustness.register(stl.Neg)
|
@pointwise_robustness.register(stl.Neg)
|
||||||
def _(stl):
|
def _(stl):
|
||||||
return lambda x, t: -pointwise_robustness(arg)(x, t)
|
return lambda x, t: -pointwise_robustness(stl.arg)(x, t)
|
||||||
|
|
||||||
|
|
||||||
op_lookup = {
|
op_lookup = {
|
||||||
|
|
|
||||||
|
|
@ -32,8 +32,10 @@ class TestSTLRobustness(unittest.TestCase):
|
||||||
@params(ex1, ex2, ex3, ex4, ex5, ex6)
|
@params(ex1, ex2, ex3, ex4, ex5, ex6)
|
||||||
def test_robustness_value(self, phi_str, r):
|
def test_robustness_value(self, phi_str, r):
|
||||||
phi = stl.parse(phi_str)
|
phi = stl.parse(phi_str)
|
||||||
stl_eval = stl.robustness.pointwise_robustness(phi)
|
r1 = stl.robustness.pointwise_robustness(phi)(x, 0)
|
||||||
self.assertEqual(stl_eval(x, 0), r)
|
r2 = stl.robustness.pointwise_robustness(~phi)(x, 0)
|
||||||
|
self.assertEqual(r1, r)
|
||||||
|
self.assertEqual(r1, -r2)
|
||||||
|
|
||||||
|
|
||||||
@params(ex1, ex2, ex3, ex4, ex5, ex6)
|
@params(ex1, ex2, ex3, ex4, ex5, ex6)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue