support discretizing top and bot
This commit is contained in:
parent
b3bba24336
commit
38b8c1838f
2 changed files with 13 additions and 1 deletions
|
|
@ -94,6 +94,18 @@ def test_discretize():
|
|||
assert phi2 == stl.parse(
|
||||
'(~((X(A)) ∨ (X(X(A))))) ∧ (~((X(X(A))) ∨ (X(X(X(A))))))')
|
||||
|
||||
phi = stl.TOP
|
||||
assert stl.utils.is_discretizable(phi, dt)
|
||||
phi2 = stl.utils.discretize(phi, dt)
|
||||
phi3 = stl.utils.discretize(phi2, dt)
|
||||
assert phi2 == phi3
|
||||
|
||||
phi = stl.BOT
|
||||
assert stl.utils.is_discretizable(phi, dt)
|
||||
phi2 = stl.utils.discretize(phi, dt)
|
||||
phi3 = stl.utils.discretize(phi2, dt)
|
||||
assert phi2 == phi3
|
||||
|
||||
|
||||
def test_scope():
|
||||
dt = 0.3
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ def discretize(phi, dt, distribute=False):
|
|||
|
||||
|
||||
def _discretize(phi, dt):
|
||||
if isinstance(phi, (LinEq, AtomicPred)):
|
||||
if isinstance(phi, (LinEq, AtomicPred, _Top, _Bot)):
|
||||
return phi
|
||||
|
||||
children = tuple(_discretize(arg, dt) for arg in phi.children)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue