Skip to content

Commit

Permalink
Hack SparseParametricModelSimplifier.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
glatteis committed Jan 10, 2025
1 parent 2419cd6 commit af98210
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ void SparseDtmcParameterLiftingModelChecker<SparseModelType, ConstantType, Robus

if (allowModelSimplifications && graphPreserving) {
auto simplifier = storm::transformer::SparseParametricDtmcSimplifier<SparseModelType>(*dtmc);
if (!graphPreserving || !transformer::TimeTravelling::lastSavedAnnotations.empty()) {
simplifier.setSkipConstantDeterministicStateElimination(true);
}
// if (Robust) {
// simplifier.setSkipConstantDeterministicStateElimination(true);
// }
if (!simplifier.simplify(checkTask.getFormula())) {
STORM_LOG_THROW(false, storm::exceptions::UnexpectedException, "Simplifying the model was not successfull.");
}
Expand Down
10 changes: 9 additions & 1 deletion src/storm-pars/transformer/SparseParametricModelSimplifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ std::shared_ptr<SparseModelType> SparseParametricModelSimplifier<SparseModelType
}

storm::storage::SparseMatrix<typename SparseModelType::ValueType> const& sparseMatrix = model.getTransitionMatrix();
auto backwardsSparseMatrix = sparseMatrix.transpose();

// get the action-based reward values
std::vector<typename SparseModelType::ValueType> actionRewards;
Expand All @@ -131,14 +132,21 @@ std::shared_ptr<SparseModelType> SparseParametricModelSimplifier<SparseModelType
break;
}
}
// TODO: HACK to make matrix stochastic
for (auto const& entry : backwardsSparseMatrix.getRowGroup(state)) {
if (!storm::utility::isConstant(entry.getValue())) {
selectedStates.set(state, false);
break;
}
}
} else {
selectedStates.set(state, false);
}
}

// invoke elimination and obtain resulting transition matrix
storm::storage::FlexibleSparseMatrix<typename SparseModelType::ValueType> flexibleMatrix(sparseMatrix);
storm::storage::FlexibleSparseMatrix<typename SparseModelType::ValueType> flexibleBackwardTransitions(sparseMatrix.transpose(), true);
storm::storage::FlexibleSparseMatrix<typename SparseModelType::ValueType> flexibleBackwardTransitions(backwardsSparseMatrix, true);
storm::solver::stateelimination::NondeterministicModelStateEliminator<typename SparseModelType::ValueType> stateEliminator(
flexibleMatrix, flexibleBackwardTransitions, actionRewards);
for (auto state : selectedStates) {
Expand Down

0 comments on commit af98210

Please sign in to comment.