17namespace transformer {
19template<
typename SparseModelType>
24template<
typename SparseModelType>
27 simplifiedModel =
nullptr;
28 simplifiedFormula =
nullptr;
32 return simplifyForUntilProbabilities(probOpForm);
34 return simplifyForReachabilityProbabilities(probOpForm);
36 return simplifyForBoundedUntilProbabilities(probOpForm);
42 storm::exceptions::InvalidPropertyException,
43 "The reward model specified by formula " << formula <<
" is not available in the given model.");
45 return simplifyForReachabilityRewards(rewOpForm);
47 return simplifyForCumulativeRewards(rewOpForm);
51 STORM_LOG_DEBUG(
"Simplification not possible because the formula is not supported. Formula: " << formula);
55template<
typename SparseModelType>
57 STORM_LOG_THROW(simplifiedModel, storm::exceptions::InvalidStateException,
"Tried to get the simplified model but simplification was not invoked before.");
58 return simplifiedModel;
61template<
typename SparseModelType>
63 STORM_LOG_THROW(simplifiedFormula, storm::exceptions::InvalidStateException,
64 "Tried to get the simplified formula but simplification was not invoked before.");
65 return simplifiedFormula;
68template<
typename SparseModelType>
71 STORM_LOG_DEBUG(
"Simplification not possible because the formula is not supported. Formula: " << formula);
75template<
typename SparseModelType>
83template<
typename SparseModelType>
86 STORM_LOG_DEBUG(
"Simplification not possible because the formula is not supported. Formula: " << formula);
90template<
typename SparseModelType>
93 STORM_LOG_DEBUG(
"Simplification not possible because the formula is not supported. Formula: " << formula);
97template<
typename SparseModelType>
100 STORM_LOG_DEBUG(
"Simplification not possible because the formula is not supported. Formula: " << formula);
104template<
typename SparseModelType>
106 SparseModelType
const& model,
storm::storage::BitVector const& consideredStates, boost::optional<std::string>
const& rewardModelName) {
110 std::vector<typename SparseModelType::ValueType> actionRewards;
111 if (rewardModelName) {
112 actionRewards = model.getRewardModel(*rewardModelName).getTotalRewardVector(sparseMatrix);
114 actionRewards = std::vector<typename SparseModelType::ValueType>(model.getTransitionMatrix().getRowCount(),
115 storm::utility::zero<typename SparseModelType::ValueType>());
120 for (
auto state : consideredStates) {
123 for (
auto const& entry : sparseMatrix.
getRowGroup(state)) {
125 selectedStates.
set(state,
false);
130 selectedStates.
set(state,
false);
138 flexibleMatrix, flexibleBackwardTransitions, actionRewards);
139 for (
auto state : selectedStates) {
143 auto keptRows = sparseMatrix.
getRowFilter(selectedStates);
147 std::unordered_map<std::string, typename SparseModelType::RewardModelType> rewardModels;
148 if (rewardModelName) {
150 rewardModels.insert(std::make_pair(*rewardModelName,
typename SparseModelType::RewardModelType(std::nullopt, std::move(actionRewards))));
153 return std::make_shared<SparseModelType>(std::move(newTransitionMatrix), model.getStateLabeling().getSubLabeling(selectedStates), std::move(rewardModels));
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(uint_fast64_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 &)