Storm 1.14.0.1
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;
31} // namespace storage
32} // namespace storm
33
34namespace storm::gbar {
35namespace abstraction {
36
37template<storm::dd::DdType Type, typename ValueType>
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
103template<storm::dd::DdType Type, typename ValueType>
105 public:
109 MenuGameRefiner(MenuGameAbstractor<Type, ValueType>& abstractor, std::unique_ptr<storm::solver::SmtSolver>&& smtSolver,
110 AbstractionOptions const& options = AbstractionOptions());
111
119 void refine(std::vector<storm::expressions::Expression> const& predicates, bool allowInjection = true) const;
120
126 bool refine(storm::gbar::abstraction::MenuGame<Type, ValueType> const& game, storm::dd::Bdd<Type> const& transitionMatrixBdd,
127 SymbolicQualitativeGameResultMinMax<Type> const& qualitativeResult) const;
128
135 storm::storage::SparseMatrix<ValueType> const& transitionMatrix, std::vector<uint64_t> const& player1Grouping,
136 std::vector<uint64_t> const& player1Labeling, std::vector<uint64_t> const& player2Labeling, storm::storage::BitVector const& initialStates,
137 storm::storage::BitVector const& constraintStates, storm::storage::BitVector const& targetStates,
138 ExplicitQualitativeGameResultMinMax const& qualitativeResult, storage::ExplicitGameStrategyPair const& minStrategyPair,
139 storage::ExplicitGameStrategyPair const& maxStrategyPair) const;
140
147 storm::storage::SparseMatrix<ValueType> const& transitionMatrix, std::vector<uint64_t> const& player1Grouping,
148 std::vector<uint64_t> const& player1Labeling, std::vector<uint64_t> const& player2Labeling, storm::storage::BitVector const& initialStates,
149 storm::storage::BitVector const& constraintStates, storm::storage::BitVector const& targetStates,
150 ExplicitQuantitativeResultMinMax<ValueType> const& qualitativeResult, storage::ExplicitGameStrategyPair const& minStrategyPair,
151 storage::ExplicitGameStrategyPair const& maxStrategyPair) const;
152
158 bool refine(storm::gbar::abstraction::MenuGame<Type, ValueType> const& game, storm::dd::Bdd<Type> const& transitionMatrixBdd,
159 SymbolicQuantitativeGameResultMinMax<Type, ValueType> const& quantitativeResult) const;
160
164 bool addedAllGuards() const;
165
166 private:
167 RefinementPredicates derivePredicatesFromDifferingChoices(storm::dd::Bdd<Type> const& player1Choice, storm::dd::Bdd<Type> const& lowerChoice,
168 storm::dd::Bdd<Type> const& upperChoice) const;
169 RefinementPredicates derivePredicatesFromChoice(storm::gbar::abstraction::MenuGame<Type, ValueType> const& game, storm::dd::Bdd<Type> const& pivotState,
170 storm::dd::Bdd<Type> const& player1Choice, storm::dd::Bdd<Type> const& choice,
171 storm::dd::Bdd<Type> const& choiceSuccessors) const;
172 RefinementPredicates derivePredicatesFromPivotState(storm::gbar::abstraction::MenuGame<Type, ValueType> const& game, storm::dd::Bdd<Type> const& pivotState,
173 storm::dd::Bdd<Type> const& minPlayer1Strategy, storm::dd::Bdd<Type> const& minPlayer2Strategy,
174 storm::dd::Bdd<Type> const& maxPlayer1Strategy, storm::dd::Bdd<Type> const& maxPlayer2Strategy) const;
175
179 std::vector<storm::expressions::Expression> preprocessPredicates(std::vector<storm::expressions::Expression> const& predicates,
180 RefinementPredicates::Source const& source) const;
181
185 std::vector<RefinementCommand> createGlobalRefinement(std::vector<storm::expressions::Expression> const& predicates) const;
186
187 boost::optional<RefinementPredicates> derivePredicatesFromInterpolationFromTrace(
188 storm::expressions::ExpressionManager& interpolationManager, std::vector<std::vector<storm::expressions::Expression>> const& trace,
189 std::map<storm::expressions::Variable, storm::expressions::Expression> const& variableSubstitution) const;
190
191 boost::optional<RefinementPredicates> derivePredicatesFromInterpolation(storm::gbar::abstraction::MenuGame<Type, ValueType> const& game,
192 SymbolicPivotStateResult<Type, ValueType> const& symbolicPivotStateResult,
193 storm::dd::Bdd<Type> const& minPlayer1Strategy,
194 storm::dd::Bdd<Type> const& minPlayer2Strategy,
195 storm::dd::Bdd<Type> const& maxPlayer1Strategy,
196 storm::dd::Bdd<Type> const& maxPlayer2Strategy) const;
197 std::pair<std::vector<std::vector<storm::expressions::Expression>>, std::map<storm::expressions::Variable, storm::expressions::Expression>> buildTrace(
199 storm::dd::Bdd<Type> const& spanningTree, storm::dd::Bdd<Type> const& pivotState) const;
200
201 std::pair<std::vector<uint64_t>, std::vector<uint64_t>> buildReversedLabeledPath(ExplicitPivotStateResult<ValueType> const& pivotStateResult) const;
202 std::pair<std::vector<std::vector<storm::expressions::Expression>>, std::map<storm::expressions::Variable, storm::expressions::Expression>>
203 buildTraceFromReversedLabeledPath(storm::expressions::ExpressionManager& expressionManager, std::vector<uint64_t> const& reversedPath,
204 std::vector<uint64_t> const& reversedLabels, storm::dd::Odd const& odd,
205 std::vector<uint64_t> const* stateToOffset = nullptr) const;
206 boost::optional<RefinementPredicates> derivePredicatesFromInterpolation(storm::gbar::abstraction::MenuGame<Type, ValueType> const& game,
207 ExplicitPivotStateResult<ValueType> const& pivotStateResult,
208 storm::dd::Odd const& odd) const;
209
210 boost::optional<RefinementPredicates> derivePredicatesFromInterpolationReversedPath(storm::dd::Odd const& odd,
211 storm::expressions::ExpressionManager& interpolationManager,
212 std::vector<uint64_t> const& reversedPath,
213 std::vector<uint64_t> const& stateToOffset,
214 std::vector<uint64_t> const& player1Labels) const;
215
216 void performRefinement(std::vector<RefinementCommand> const& refinementCommands, bool allowInjection = true) const;
217
219 std::reference_wrapper<MenuGameAbstractor<Type, ValueType>> abstractor;
220
222 bool useInterpolation;
223
225 bool splitAll;
226
228 bool splitPredicates;
229
231 bool rankPredicates;
232
234 bool addPredicatesEagerly;
235
237 bool addedAllGuardsFlag;
238
241 mutable std::vector<std::vector<storm::expressions::Expression>> refinementPredicatesToInject;
242
244 PivotSelectionHeuristic pivotSelectionHeuristic;
245
248
250 mutable storm::expressions::EquivalenceChecker equivalenceChecker;
251};
252
253} // namespace abstraction
254} // 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:14
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.
MenuGameRefiner(MenuGameAbstractor< Type, ValueType > &abstractor, std::unique_ptr< storm::solver::SmtSolver > &&smtSolver, AbstractionOptions const &options=AbstractionOptions())
Creates a refiner for the provided abstractor.
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:16
A class that holds a possibly non-square matrix in the compressed row storage format.
solver::OptimizationDirection OptimizationDirection
Options that configure the game-based abstraction-refinement procedure.
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.
boost::optional< SymbolicMostProbablePathsResult< Type, ValueType > > symbolicMostProbablePathsResult
SymbolicPivotStateResult(storm::dd::Bdd< Type > const &pivotState, storm::OptimizationDirection fromDirection, boost::optional< SymbolicMostProbablePathsResult< Type, ValueType > > const &symbolicMostProbablePathsResult=boost::none)