fix setting concrete bases
This commit is contained in:
parent
39dcc82912
commit
8587d830ad
1 changed files with 9 additions and 10 deletions
|
|
@ -17,18 +17,18 @@ Param = namedtuple("Param", ["L", "h", "B", "eps"])
|
||||||
|
|
||||||
@singledispatch
|
@singledispatch
|
||||||
def node_base(_, _1, _2):
|
def node_base(_, _1, _2):
|
||||||
return sym.e
|
return sym.E
|
||||||
|
|
||||||
|
|
||||||
@node_base.register(stl.ast.Or)
|
@node_base.register(stl.ast.Or)
|
||||||
def _(_, eps, _1):
|
def _(phi, eps, _1):
|
||||||
return len(stl.args)**(1/eps)
|
return len(phi.args)**(1/eps)
|
||||||
|
|
||||||
|
|
||||||
@node_base.register(stl.ast.F)
|
@node_base.register(stl.ast.F)
|
||||||
def _(_, eps, L):
|
def _(phi, eps, L):
|
||||||
lo, hi = stl.interval
|
lo, hi = phi.interval
|
||||||
return sym.ceil((hi - lo)*L/eps)**(2/eps)
|
return sym.ceiling((hi - lo)*L/eps)**(2/eps)
|
||||||
|
|
||||||
|
|
||||||
def sample_rate(eps, L):
|
def sample_rate(eps, L):
|
||||||
|
|
@ -36,8 +36,8 @@ def sample_rate(eps, L):
|
||||||
|
|
||||||
|
|
||||||
def admissible_params(phi, eps, L):
|
def admissible_params(phi, eps, L):
|
||||||
h = sample_rate(eps, L),
|
h = sample_rate(eps, L)
|
||||||
B = max(node_base(n, eps, L) for n in walk(phi)),
|
B = max(node_base(n, eps, L) for n in walk(phi))
|
||||||
return B, h
|
return B, h
|
||||||
|
|
||||||
def new_symbol_set(ss):
|
def new_symbol_set(ss):
|
||||||
|
|
@ -55,7 +55,6 @@ def symbolic_params(phi, eps, L):
|
||||||
|
|
||||||
|
|
||||||
def smooth_robustness(phi, *, L=None, eps=None):
|
def smooth_robustness(phi, *, L=None, eps=None):
|
||||||
# TODO: Return symbollic formula if flag
|
|
||||||
p = symbolic_params(phi, eps, L)
|
p = symbolic_params(phi, eps, L)
|
||||||
lo, hi = beta(phi, p), alpha(phi, p)
|
lo, hi = beta(phi, p), alpha(phi, p)
|
||||||
subs = {}
|
subs = {}
|
||||||
|
|
@ -71,7 +70,7 @@ def smooth_robustness(phi, *, L=None, eps=None):
|
||||||
else:
|
else:
|
||||||
B = p.B
|
B = p.B
|
||||||
|
|
||||||
return sym.log(lo, B), sym.log(hi, B)
|
return sym.log(lo, B).simplify(), sym.log(hi, B).simplify()
|
||||||
|
|
||||||
|
|
||||||
# Alpha implementation
|
# Alpha implementation
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue