Storm 1.14.0.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
SparseExplorationModelChecker.h
Go to the documentation of this file.
1#pragma once
2
3#include <random>
4
6
8
11
13
14namespace storm {
15
16class Environment;
17
18namespace storage {
20template<typename V>
21class SparseMatrix;
22} // namespace storage
23namespace prism {
24class Program;
25}
26
27namespace modelchecker {
28namespace exploration_detail {
29template<typename StateType, typename ValueType>
30class StateGeneration;
31template<typename StateType, typename ValueType>
33template<typename StateType, typename ValueType>
34class Bounds;
35template<typename StateType, typename ValueType>
36struct Statistics;
37} // namespace exploration_detail
38
39using namespace exploration_detail;
40
41template<typename ModelType, typename StateType = uint32_t>
43 public:
44 typedef typename ModelType::ValueType ValueType;
45 typedef StateType ActionType;
46 typedef std::vector<std::pair<StateType, ActionType>> StateActionStack;
47
49
51
52 virtual bool canHandle(CheckTask<storm::logic::Formula, ValueType> const& checkTask) const override;
53
54 virtual std::unique_ptr<CheckResult> computeUntilProbabilities(Environment const& env,
55 CheckTask<storm::logic::UntilFormula, ValueType> const& checkTask) override;
56
57 private:
58 std::tuple<StateType, ValueType, ValueType> performExploration(StateGeneration<StateType, ValueType>& stateGeneration,
59 ExplorationInformation<StateType, ValueType>& explorationInformation) const;
60
61 bool samplePathFromInitialState(StateGeneration<StateType, ValueType>& stateGeneration,
64
65 bool exploreState(StateGeneration<StateType, ValueType>& stateGeneration, StateType const& currentStateId,
68
69 ActionType sampleActionOfState(StateType const& currentStateId, ExplorationInformation<StateType, ValueType> const& explorationInformation,
70 Bounds<StateType, ValueType>& bounds) const;
71
72 StateType sampleSuccessorFromAction(ActionType const& chosenAction, ExplorationInformation<StateType, ValueType> const& explorationInformation,
73 Bounds<StateType, ValueType> const& bounds) const;
74
75 bool performPrecomputation(StateActionStack const& stack, ExplorationInformation<StateType, ValueType>& explorationInformation,
77
78 void collapseMec(storm::storage::MaximalEndComponent const& mec, std::vector<StateType> const& relevantStates,
79 storm::storage::SparseMatrix<ValueType> const& relevantStatesMatrix, ExplorationInformation<StateType, ValueType>& explorationInformation,
80 Bounds<StateType, ValueType>& bounds) const;
81
82 void updateProbabilityBoundsAlongSampledPath(StateActionStack& stack, ExplorationInformation<StateType, ValueType> const& explorationInformation,
83 Bounds<StateType, ValueType>& bounds) const;
84
85 void updateProbabilityOfAction(StateType const& state, ActionType const& action, ExplorationInformation<StateType, ValueType> const& explorationInformation,
86 Bounds<StateType, ValueType>& bounds) const;
87
88 std::pair<ValueType, ValueType> computeBoundsOfAction(ActionType const& action, ExplorationInformation<StateType, ValueType> const& explorationInformation,
89 Bounds<StateType, ValueType> const& bounds) const;
90 ValueType computeBoundOverAllOtherActions(storm::OptimizationDirection const& direction, StateType const& state, ActionType const& action,
91 ExplorationInformation<StateType, ValueType> const& explorationInformation,
92 Bounds<StateType, ValueType> const& bounds) const;
93 std::pair<ValueType, ValueType> computeBoundsOfState(StateType const& currentStateId,
94 ExplorationInformation<StateType, ValueType> const& explorationInformation,
95 Bounds<StateType, ValueType> const& bounds) const;
96 ValueType computeLowerBoundOfAction(ActionType const& action, ExplorationInformation<StateType, ValueType> const& explorationInformation,
97 Bounds<StateType, ValueType> const& bounds) const;
98 ValueType computeUpperBoundOfAction(ActionType const& action, ExplorationInformation<StateType, ValueType> const& explorationInformation,
99 Bounds<StateType, ValueType> const& bounds) const;
100
101 std::pair<ValueType, ValueType> getLowestBounds(storm::OptimizationDirection const& direction) const;
102 ValueType getLowestBound(storm::OptimizationDirection const& direction) const;
103 std::pair<ValueType, ValueType> combineBounds(storm::OptimizationDirection const& direction, std::pair<ValueType, ValueType> const& bounds1,
104 std::pair<ValueType, ValueType> const& bounds2) const;
105
106 // The program that defines the model to check.
107 storm::prism::Program program;
108
109 // The random number generator.
110 mutable std::default_random_engine randomGenerator;
111
112 // A comparator used to determine whether values are equal.
114};
115} // namespace modelchecker
116} // namespace storm
virtual std::unique_ptr< CheckResult > computeUntilProbabilities(Environment const &env, CheckTask< storm::logic::UntilFormula, ValueType > const &checkTask) override
std::vector< std::pair< StateType, ActionType > > StateActionStack
static bool canHandleStatic(CheckTask< storm::logic::Formula, ValueType > const &checkTask)
SparseExplorationModelChecker(storm::prism::Program const &program)
virtual bool canHandle(CheckTask< storm::logic::Formula, ValueType > const &checkTask) const override
This class represents a maximal end-component of a nondeterministic model.
A class that holds a possibly non-square matrix in the compressed row storage format.
storm::storage::BitVector CompressedState
solver::OptimizationDirection OptimizationDirection