18namespace transformer {
20template<
typename SparseModelType>
25template<
typename SparseModelType>
28 simplifiedModel =
nullptr;
29 simplifiedFormula =
nullptr;
33 return simplifyForUntilProbabilities(probOpForm);
35 return simplifyForReachabilityProbabilities(probOpForm);
37 return simplifyForBoundedUntilProbabilities(probOpForm);
43 storm::exceptions::InvalidPropertyException,
44 "The reward model specified by formula " << formula <<
" is not available in the given model.");
46 return simplifyForReachabilityRewards(rewOpForm);
48 return simplifyForCumulativeRewards(rewOpForm);
52 STORM_LOG_DEBUG(
"Simplification not possible because the formula is not supported. Formula: " << formula);
56template<
typename SparseModelType>
58 STORM_LOG_THROW(simplifiedModel, storm::exceptions::InvalidStateException,
"Tried to get the simplified model but simplification was not invoked before.");
59 return simplifiedModel;
62template<
typename SparseModelType>
64 STORM_LOG_THROW(simplifiedFormula, storm::exceptions::InvalidStateException,
65 "Tried to get the simplified formula but simplification was not invoked before.");
66 return simplifiedFormula;
69template<
typename SparseModelType>
72 STORM_LOG_DEBUG(
"Simplification not possible because the formula is not supported. Formula: " << formula);
76template<
typename SparseModelType>
84template<
typename SparseModelType>
87 STORM_LOG_DEBUG(
"Simplification not possible because the formula is not supported. Formula: " << formula);
91template<
typename SparseModelType>
94 STORM_LOG_DEBUG(
"Simplification not possible because the formula is not supported. Formula: " << formula);
98template<
typename SparseModelType>
101 STORM_LOG_DEBUG(
"Simplification not possible because the formula is not supported. Formula: " << formula);
105template<
typename SparseModelType>
107 SparseModelType
const& model,
storm::storage::BitVector const& consideredStates, boost::optional<std::string>
const& rewardModelName) {
109 auto backwardsSparseMatrix = sparseMatrix.
transpose();
112 std::vector<typename SparseModelType::ValueType> actionRewards;
113 if (rewardModelName) {
114 actionRewards = model.getRewardModel(*rewardModelName).getTotalRewardVector(sparseMatrix);
116 actionRewards = std::vector<typename SparseModelType::ValueType>(model.getTransitionMatrix().getRowCount(),
117 storm::utility::zero<typename SparseModelType::ValueType>());
122 for (
auto state : consideredStates) {
125 for (
auto const& entry : sparseMatrix.
getRowGroup(state)) {
127 selectedStates.
set(state,
false);
131 if (state && this->preserveParametricTransitions) {
132 for (
auto const& entry : backwardsSparseMatrix.getRowGroup(state)) {
134 selectedStates.
set(state,
false);
140 selectedStates.
set(state,
false);
148 flexibleMatrix, flexibleBackwardTransitions, actionRewards);
149 for (
auto state : selectedStates) {
153 auto keptRows = sparseMatrix.
getRowFilter(selectedStates);
157 std::unordered_map<std::string, typename SparseModelType::RewardModelType> rewardModels;
158 if (rewardModelName) {
160 rewardModels.insert(std::make_pair(*rewardModelName,
typename SparseModelType::RewardModelType(std::nullopt, std::move(actionRewards))));
163 return std::make_shared<SparseModelType>(std::move(newTransitionMatrix), model.getStateLabeling().getSubLabeling(selectedStates), std::move(rewardModels));
166template<
typename SparseModelType>
168 this->preserveParametricTransitions = preserveParametricTransitions;
171template<
typename SparseModelType>
173 return this->preserveParametricTransitions;
void eliminateState(storm::storage::sparse::state_type state, bool removeForwardTransitions)
A bit vector that is internally represented as a vector of 64-bit values.
void complement()
Negates all bits in the bit vector.
void set(uint64_t index, bool value=true)
Sets the given truth value at the given index.
The flexible sparse matrix is used during state elimination.
storm::storage::SparseMatrix< ValueType > createSparseMatrix()
Creates a sparse matrix from the flexible sparse matrix.
A class that holds a possibly non-square matrix in the compressed row storage format.
const_rows getRowGroup(index_type rowGroup) const
Returns an object representing the given row group.
std::vector< index_type > const & getRowGroupIndices() const
Returns the grouping of rows of this matrix.
index_type getRowGroupSize(index_type group) const
Returns the size of the given row group.
storm::storage::SparseMatrix< value_type > transpose(bool joinGroups=false, bool keepZeros=false) const
Transposes the matrix.
storm::storage::BitVector getRowFilter(storm::storage::BitVector const &groupConstraint) const
Returns a bitvector representing the set of rows, with all indices set that correspond to one of the ...
#define STORM_LOG_DEBUG(message)
#define STORM_LOG_THROW(cond, exception, message)
void filterVectorInPlace(std::vector< Type > &v, storm::storage::BitVector const &filter)
bool isConstant(ValueType const &)