From 3a7ac439f1787b317336aaa6ed0d005ad8af6133 Mon Sep 17 00:00:00 2001 From: Marcell Vazquez-Chanlatte Date: Sun, 23 Apr 2017 12:46:26 -0700 Subject: [PATCH] fastboolean eval + forgot to add offsets to new get_times function --- stl/boolean_eval.py | 2 ++ stl/fastboolean_eval.py | 3 ++- stl/test_boolean_eval.py | 3 +-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/stl/boolean_eval.py b/stl/boolean_eval.py index 4e17bf5..5e3e30c 100644 --- a/stl/boolean_eval.py +++ b/stl/boolean_eval.py @@ -34,6 +34,8 @@ def get_times(x, tau, lo=None, hi=None): lo = min(v.first()[0] for v in x.values()) if hi is None or hi is oo: hi = max(v.last()[0] for v in x.values()) + lo += tau + hi += tau if lo > hi: return [] elif hi == lo: diff --git a/stl/fastboolean_eval.py b/stl/fastboolean_eval.py index becada7..17d0b06 100644 --- a/stl/fastboolean_eval.py +++ b/stl/fastboolean_eval.py @@ -45,7 +45,8 @@ def _(stl): f1, f2 = pointwise_satf(stl.arg1), pointwise_satf(stl.arg2) state = False - for phi, tau in zip(reversed(f1(x, x.index)), reversed(x.index)): + times = get_times(x, t[0]) + for phi, tau in zip(reversed(f1(x, times)), reversed(times)): if not phi: state = f2(x, [tau]) if tau in t: diff --git a/stl/test_boolean_eval.py b/stl/test_boolean_eval.py index 14f3df8..c22a65a 100644 --- a/stl/test_boolean_eval.py +++ b/stl/test_boolean_eval.py @@ -35,7 +35,6 @@ class TestSTLEval(unittest.TestCase): self.assertEqual(stl_eval2(x, 0), not r) -""" @params(ex1, ex2, ex3, ex4, ex5, ex6, ex7, ex8, ex9, ex10, ex11) def test_fasteval(self, phi_str, _): phi = stl.parse(phi_str) @@ -48,4 +47,4 @@ class TestSTLEval(unittest.TestCase): b_fast2 = stl_evalf2(x, 0) self.assertEqual(b_slow, b_fast) self.assertEqual(b_fast, not b_fast2) -""" +