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

Save memory when doing bounded checking for sparse DTMCs #517

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ SparseDeterministicStepBoundedHorizonHelper<ValueType>::SparseDeterministicStepB
template<typename ValueType>
std::vector<ValueType> SparseDeterministicStepBoundedHorizonHelper<ValueType>::compute(Environment const& env, storm::solver::SolveGoal<ValueType>&& goal,
storm::storage::SparseMatrix<ValueType> const& transitionMatrix,
storm::storage::SparseMatrix<ValueType> const& backwardTransitions,
storm::storage::BitVector const& phiStates,
storm::storage::BitVector const& psiStates, uint64_t lowerBound,
uint64_t upperBound, ModelCheckerHint const& hint) {
Expand All @@ -40,6 +39,7 @@ std::vector<ValueType> SparseDeterministicStepBoundedHorizonHelper<ValueType>::c
if (hint.isExplicitModelCheckerHint() && hint.template asExplicitModelCheckerHint<ValueType>().getComputeOnlyMaybeStates()) {
maybeStates = hint.template asExplicitModelCheckerHint<ValueType>().getMaybeStates();
} else {
auto backwardTransitions = transitionMatrix.transpose(true);
maybeStates = storm::utility::graph::performProbGreater0(backwardTransitions, phiStates, psiStates, true, upperBound);
if (lowerBound == 0) {
maybeStates &= ~psiStates;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ class SparseDeterministicStepBoundedHorizonHelper {
public:
SparseDeterministicStepBoundedHorizonHelper();
std::vector<ValueType> compute(Environment const& env, storm::solver::SolveGoal<ValueType>&& goal,
storm::storage::SparseMatrix<ValueType> const& transitionMatrix,
storm::storage::SparseMatrix<ValueType> const& backwardTransitions, storm::storage::BitVector const& phiStates,
storm::storage::SparseMatrix<ValueType> const& transitionMatrix, storm::storage::BitVector const& phiStates,
storm::storage::BitVector const& psiStates, uint64_t lowerBound, uint64_t upperBound,
ModelCheckerHint const& hint = ModelCheckerHint());

Expand Down
4 changes: 2 additions & 2 deletions src/storm/modelchecker/prctl/SparseDtmcPrctlModelChecker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ std::unique_ptr<CheckResult> SparseDtmcPrctlModelChecker<SparseDtmcModelType>::c
storm::modelchecker::helper::SparseDeterministicStepBoundedHorizonHelper<ValueType> helper;
std::vector<ValueType> numericResult =
helper.compute(env, storm::solver::SolveGoal<ValueType>(this->getModel(), checkTask), this->getModel().getTransitionMatrix(),
this->getModel().getBackwardTransitions(), leftResult.getTruthValuesVector(), rightResult.getTruthValuesVector(),
pathFormula.getNonStrictLowerBound<uint64_t>(), pathFormula.getNonStrictUpperBound<uint64_t>(), checkTask.getHint());
leftResult.getTruthValuesVector(), rightResult.getTruthValuesVector(), pathFormula.getNonStrictLowerBound<uint64_t>(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tquatmann is it clear why we referred to the backward transitions previously?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They're used below the line where they are calculated now, in a call to performProbGreater0:

maybeStates = storm::utility::graph::performProbGreater0(backwardTransitions, phiStates, psiStates, true, upperBound);
which is defined in graph.cpp:
storm::storage::BitVector performProbGreater0(storm::storage::SparseMatrix<T> const& backwardTransitions, storm::storage::BitVector const& phiStates,

This function iterates over the rows of the backwards transitions, as it essentially does a reverse flood-fill to find the states which can reach the target state(s). Using the non-transposed matrix would thus require iterating over a column, which is slow and I'm not sure it's even possible with how sparse matrices are implemented.

I don't know off of the top of my head if the same result can be achieved in a forwards manner, but I think it would be much slower since it would probably require maximalSteps iterations over all vertices.

This was the only use of it in the helper, I'm not sure if there are any other potential reasons to refer to the backward transitions but I doubt it.

pathFormula.getNonStrictUpperBound<uint64_t>(), checkTask.getHint());
std::unique_ptr<CheckResult> result = std::unique_ptr<CheckResult>(new ExplicitQuantitativeCheckResult<ValueType>(std::move(numericResult)));
return result;
}
Expand Down
Loading