Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
CommandAbstractor.h
Go to the documentation of this file.
1#pragma once
2
3#include <map>
4#include <memory>
5#include <set>
6#include <vector>
7
11
13
16
18
19namespace storm {
20namespace utility {
21namespace solver {
22class SmtSolverFactory;
23}
24} // namespace utility
25
26namespace dd {
27template<storm::dd::DdType DdType>
28class Bdd;
29
30template<storm::dd::DdType DdType, typename ValueType>
31class Add;
32} // namespace dd
33
34namespace prism {
35// Forward-declare concrete command and assignment classes.
36class Command;
37class Assignment;
38} // namespace prism
39} // namespace storm
40
41namespace storm::gbar {
42namespace abstraction {
43template<storm::dd::DdType DdType>
44class AbstractionInformation;
45
46template<storm::dd::DdType DdType>
47struct BottomStateResult;
48
49namespace prism {
50template<storm::dd::DdType DdType, typename ValueType>
52 public:
61 CommandAbstractor(storm::prism::Command const& command, AbstractionInformation<DdType>& abstractionInformation,
62 std::shared_ptr<storm::utility::solver::SmtSolverFactory> const& smtSolverFactory, bool useDecomposition,
63 bool addPredicatesForValidBlocks, bool debug);
64
70 void refine(std::vector<uint_fast64_t> const& predicates);
71
76
80 uint64_t getNumberOfUpdates(uint64_t player1Choice) const;
81
86 std::map<storm::expressions::Variable, storm::expressions::Expression> getVariableUpdates(uint64_t auxiliaryChoice) const;
87
91 std::set<storm::expressions::Variable> const& getAssignedVariables() const;
92
100
108 BottomStateResult<DdType> getBottomStateTransitions(storm::dd::Bdd<DdType> const& reachableStates, uint_fast64_t numberOfPlayer2Variables);
109
116
123
125
126 private:
135 std::pair<std::set<uint_fast64_t>, std::set<uint_fast64_t>> computeRelevantPredicates(std::vector<storm::prism::Assignment> const& assignments) const;
136
143 std::pair<std::set<uint_fast64_t>, std::vector<std::set<uint_fast64_t>>> computeRelevantPredicates() const;
144
150 bool relevantPredicatesChanged(std::pair<std::set<uint_fast64_t>, std::vector<std::set<uint_fast64_t>>> const& newRelevantPredicates) const;
151
158 void addMissingPredicates(std::pair<std::set<uint_fast64_t>, std::vector<std::set<uint_fast64_t>>> const& newRelevantPredicates);
159
167 std::vector<std::pair<storm::expressions::Variable, uint_fast64_t>> const& variablePredicates) const;
168
176 std::vector<std::vector<std::pair<storm::expressions::Variable, uint_fast64_t>>> const& variablePredicates) const;
177
181 void recomputeCachedBdd();
182
186 void recomputeCachedBddWithoutDecomposition();
187
191 void recomputeCachedBddWithDecomposition();
192
198 storm::dd::Bdd<DdType> computeMissingIdentities() const;
199
206 storm::dd::Bdd<DdType> computeMissingUpdateIdentities() const;
207
213 AbstractionInformation<DdType> const& getAbstractionInformation() const;
214
220 AbstractionInformation<DdType>& getAbstractionInformation();
221
222 // An SMT responsible for this abstract command.
223 std::unique_ptr<storm::solver::SmtSolver> smtSolver;
224
225 // The abstraction-related information.
226 std::reference_wrapper<AbstractionInformation<DdType>> abstractionInformation;
227
228 // The concrete command this abstract command refers to.
229 std::reference_wrapper<storm::prism::Command const> command;
230
231 // The variables to which this command assigns expressions.
232 std::set<storm::expressions::Variable> assignedVariables;
233
234 // The local expression-related information.
235 LocalExpressionInformation<DdType> localExpressionInformation;
236
237 // The evaluator used to translate the probability expressions.
239
240 // The currently relevant source/successor predicates and the corresponding variables.
241 std::pair<std::vector<std::pair<storm::expressions::Variable, uint_fast64_t>>,
242 std::vector<std::vector<std::pair<storm::expressions::Variable, uint_fast64_t>>>>
243 relevantPredicatesAndVariables;
244
245 // The set of all relevant predicates.
246 std::set<uint64_t> allRelevantPredicates;
247
248 // The most recent result of a call to computeDd. If nothing has changed regarding the relevant
249 // predicates, this result may be reused.
250 GameBddResult<DdType> cachedDd;
251
252 // All relevant decision variables over which to perform AllSat.
253 std::vector<storm::expressions::Variable> decisionVariables;
254
255 // A flag indicating whether to use the decomposition when abstracting.
256 bool useDecomposition;
257
258 // Whether or not to add predicates indirectly related to assignment variables to relevant source predicates.
259 bool addPredicatesForValidBlocks;
260
261 // A flag indicating whether the guard of the command was added as a predicate. If this is true, there
262 // is no need to compute bottom states.
263 bool skipBottomStates;
264
265 // A flag remembering whether we need to force recomputation of the BDD.
266 bool forceRecomputation;
267
268 // The abstract guard of the command. This is only used if the guard is not a predicate, because it can
269 // then be used to constrain the bottom state abstractor.
270 storm::dd::Bdd<DdType> abstractGuard;
271
272 // A state-set abstractor used to determine the bottom states if not all guards were added.
273 StateSetAbstractor<DdType, ValueType> bottomStateAbstractor;
274
275 // A flag that indicates whether or not debug mode is enabled.
276 bool debug;
277};
278} // namespace prism
279} // namespace abstraction
280} // namespace storm::gbar
std::set< storm::expressions::Variable > const & getAssignedVariables() const
Retrieves the assigned variables.
storm::expressions::Expression const & getGuard() const
Retrieves the guard of this command.
std::map< storm::expressions::Variable, storm::expressions::Expression > getVariableUpdates(uint64_t auxiliaryChoice) const
Retrieves a mapping from variables to expressions that define their updates wrt.
uint64_t getNumberOfUpdates(uint64_t player1Choice) const
Retrieves the number of updates of this command.
void refine(std::vector< uint_fast64_t > const &predicates)
Refines the abstract command with the given predicates.
storm::dd::Add< DdType, ValueType > getCommandUpdateProbabilitiesAdd() const
Retrieves an ADD that maps the encoding of the command and its updates to their probabilities.
storm::prism::Command const & getConcreteCommand() const
Retrieves the concrete command that is abstracted by this abstract command.
GameBddResult< DdType > abstract()
Computes the abstraction of the command wrt.
BottomStateResult< DdType > getBottomStateTransitions(storm::dd::Bdd< DdType > const &reachableStates, uint_fast64_t numberOfPlayer2Variables)
Retrieves the transitions to bottom states of this command.
The base class for all model references.
Definition SmtSolver.h:31
SFTBDDChecker::Bdd Bdd
LabParser.cpp.
Definition cli.cpp:18