Storm 1.11.1.1
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
199 storm::dd::Bdd<DdType> computeMissingUpdateIdentities() const;
200
206 AbstractionInformation<DdType> const& getAbstractionInformation() const;
207
213 AbstractionInformation<DdType>& getAbstractionInformation();
214
215 // An SMT responsible for this abstract command.
216 std::unique_ptr<storm::solver::SmtSolver> smtSolver;
217
218 // The abstraction-related information.
219 std::reference_wrapper<AbstractionInformation<DdType>> abstractionInformation;
220
221 // The concrete command this abstract command refers to.
222 std::reference_wrapper<storm::prism::Command const> command;
223
224 // The variables to which this command assigns expressions.
225 std::set<storm::expressions::Variable> assignedVariables;
226
227 // The local expression-related information.
228 LocalExpressionInformation<DdType> localExpressionInformation;
229
230 // The evaluator used to translate the probability expressions.
232
233 // The currently relevant source/successor predicates and the corresponding variables.
234 std::pair<std::vector<std::pair<storm::expressions::Variable, uint_fast64_t>>,
235 std::vector<std::vector<std::pair<storm::expressions::Variable, uint_fast64_t>>>>
236 relevantPredicatesAndVariables;
237
238 // The set of all relevant predicates.
239 std::set<uint64_t> allRelevantPredicates;
240
241 // The most recent result of a call to computeDd. If nothing has changed regarding the relevant
242 // predicates, this result may be reused.
243 GameBddResult<DdType> cachedDd;
244
245 // All relevant decision variables over which to perform AllSat.
246 std::vector<storm::expressions::Variable> decisionVariables;
247
248 // A flag indicating whether to use the decomposition when abstracting.
249 bool useDecomposition;
250
251 // Whether or not to add predicates indirectly related to assignment variables to relevant source predicates.
252 bool addPredicatesForValidBlocks;
253
254 // A flag indicating whether the guard of the command was added as a predicate. If this is true, there
255 // is no need to compute bottom states.
256 bool skipBottomStates;
257
258 // A flag remembering whether we need to force recomputation of the BDD.
259 bool forceRecomputation;
260
261 // The abstract guard of the command. This is only used if the guard is not a predicate, because it can
262 // then be used to constrain the bottom state abstractor.
263 storm::dd::Bdd<DdType> abstractGuard;
264
265 // A state-set abstractor used to determine the bottom states if not all guards were added.
266 StateSetAbstractor<DdType, ValueType> bottomStateAbstractor;
267
268 // A flag that indicates whether or not debug mode is enabled.
269 bool debug;
270};
271} // namespace prism
272} // namespace abstraction
273} // 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