Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
MenuGameRefiner.h
Go to the documentation of this file.
1#pragma once
2
3#include <functional>
4#include <memory>
5#include <vector>
6
7#include <boost/optional.hpp>
8
12
16
18
20
22
23namespace storm {
24namespace dd {
25class Odd;
26}
27
28namespace storage {
29class BitVector;
30class ExplicitGameStrategyPair;
31} // namespace storage
32} // namespace storm
33
34namespace storm::gbar {
35namespace abstraction {
36
37template<storm::dd::DdType Type, typename ValueType>
38class MenuGameAbstractor;
39
40template<storm::dd::DdType Type, typename ValueType>
41class MenuGame;
42
44 public:
46
48 RefinementPredicates(Source const& source, std::vector<storm::expressions::Expression> const& predicates);
49
50 Source getSource() const;
51 std::vector<storm::expressions::Expression> const& getPredicates() const;
52 void addPredicates(std::vector<storm::expressions::Expression> const& newPredicates);
53
54 private:
55 Source source;
56 std::vector<storm::expressions::Expression> predicates;
57};
58
59template<storm::dd::DdType Type, typename ValueType>
67
68template<storm::dd::DdType Type, typename ValueType>
77
78template<typename ValueType>
81 ExplicitPivotStateResult(uint64_t pivotState, ValueType distance, std::vector<std::pair<uint64_t, uint64_t>>&& predecessors)
83 // Intentionally left empty.
84 }
85
86 uint64_t pivotState;
87
89 ValueType distance;
90
92 static const uint64_t NO_PREDECESSOR;
93
95 std::vector<std::pair<uint64_t, uint64_t>> predecessors;
96};
97
99
100template<typename ValueType>
102
105
106 MenuGameRefinerOptions(std::vector<std::vector<storm::expressions::Expression>>&& refinementPredicates)
108 // Intentionally left empty.
109 }
110
111 std::vector<std::vector<storm::expressions::Expression>> refinementPredicates;
112};
113
114template<storm::dd::DdType Type, typename ValueType>
116 public:
120 MenuGameRefiner(MenuGameAbstractor<Type, ValueType>& abstractor, std::unique_ptr<storm::solver::SmtSolver>&& smtSolver,
122
130 void refine(std::vector<storm::expressions::Expression> const& predicates, bool allowInjection = true) const;
131
137 bool refine(storm::gbar::abstraction::MenuGame<Type, ValueType> const& game, storm::dd::Bdd<Type> const& transitionMatrixBdd,
138 SymbolicQualitativeGameResultMinMax<Type> const& qualitativeResult) const;
139
146 storm::storage::SparseMatrix<ValueType> const& transitionMatrix, std::vector<uint64_t> const& player1Grouping,
147 std::vector<uint64_t> const& player1Labeling, std::vector<uint64_t> const& player2Labeling, storm::storage::BitVector const& initialStates,
148 storm::storage::BitVector const& constraintStates, storm::storage::BitVector const& targetStates,
149 ExplicitQualitativeGameResultMinMax const& qualitativeResult, storage::ExplicitGameStrategyPair const& minStrategyPair,
150 storage::ExplicitGameStrategyPair const& maxStrategyPair) const;
151
158 storm::storage::SparseMatrix<ValueType> const& transitionMatrix, std::vector<uint64_t> const& player1Grouping,
159 std::vector<uint64_t> const& player1Labeling, std::vector<uint64_t> const& player2Labeling, storm::storage::BitVector const& initialStates,
160 storm::storage::BitVector const& constraintStates, storm::storage::BitVector const& targetStates,
161 ExplicitQuantitativeResultMinMax<ValueType> const& qualitativeResult, storage::ExplicitGameStrategyPair const& minStrategyPair,
162 storage::ExplicitGameStrategyPair const& maxStrategyPair) const;
163
169 bool refine(storm::gbar::abstraction::MenuGame<Type, ValueType> const& game, storm::dd::Bdd<Type> const& transitionMatrixBdd,
170 SymbolicQuantitativeGameResultMinMax<Type, ValueType> const& quantitativeResult) const;
171
175 bool addedAllGuards() const;
176
177 private:
178 RefinementPredicates derivePredicatesFromDifferingChoices(storm::dd::Bdd<Type> const& player1Choice, storm::dd::Bdd<Type> const& lowerChoice,
179 storm::dd::Bdd<Type> const& upperChoice) const;
180 RefinementPredicates derivePredicatesFromChoice(storm::gbar::abstraction::MenuGame<Type, ValueType> const& game, storm::dd::Bdd<Type> const& pivotState,
181 storm::dd::Bdd<Type> const& player1Choice, storm::dd::Bdd<Type> const& choice,
182 storm::dd::Bdd<Type> const& choiceSuccessors) const;
183 RefinementPredicates derivePredicatesFromPivotState(storm::gbar::abstraction::MenuGame<Type, ValueType> const& game, storm::dd::Bdd<Type> const& pivotState,
184 storm::dd::Bdd<Type> const& minPlayer1Strategy, storm::dd::Bdd<Type> const& minPlayer2Strategy,
185 storm::dd::Bdd<Type> const& maxPlayer1Strategy, storm::dd::Bdd<Type> const& maxPlayer2Strategy) const;
186
190 std::vector<storm::expressions::Expression> preprocessPredicates(std::vector<storm::expressions::Expression> const& predicates,
191 RefinementPredicates::Source const& source) const;
192
196 std::vector<RefinementCommand> createGlobalRefinement(std::vector<storm::expressions::Expression> const& predicates) const;
197
198 boost::optional<RefinementPredicates> derivePredicatesFromInterpolationFromTrace(
199 storm::expressions::ExpressionManager& interpolationManager, std::vector<std::vector<storm::expressions::Expression>> const& trace,
200 std::map<storm::expressions::Variable, storm::expressions::Expression> const& variableSubstitution) const;
201
202 boost::optional<RefinementPredicates> derivePredicatesFromInterpolation(storm::gbar::abstraction::MenuGame<Type, ValueType> const& game,
203 SymbolicPivotStateResult<Type, ValueType> const& symbolicPivotStateResult,
204 storm::dd::Bdd<Type> const& minPlayer1Strategy,
205 storm::dd::Bdd<Type> const& minPlayer2Strategy,
206 storm::dd::Bdd<Type> const& maxPlayer1Strategy,
207 storm::dd::Bdd<Type> const& maxPlayer2Strategy) const;
208 std::pair<std::vector<std::vector<storm::expressions::Expression>>, std::map<storm::expressions::Variable, storm::expressions::Expression>> buildTrace(
210 storm::dd::Bdd<Type> const& spanningTree, storm::dd::Bdd<Type> const& pivotState) const;
211
212 std::pair<std::vector<uint64_t>, std::vector<uint64_t>> buildReversedLabeledPath(ExplicitPivotStateResult<ValueType> const& pivotStateResult) const;
213 std::pair<std::vector<std::vector<storm::expressions::Expression>>, std::map<storm::expressions::Variable, storm::expressions::Expression>>
214 buildTraceFromReversedLabeledPath(storm::expressions::ExpressionManager& expressionManager, std::vector<uint64_t> const& reversedPath,
215 std::vector<uint64_t> const& reversedLabels, storm::dd::Odd const& odd,
216 std::vector<uint64_t> const* stateToOffset = nullptr) const;
217 boost::optional<RefinementPredicates> derivePredicatesFromInterpolation(storm::gbar::abstraction::MenuGame<Type, ValueType> const& game,
218 ExplicitPivotStateResult<ValueType> const& pivotStateResult,
219 storm::dd::Odd const& odd) const;
220
221 boost::optional<RefinementPredicates> derivePredicatesFromInterpolationReversedPath(storm::dd::Odd const& odd,
222 storm::expressions::ExpressionManager& interpolationManager,
223 std::vector<uint64_t> const& reversedPath,
224 std::vector<uint64_t> const& stateToOffset,
225 std::vector<uint64_t> const& player1Labels) const;
226
227 void performRefinement(std::vector<RefinementCommand> const& refinementCommands, bool allowInjection = true) const;
228
230 std::reference_wrapper<MenuGameAbstractor<Type, ValueType>> abstractor;
231
233 bool useInterpolation;
234
236 bool splitAll;
237
239 bool splitPredicates;
240
242 bool rankPredicates;
243
245 bool addPredicatesEagerly;
246
248 bool addedAllGuardsFlag;
249
252 mutable std::vector<std::vector<storm::expressions::Expression>> refinementPredicatesToInject;
253
256
259
261 mutable storm::expressions::EquivalenceChecker equivalenceChecker;
262};
263
264} // namespace abstraction
265} // namespace storm::gbar
This class is responsible for managing a set of typed variables and all expressions using these varia...
This class represents a discrete-time stochastic two-player game.
Definition MenuGame.h:16
bool addedAllGuards() const
Retrieves whether all guards were added.
void refine(std::vector< storm::expressions::Expression > const &predicates, bool allowInjection=true) const
Refines the abstractor with the given predicates.
void addPredicates(std::vector< storm::expressions::Expression > const &newPredicates)
std::vector< storm::expressions::Expression > const & getPredicates() const
A bit vector that is internally represented as a vector of 64-bit values.
Definition BitVector.h:18
A class that holds a possibly non-square matrix in the compressed row storage format.
storage::BitVector BitVector
LabParser.cpp.
Definition cli.cpp:18
ValueType distance
The distance with which the state in question is reached.
static const uint64_t NO_PREDECESSOR
The value filled in for states without predecessors in the search.
ExplicitPivotStateResult(uint64_t pivotState, ValueType distance, std::vector< std::pair< uint64_t, uint64_t > > &&predecessors)
std::vector< std::pair< uint64_t, uint64_t > > predecessors
The predecessors for the states to obtain the given distance.
std::vector< std::vector< storm::expressions::Expression > > refinementPredicates
MenuGameRefinerOptions(std::vector< std::vector< storm::expressions::Expression > > &&refinementPredicates)
boost::optional< SymbolicMostProbablePathsResult< Type, ValueType > > symbolicMostProbablePathsResult