Storm 1.11.1.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
13
15
18
19namespace storm {
20namespace logic {
21class Formula;
22}
23
24namespace storage {
25
27 switch (c) {
33 if (storm::settings::getModule<storm::settings::modules::BisimulationSettings>().isWeakBisimulationSet()) {
35 } else {
37 }
38 }
40}
41
45template<typename ModelType, typename BlockDataType>
46class BisimulationDecomposition : public Decomposition<StateBlock> {
47 public:
48 typedef typename ModelType::ValueType ValueType;
49 typedef typename ModelType::RewardModelType RewardModelType;
50
51 // A class that offers the possibility to customize the bisimulation.
52 struct Options {
53 // Creates an object representing the default values for all options.
54 Options();
55
64 Options(ModelType const& model, storm::logic::Formula const& formula);
65
74 Options(ModelType const& model, std::vector<std::shared_ptr<storm::logic::Formula const>> const& formulas);
75
81 void preserveFormula(storm::logic::Formula const& formula);
82
89 if (t == BisimulationType::Weak) {
90 STORM_LOG_WARN_COND(!bounded, "Weak bisimulation does not preserve bounded properties.");
91 STORM_LOG_WARN_COND(!discounted, "Weak bisimulation does not preserve discounted properties.");
92 bounded = false;
93 discounted = false;
94 }
95 type = t;
96 }
97
99 return this->type;
100 }
101
102 bool getBounded() const {
103 return this->bounded;
104 }
105
106 bool getDiscounted() const {
107 return this->discounted;
108 }
109
110 bool getKeepRewards() const {
111 return this->keepRewards;
112 }
113
114 void setKeepRewards(bool keepRewards) {
115 this->keepRewards = keepRewards;
116 }
117
119 return static_cast<bool>(optimalityType);
120 }
121
124 ? storm::utility::zero<ValueType>()
125 : storm::utility::convertNumber<ValueType>(storm::settings::getModule<storm::settings::modules::GeneralSettings>().getPrecision());
126 }
127
129 STORM_LOG_ASSERT(optimalityType, "Optimality type not set.");
130 return optimalityType.get();
131 }
132
133 // A flag that indicates whether a measure driven initial partition is to be used. If this flag is set
134 // to true, the two optional pairs phiStatesAndLabel and psiStatesAndLabel must be set. Then, the
135 // measure driven initial partition wrt. to the states phi and psi is taken.
137 boost::optional<storm::storage::BitVector> phiStates;
138 boost::optional<storm::storage::BitVector> psiStates;
139
142 boost::optional<std::set<std::string>> respectedAtomicPropositions;
143
146
147 private:
148 boost::optional<OptimizationDirection> optimalityType;
149
152 bool keepRewards;
153
155 BisimulationType type;
156
159 bool bounded;
160
163 bool discounted;
164
171 void preserveSingleFormula(ModelType const& model, storm::logic::Formula const& formula);
172
179 void addToRespectedAtomicPropositions(std::vector<std::shared_ptr<storm::logic::AtomicExpressionFormula const>> const& expressions,
180 std::vector<std::shared_ptr<storm::logic::AtomicLabelFormula const>> const& labels);
181
182 /*
183 * Checks whether a measure driven partition is possible with the given formula and sets the necessary
184 * data if this is the case.
185 *
186 * @param model The model for which to derive the data.
187 * @param formula The formula for which to derive the data for the measure driven initial partition (if
188 * applicable).
189 */
190 void checkAndSetMeasureDrivenInitialPartition(ModelType const& model, storm::logic::Formula const& formula);
191 };
192
199 BisimulationDecomposition(ModelType const& model, Options const& options);
200
201 virtual ~BisimulationDecomposition() = default;
202
208 std::shared_ptr<ModelType> getQuotient() const;
209
215
216 protected:
225
232
241 std::vector<bisimulation::Block<BlockDataType>*>& splitterQueue) = 0;
242
247 virtual void buildQuotient() = 0;
248
252 virtual void initializeLabelBasedPartition();
253
258
262 virtual void initialize();
263
270 virtual std::pair<storm::storage::BitVector, storm::storage::BitVector> getStatesWithProbability01() = 0;
271
276
280 virtual void splitInitialPartitionBasedOnRewards(std::vector<ValueType> const& rewardVector);
281
285 virtual void splitInitialPartitionBasedOnActionRewards(std::vector<std::set<ValueType>> const& rewardVector);
286
291
292 // The model to decompose.
293 ModelType const& model;
294
295 // The backward transitions of the model.
297
298 // The options used during construction.
300
301 // The current partition (used by partition refinement).
303
304 // A comparator used for comparing the distances of constants.
306
307 // The quotient, if it was build. Otherwhise a null pointer.
308 std::shared_ptr<ModelType> quotient;
309};
310} // namespace storage
311} // namespace storm
312
313#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
#define STORM_LOG_WARN_COND(cond, message)
Definition macros.h:38
BisimulationType resolveBisimulationTypeChoice(BisimulationTypeChoice c)
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...