Skip to content

Commit

Permalink
fix missing scheduler for policy search
Browse files Browse the repository at this point in the history
  • Loading branch information
Roman Andriushchenko committed Dec 7, 2023
1 parent 99b9d7b commit 18bc4c8
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions paynt/synthesizer/policy_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import paynt.quotient.models
import paynt.synthesizer.synthesizer

import paynt.verification.property_result
from paynt.verification.property import Property

import logging
Expand Down Expand Up @@ -347,7 +348,7 @@ def double_check_policy(quotient, family, prop, policy):
if family.size == 1:
quotient.assert_mdp_is_deterministic(mdp, family)

DOUBLE_CHECK_PRECISION = 1e-8
DOUBLE_CHECK_PRECISION = 1e-6
default_precision = Property.model_checking_precision
Property.set_model_checking_precision(DOUBLE_CHECK_PRECISION)
policy_result = mdp.model_check_property(prop, alt=True)
Expand Down Expand Up @@ -639,7 +640,10 @@ def synthesize_policy_for_tree_node(self, family, prop, all_sat=False, iteration
for index, mdp_subfamily in enumerate(sat_mdp_families):
self.quotient.build_with_second_coloring(mdp_subfamily, action_coloring, current_action_family) # maybe copy to new family?

primary_result = current_action_family.mdp.model_check_property(prop)
mc_result = stormpy.model_checking(
current_action_family.mdp.model, prop.formula, extract_scheduler=True, environment=Property.environment)
value = mc_result.at(current_action_family.mdp.initial_state)
primary_result = paynt.verification.property_result.PropertyResult(prop, mc_result, value)
self.stat.iteration_mdp(current_action_family.mdp.states)

# discard the family as soon as one MDP is unsat
Expand Down Expand Up @@ -718,8 +722,10 @@ def synthesize_policy_tree(self, family):
policy_tree = PolicyTree(family)

# self.quotient.build(policy_tree.root.family)
# policy_exists, _ = self.synthesize_policy_for_tree_node(policy_tree.root.family, prop)
# print(policy_exists)
# policy_exists,_,_,_ = self.synthesize_policy_for_tree_node(policy_tree.root.family, prop, all_sat=True)
# print("Policy exists: ", policy_exists)
# self.stat.finished(None)
# self.stat.print()
# exit()

reference_policy = None
Expand Down

0 comments on commit 18bc4c8

Please sign in to comment.