From 306a45f2399bae780dc3c7745d05c2b64753d4ba Mon Sep 17 00:00:00 2001 From: Florian Renkin Date: Mon, 13 Sep 2021 15:30:19 +0200 Subject: [PATCH] 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 --- python/spot/__init__.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/python/spot/__init__.py b/python/spot/__init__.py index 9ce1701c1..c8afe78ca 100644 --- a/python/spot/__init__.py +++ b/python/spot/__init__.py @@ -159,6 +159,19 @@ class aig: return ostr.str() 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__acc2 = twa.get_acceptance