From 66dde3f7c5dc5a5a7b7ff46f0197a8ee7638a800 Mon Sep 17 00:00:00 2001 From: Roman Andriushchenko Date: Tue, 12 Nov 2024 13:28:57 +0100 Subject: [PATCH] policy and decision tree export --- paynt/synthesizer/decision_tree.py | 8 ++++---- paynt/synthesizer/policy_tree.py | 2 +- paynt/synthesizer/synthesizer_ar.py | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/paynt/synthesizer/decision_tree.py b/paynt/synthesizer/decision_tree.py index f8720c38..13419ad6 100644 --- a/paynt/synthesizer/decision_tree.py +++ b/paynt/synthesizer/decision_tree.py @@ -110,10 +110,10 @@ def counters_print(self): def export_decision_tree(self, decision_tree, export_filename_base): tree = decision_tree.to_graphviz() - # tree_filename = export_filename_base + ".dot" - # with open(tree_filename, 'w') as file: - # file.write(tree.source) - # logger.info(f"exported decision tree to {tree_filename}") + tree_filename = export_filename_base + ".dot" + with open(tree_filename, 'w') as file: + file.write(tree.source) + logger.info(f"exported decision tree to {tree_filename}") tree_visualization_filename = export_filename_base + ".png" tree.render(export_filename_base, format="png", cleanup=True) # using export_filename_base since graphviz appends .png by default diff --git a/paynt/synthesizer/policy_tree.py b/paynt/synthesizer/policy_tree.py index 89e22945..a249a2fe 100644 --- a/paynt/synthesizer/policy_tree.py +++ b/paynt/synthesizer/policy_tree.py @@ -792,7 +792,7 @@ def evaluate_all(self, family, prop, keep_value_only=False): def run(self, optimum_threshold=None): - return self.evaluate(export_filename_base=None) + return self.evaluate(export_filename_base=paynt.synthesizer.synthesizer.Synthesizer.export_synthesis_filename_base) def export_evaluation_result(self, evaluations, export_filename_base): diff --git a/paynt/synthesizer/synthesizer_ar.py b/paynt/synthesizer/synthesizer_ar.py index f09a412d..1af7788c 100644 --- a/paynt/synthesizer/synthesizer_ar.py +++ b/paynt/synthesizer/synthesizer_ar.py @@ -100,7 +100,7 @@ def update_optimum(self, family): self.quotient.specification.optimality.update_optimum(iv) self.best_assignment = ia self.best_assignment_value = iv - logger.info(f"value {round(iv,4)} achieved after {round(paynt.utils.timer.GlobalTimer.read(),2)} seconds") + # logger.info(f"value {round(iv,4)} achieved after {round(paynt.utils.timer.GlobalTimer.read(),2)} seconds") if isinstance(self.quotient, paynt.quotient.pomdp.PomdpQuotient): self.stat.new_fsc_found(family.analysis_result.improving_value, ia, self.quotient.policy_size(ia))