Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed min in prob01max_states #192

Merged
merged 2 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/stormpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ def prob01max_states(model, eventually_formula):
labelprop = core.Property("label-prop", labelform)
phiStates = BitVector(model.nr_states, True)
psiStates = model_checking(model, labelprop).get_truth_values()
return compute_prob01min_states(model, phiStates, psiStates)
return compute_prob01max_states(model, phiStates, psiStates)


def compute_prob01_states(model, phi_states, psi_states):
Expand Down
16 changes: 10 additions & 6 deletions tests/core/test_modelchecking.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,16 +141,20 @@ def test_model_checking_prob01(self):
(prob0, prob1) = stormpy.compute_prob01_states(model, phiStates, psiStates)
assert prob0.number_of_set_bits() == 9
assert prob1.number_of_set_bits() == 1
(prob0, prob1) = stormpy.compute_prob01min_states(model, phiStates, psiStates)
assert prob0.number_of_set_bits() == 9
assert prob1.number_of_set_bits() == 1
(prob0, prob1) = stormpy.compute_prob01max_states(model, phiStates, psiStates)
assert prob0.number_of_set_bits() == 9
assert prob1.number_of_set_bits() == 1
labelprop = stormpy.core.Property("cora", formulaPsi.raw_formula)
result = stormpy.model_checking(model, labelprop)
assert result.get_truth_values().number_of_set_bits() == 1

program = stormpy.parse_prism_program(get_example_path("mdp", "coin2-2.nm"))
formulas = stormpy.parse_properties_for_prism_program('Pmin=? [ F "finished" & "all_coins_equal_1"]', program)
model = stormpy.build_model(program, formulas)
prob0, prob1 = stormpy.prob01min_states(model, formulas[0].raw_formula.subformula)
assert prob0.number_of_set_bits() == 94
assert prob1.number_of_set_bits() == 15
prob0, prob1 = stormpy.prob01max_states(model, formulas[0].raw_formula.subformula)
assert prob0.number_of_set_bits() == 83
assert prob1.number_of_set_bits() == 18

def test_model_checking_ctmc(self):
model = stormpy.build_model_from_drn(get_example_path("ctmc", "dft.drn"))
formulas = stormpy.parse_properties('T=? [ F "failed" ]')
Expand Down
Loading