Storm
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
107 return static_cast<bool>(optimalityType);
108 }
109
111 STORM_LOG_ASSERT(optimalityType, "Optimality type not set.");
112 return optimalityType.get();
113 }
114
115 // A flag that indicates whether a measure driven initial partition is to be used. If this flag is set
116 // to true, the two optional pairs phiStatesAndLabel and psiStatesAndLabel must be set. Then, the
117 // measure driven initial partition wrt. to the states phi and psi is taken.
119 boost::optional<storm::storage::BitVector> phiStates;
120 boost::optional<storm::storage::BitVector> psiStates;
121
124 boost::optional<std::set<std::string>> respectedAtomicPropositions;
125
128
129 private:
130 boost::optional<OptimizationDirection> optimalityType;
131
134 bool keepRewards;
135
137 BisimulationType type;
138
141 bool bounded;
142
149 void preserveSingleFormula(ModelType const& model, storm::logic::Formula const& formula);
150
157 void addToRespectedAtomicPropositions(std::vector<std::shared_ptr<storm::logic::AtomicExpressionFormula const>> const& expressions,
158 std::vector<std::shared_ptr<storm::logic::AtomicLabelFormula const>> const& labels);
159
160 /*
161 * Checks whether a measure driven partition is possible with the given formula and sets the necessary
162 * data if this is the case.
163 *
164 * @param model The model for which to derive the data.
165 * @param formula The formula for which to derive the data for the measure driven initial partition (if
166 * applicable).
167 */
168 void checkAndSetMeasureDrivenInitialPartition(ModelType const& model, storm::logic::Formula const& formula);
169 };
170
177 BisimulationDecomposition(ModelType const& model, Options const& options);
178
179 virtual ~BisimulationDecomposition() = default;
180
186 std::shared_ptr<ModelType> getQuotient() const;
187
193
194 protected:
203
210
219 std::vector<bisimulation::Block<BlockDataType>*>& splitterQueue) = 0;
220
225 virtual void buildQuotient() = 0;
226
230 virtual void initializeLabelBasedPartition();
231
236
240 virtual void initialize();
241
248 virtual std::pair<storm::storage::BitVector, storm::storage::BitVector> getStatesWithProbability01() = 0;
249
254
258 virtual void splitInitialPartitionBasedOnRewards(std::vector<ValueType> const& rewardVector);
259
263 virtual void splitInitialPartitionBasedOnActionRewards(std::vector<std::set<ValueType>> const& rewardVector);
264
269
270 // The model to decompose.
271 ModelType const& model;
272
273 // The backward transitions of the model.
275
276 // The options used during construction.
278
279 // The current partition (used by partition refinement).
281
282 // A comparator used for comparing the distances of constants.
284
285 // The quotient, if it was build. Otherwhise a null pointer.
286 std::shared_ptr<ModelType> quotient;
287};
288} // namespace storage
289} // namespace storm
290
291#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...