From 0d4a703dcc2e983f7c99f56a76d9bf674e9a4c37 Mon Sep 17 00:00:00 2001 From: Marcell Vazquez-Chanlatte Date: Mon, 20 Mar 2017 11:59:34 -0700 Subject: [PATCH] correct lipshitz bound for stl predicates --- stl/utils.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/stl/utils.py b/stl/utils.py index 025b9ca..79e8d12 100644 --- a/stl/utils.py +++ b/stl/utils.py @@ -121,12 +121,12 @@ def from_mtl(phi:MTL, ap_map:Dict[AtomicPred, LinEq]) -> STL: focus = AP_lens(phi) return focus.modify(ap_map.get) +def _lineq_lipschitz(lineq): + return sum(map(abs, lens(lineq).terms.each_().coeff.get_all())) + def linear_stl_lipschitz(phi): - r = max(abs(c) for c in terms_lens(phi).coeff.get_all()) - try: - return float(r) - except TypeError: - return r + """Infinity norm lipschitz bound of linear inequality predicate.""" + return float(max(map(_lineq_lipschitz, lineq_lens(phi).get_all()))) # EDSL