Skip to content

Commit

Permalink
add expected formula to the learner results
Browse files Browse the repository at this point in the history
  • Loading branch information
Yoiro committed Nov 10, 2024
1 parent deb5704 commit 99d7276
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions ltl_learner/learner.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def __init__(self, k: int = 10, sample: Path = None, syntax = None):
self.root_folder = Path(Path(__file__) / '..').resolve()
self.file_name = f'run_{datetime.now().strftime("%Y%m%d_%H%M%S")}.smtlib2'
self.cutoff = k
self.variables, self.positive, self.negative = self.read_sample(sample)
self.variables, self.positive, self.negative, self.expected_formula = self.read_sample(sample)
ops = {}
if syntax:
ops = syntax
Expand All @@ -35,9 +35,10 @@ def read_sample(self, sample):
return (
spec['variables'],
Sample(spec['positives']),
Sample(spec['negatives'])
Sample(spec['negatives']),
spec.get('expected', '')
)

def is_sat(self):
self.solver.check()
return self.solver.model()
Expand Down Expand Up @@ -69,7 +70,7 @@ def main(self):
logger.info("Found a valid truth assignation.")
self.write_model()
logger.info('Now computing the matching LTL formula.')
return self.converter.build(length = n)
return self.converter.build(length = n), self.expected_formula
else:
logger.info("Unable to determine a formula within the given constraint.")
return self.solver

0 comments on commit 99d7276

Please sign in to comment.