Browse Source

prob01min and prob01max now map on prob01 for dtmcs

refactoring
sjunges 8 years ago
parent
commit
4bfa6776ed
  1. 4
      lib/stormpy/__init__.py
  2. 6
      tests/core/test_modelchecking.py

4
lib/stormpy/__init__.py

@ -76,12 +76,16 @@ def compute_prob01_states(model, phi_states, psi_states):
return core._compute_prob01states_double(model, phi_states, psi_states) return core._compute_prob01states_double(model, phi_states, psi_states)
def compute_prob01min_states(model, phi_states, psi_states): def compute_prob01min_states(model, phi_states, psi_states):
if model.model_type == ModelType.DTMC:
return compute_prob01_states(model, phi_states, psi_states)
if model.supports_parameters: if model.supports_parameters:
return core._compute_prob01states_min_rationalfunc(model, phi_states, psi_states) return core._compute_prob01states_min_rationalfunc(model, phi_states, psi_states)
else: else:
return core._compute_prob01states_min_double(model, phi_states, psi_states) return core._compute_prob01states_min_double(model, phi_states, psi_states)
def compute_prob01max_states(model, phi_states, psi_states): def compute_prob01max_states(model, phi_states, psi_states):
if model.model_type == ModelType.DTMC:
return compute_prob01_states(model, phi_states, psi_states)
if model.supports_parameters: if model.supports_parameters:
return core._compute_prob01states_max_rationalfunc(model, phi_states, psi_states) return core._compute_prob01states_max_rationalfunc(model, phi_states, psi_states)
else: else:

6
tests/core/test_modelchecking.py

@ -64,6 +64,12 @@ class TestModelChecking:
(prob0, prob1) = stormpy.compute_prob01_states(model, phiStates, psiStates) (prob0, prob1) = stormpy.compute_prob01_states(model, phiStates, psiStates)
assert prob0.number_of_set_bits() == 9 assert prob0.number_of_set_bits() == 9
assert prob1.number_of_set_bits() == 1 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) labelprop = stormpy.core.Property("cora", formulaPsi.raw_formula)
result = stormpy.model_checking(model, labelprop) result = stormpy.model_checking(model, labelprop)
assert result.get_truth_values().number_of_set_bits() == 1 assert result.get_truth_values().number_of_set_bits() == 1
Loading…
Cancel
Save