Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
ptype = RHTLP_PROB
else:
raise ValueError("Unrecognized prob_type: "+str(ptype_tag.text))
# Build CtsSysDyn, or set to None
c_dyn = elem.find(ns_prefix+"c_dyn")
if c_dyn is None:
sys_dyn = None
else:
(tag_name, A) = untagmatrix(c_dyn.find(ns_prefix+"A"))
(tag_name, B) = untagmatrix(c_dyn.find(ns_prefix+"B"))
(tag_name, E) = untagmatrix(c_dyn.find(ns_prefix+"E"))
(tag_name, K) = untagmatrix(c_dyn.find(ns_prefix+"K"))
(tag_name, Uset) = untagpolytope(c_dyn.find(ns_prefix+"U_set"))
(tag_name, Wset) = untagpolytope(c_dyn.find(ns_prefix+"W_set"))
sys_dyn = discretize.CtsSysDyn(A, B, E, K, Uset, Wset)
# Extract LTL specification
s_elem = elem.find(ns_prefix+"spec")
if s_elem.find(ns_prefix+"env_init") is not None: # instance of GRSpec style
spec = GRSpec()
for spec_tag in ["env_init", "env_safety", "env_prog",
"sys_init", "sys_safety", "sys_prog"]:
if s_elem.find(ns_prefix+spec_tag) is None:
raise ValueError("invalid specification in tulipcon XML string.")
(tag_name, li) = untaglist(s_elem.find(ns_prefix+spec_tag),
cast_f=str, namespace=namespace)
li = [v.replace("<", "<") for v in li]
li = [v.replace(">", ">") for v in li]
li = [v.replace("&", "&") for v in li]
setattr(spec, spec_tag, li)
assumption = dumped_data["assumption"]
guarantee = dumped_data["guarantee"]
if verbose > 0:
print "A =\n", A
print "B =\n", B
print "E =\n", E
print "X =", X
print "U =", U
print "W =", W
print "horizon (N) =", N
for (k, v) in cont_prop.items():
print k+" =\n", v
# Build transition system
sys_dyn = discretize.CtsSysDyn(A, B, E, [], U, W)
initial_partition = prop2part.prop2part2(X, cont_prop)
return (sys_dyn, initial_partition, N, assumption, guarantee, env_vars, sys_disc_vars)
if ("version" not in elem.attrib.keys()):
raise ValueError("unversioned tulipcon XML string.")
if int(elem.attrib["version"]) != 0:
raise ValueError("unsupported tulipcon XML version: "+str(elem.attrib["version"]))
# Build CtsSysDyn, or set to None
c_dyn = elem.find(ns_prefix+"c_dyn")
if c_dyn is None:
sys_dyn = None
else:
(tag_name, A) = untagmatrix(c_dyn.find(ns_prefix+"A"))
(tag_name, B) = untagmatrix(c_dyn.find(ns_prefix+"B"))
(tag_name, E) = untagmatrix(c_dyn.find(ns_prefix+"E"))
(tag_name, Uset) = untagpolytope(c_dyn.find(ns_prefix+"U_set"))
(tag_name, Wset) = untagpolytope(c_dyn.find(ns_prefix+"W_set"))
sys_dyn = discretize.CtsSysDyn(A, B, E, [], Uset, Wset)
# Discrete dynamics, if available
d_dyn = elem.find(ns_prefix+"d_dyn")
if d_dyn is None:
horizon = None
disc_dynamics = None
else:
if not d_dyn.attrib.has_key("horizon"):
raise ValueError("missing horizon length used for reachability computation.")
horizon = int(d_dyn.attrib["horizon"])
if (d_dyn.find(ns_prefix+"domain") is None) \
and (d_dyn.find(ns_prefix+"trans") is None) \
and (d_dyn.find(ns_prefix+"prop_symbols") is None):
disc_dynamics = None
else:
(tag_name, domain) = untagpolytope(d_dyn.find(ns_prefix+"domain"))
- `spec`: a GRSpec object that specifies the specification of
this synthesis problem.
- `verbose`: an integer that specifies the level of verbosity.
"""
if (not isinstance(cont_state_space, Polytope) and \
cont_state_space is not None):
printError("The type of input cont_state_space is expected to be " + \
"Polytope", obj=self)
raise TypeError("Invalid cont_state_space.")
if (not isinstance(cont_props, dict) and cont_props is not None):
printError("The input cont_props is expected to be a dictionary " + \
"{str : Polytope}", obj=self)
raise TypeError("Invalid disc_props.")
if (not isinstance(sys_dyn, CtsSysDyn) and sys_dyn is not None):
printError("The type of input sys_dyn is expected to be CtsSysDyn", obj=self)
raise TypeError("Invalid sys_dyn.")
# Process the continuous component
if (cont_state_space is not None):
if (cont_props is None):
cont_props = []
cont_partition = prop2part2(cont_state_space, cont_props)
disc_dynamics = copy.deepcopy(cont_partition)
disc_dynamics.trans = disc_dynamics.adj
for fromcell in xrange(0,len(disc_dynamics.trans)):
disc_dynamics.trans[fromcell][fromcell] = 1
if (sys_dyn is not None):
disc_dynamics = discretize(cont_partition, sys_dyn, verbose=verbose)
else:
if (verbose > 0):