Storm 1.10.0.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
BisimulationDecomposition.h
Go to the documentation of this file.
1#ifndef STORM_STORAGE_BISIMULATIONDECOMPOSITION_H_
2#define STORM_STORAGE_BISIMULATIONDECOMPOSITION_H_
3
12
14
17
18namespace storm {
19namespace logic {
20class Formula;
21}
22
23namespace storage {
24
40
44template<typename ModelType, typename BlockDataType>
45class BisimulationDecomposition : public Decomposition<StateBlock> {
46 public:
47 typedef typename ModelType::ValueType ValueType;
48 typedef typename ModelType::RewardModelType RewardModelType;
49
50 // A class that offers the possibility to customize the bisimulation.
51 struct Options {
52 // Creates an object representing the default values for all options.
53 Options();
54
63 Options(ModelType const& model, storm::logic::Formula const& formula);
64
73 Options(ModelType const& model, std::vector<std::shared_ptr<storm::logic::Formula const>> const& formulas);
74
80 void preserveFormula(storm::logic::Formula const& formula);
81
88 if (t == BisimulationType::Weak) {
89 bounded = false;
90 }
91 type = t;
92 }
93
95 return this->type;
96 }
97
98 bool getBounded() const {
99 return this->bounded;
100 }
101
102 bool getKeepRewards() const {
103 return this->keepRewards;
104 }
105
106 void setKeepRewards(bool keepRewards) {
107 this->keepRewards = keepRewards;
108 }
109
111 return static_cast<bool>(optimalityType);
112 }
113
115 STORM_LOG_ASSERT(optimalityType, "Optimality type not set.");
116 return optimalityType.get();
117 }
118
119 // A flag that indicates whether a measure driven initial partition is to be used. If this flag is set
120 // to true, the two optional pairs phiStatesAndLabel and psiStatesAndLabel must be set. Then, the
121 // measure driven initial partition wrt. to the states phi and psi is taken.
123 boost::optional<storm::storage::BitVector> phiStates;
124 boost::optional<storm::storage::BitVector> psiStates;
125
128 boost::optional<std::set<std::string>> respectedAtomicPropositions;
129
132
133 private:
134 boost::optional<OptimizationDirection> optimalityType;
135
138 bool keepRewards;
139
141 BisimulationType type;
142
145 bool bounded;
146
153 void preserveSingleFormula(ModelType const& model, storm::logic::Formula const& formula);
154
161 void addToRespectedAtomicPropositions(std::vector<std::shared_ptr<storm::logic::AtomicExpressionFormula const>> const& expressions,
162 std::vector<std::shared_ptr<storm::logic::AtomicLabelFormula const>> const& labels);
163
164 /*
165 * Checks whether a measure driven partition is possible with the given formula and sets the necessary
166 * data if this is the case.
167 *
168 * @param model The model for which to derive the data.
169 * @param formula The formula for which to derive the data for the measure driven initial partition (if
170 * applicable).
171 */
172 void checkAndSetMeasureDrivenInitialPartition(ModelType const& model, storm::logic::Formula const& formula);
173 };
174
181 BisimulationDecomposition(ModelType const& model, Options const& options);
182
183 virtual ~BisimulationDecomposition() = default;
184
190 std::shared_ptr<ModelType> getQuotient() const;
191
197
198 protected:
207
214
223 std::vector<bisimulation::Block<BlockDataType>*>& splitterQueue) = 0;
224
229 virtual void buildQuotient() = 0;
230
234 virtual void initializeLabelBasedPartition();
235
240
244 virtual void initialize();
245
252 virtual std::pair<storm::storage::BitVector, storm::storage::BitVector> getStatesWithProbability01() = 0;
253
258
262 virtual void splitInitialPartitionBasedOnRewards(std::vector<ValueType> const& rewardVector);
263
267 virtual void splitInitialPartitionBasedOnActionRewards(std::vector<std::set<ValueType>> const& rewardVector);
268
273
274 // The model to decompose.
275 ModelType const& model;
276
277 // The backward transitions of the model.
279
280 // The options used during construction.
282
283 // The current partition (used by partition refinement).
285
286 // A comparator used for comparing the distances of constants.
288
289 // The quotient, if it was build. Otherwhise a null pointer.
290 std::shared_ptr<ModelType> quotient;
291};
292} // namespace storage
293} // namespace storm
294
295#endif /* STORM_STORAGE_BISIMULATIONDECOMPOSITION_H_ */
This class is the superclass of all decompositions of a sparse model into its bisimulation quotient.
storm::storage::SparseMatrix< ValueType > backwardTransitions
virtual void buildQuotient()=0
Builds the quotient model based on the previously computed equivalence classes (stored in the blocks ...
virtual void refinePartitionBasedOnSplitter(bisimulation::Block< BlockDataType > &splitter, std::vector< bisimulation::Block< BlockDataType > * > &splitterQueue)=0
Refines the partition by considering the given splitter.
storm::utility::ConstantsComparator< ValueType > comparator
std::shared_ptr< ModelType > getQuotient() const
Retrieves the quotient of the model under the computed bisimulation.
void performPartitionRefinement()
Performs the partition refinement on the model and thereby computes the equivalence classes under str...
virtual void splitInitialPartitionBasedOnRewards()
Splits the initial partition based on the (unique) reward model of the current model.
virtual void splitInitialPartitionBasedOnActionRewards(std::vector< std::set< ValueType > > const &rewardVector)
Splits the initial partition based on the given vector of action rewards.
storm::storage::bisimulation::Partition< BlockDataType > partition
void computeBisimulationDecomposition()
Computes the decomposition of the model into bisimulation equivalence classes.
void extractDecompositionBlocks()
Constructs the blocks of the decomposition object based on the current partition.
virtual std::pair< storm::storage::BitVector, storm::storage::BitVector > getStatesWithProbability01()=0
Computes the set of states with probability 0/1 for satisfying phi until psi.
virtual void initializeMeasureDrivenPartition()
Creates the measure-driven initial partition for reaching psi states from phi states.
virtual void initializeLabelBasedPartition()
Initializes the initial partition based on all respected labels.
virtual void initialize()
A function that can initialize auxiliary data structures.
This class represents the decomposition of a model into blocks which are of the template type.
A class that holds a possibly non-square matrix in the compressed row storage format.
#define STORM_LOG_ASSERT(cond, message)
Definition macros.h:11
SettingsType const & getModule()
Get module.
BisimulationType resolveBisimulationTypeChoice(BisimulationTypeChoice c)
LabParser.cpp.
Definition cli.cpp:18
void preserveFormula(storm::logic::Formula const &formula)
Changes the options in a way that the given formula is preserved.
boost::optional< storm::storage::BitVector > psiStates
boost::optional< storm::storage::BitVector > phiStates
void setType(BisimulationType t)
Sets the bisimulation type.
boost::optional< std::set< std::string > > respectedAtomicPropositions
An optional set of strings that indicate which of the atomic propositions of the model are to be resp...
bool buildQuotient
A flag that governs whether the quotient model is actually built or only the decomposition is compute...