Aiger: Add a way to evaluate an input sequence (Python)
Add a method to the class aig (Python) that produces a sequence of outputs for a given sequence of inputs. * python/spot/__init__.py: here
This commit is contained in:
parent
b9ec16f9c2
commit
306a45f239
1 changed files with 13 additions and 0 deletions
|
|
@ -159,6 +159,19 @@ class aig:
|
||||||
return ostr.str()
|
return ostr.str()
|
||||||
raise ValueError("unknown string format: " + format)
|
raise ValueError("unknown string format: " + format)
|
||||||
|
|
||||||
|
def evaluate(self, gen):
|
||||||
|
self.circ_init()
|
||||||
|
outputs_pos = self.outputs()
|
||||||
|
out_names = self.output_names()
|
||||||
|
for x in gen:
|
||||||
|
if len(x) != self.num_inputs():
|
||||||
|
raise ValueError("Incorrect number of inputs")
|
||||||
|
self.circ_step(x)
|
||||||
|
values = self.circ_state()
|
||||||
|
res_val = [values[index] for index in outputs_pos]
|
||||||
|
assert(len(res_val) == len(out_names))
|
||||||
|
yield list(zip(out_names, res_val))
|
||||||
|
|
||||||
__twa__acc1 = twa.acc
|
__twa__acc1 = twa.acc
|
||||||
__twa__acc2 = twa.get_acceptance
|
__twa__acc2 = twa.get_acceptance
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue