Storm 1.14.0.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
SparseDerivativeInstantiationModelChecker.h
Go to the documentation of this file.
1#pragma once
2
3#include <cstdint>
4#include <map>
14
15namespace storm {
16namespace derivative {
17template<typename FunctionType, typename ConstantType>
19 public:
25 // Intentionally left empty.
26 }
28
38
44 std::unique_ptr<modelchecker::ExplicitQuantitativeCheckResult<ConstantType>> check(
47 boost::optional<std::vector<ConstantType>> const& valueVector = boost::none);
48
49 uint64_t getInitialState() {
50 return initialStateEqSystem;
51 }
52
53 private:
54 // TODO it is not good that this model is not a reference. (but we reduce to state based rewards in this code.)
56 std::unique_ptr<modelchecker::CheckTask<storm::logic::Formula, FunctionType>> currentCheckTask;
57 // store the current formula. Note that currentCheckTask only stores a reference to the formula.
58 std::shared_ptr<storm::logic::Formula const> currentFormula;
59
60 std::set<typename utility::parametric::VariableType<FunctionType>::type> parameters;
61 std::map<typename utility::parametric::VariableType<FunctionType>::type, std::unique_ptr<storm::solver::LinearEquationSolver<ConstantType>>>
62 linearEquationSolvers;
63 std::vector<std::pair<typename storm::storage::SparseMatrix<ConstantType>::iterator, ConstantType*>> matrixMappingUnderived;
64 std::map<typename utility::parametric::VariableType<FunctionType>::type,
65 std::vector<std::pair<typename storm::storage::SparseMatrix<ConstantType>::iterator, ConstantType*>>>
66 matrixMappingsDerived;
67 std::unordered_map<FunctionType, ConstantType> functionsUnderived;
68 std::map<typename utility::parametric::VariableType<FunctionType>::type, std::unordered_map<FunctionType, ConstantType>> functionsDerived;
69 storage::SparseMatrix<FunctionType> constrainedMatrixEquationSystem;
70 storage::SparseMatrix<ConstantType> constrainedMatrixInstantiated;
71 std::unique_ptr<std::map<typename utility::parametric::VariableType<FunctionType>::type, storage::SparseMatrix<FunctionType>>> deltaConstrainedMatrices;
72 std::unique_ptr<std::map<typename utility::parametric::VariableType<FunctionType>::type, storage::SparseMatrix<ConstantType>>>
73 deltaConstrainedMatricesInstantiated;
74 std::unique_ptr<std::map<typename utility::parametric::VariableType<FunctionType>::type, std::vector<FunctionType>>> derivedOutputVecs;
75
76 // next states: states that have a relevant successor
78 uint_fast64_t initialStateEqSystem;
79 uint_fast64_t initialStateModel;
80
81 void initializeInstantiatedMatrix(storage::SparseMatrix<FunctionType>& matrix, storage::SparseMatrix<ConstantType>& matrixInstantiated,
82 std::vector<std::pair<typename storm::storage::SparseMatrix<ConstantType>::iterator, ConstantType*>>& matrixMapping,
83 std::unordered_map<FunctionType, ConstantType>& functions);
84
85 utility::Stopwatch instantiationWatch;
86 utility::Stopwatch approximationWatch;
87 utility::Stopwatch generalSetupWatch;
88};
89
90template<typename ValueType>
92 public:
93 SignedGradientDescentTerminationCondition(uint64_t initialState) : initialState(initialState) {}
94
95 bool terminateNow(std::function<ValueType(uint64_t const&)> const& valueGetter, solver::SolverGuarantee const& guarantee) const {
96 if (guarantee == solver::SolverGuarantee::GreaterOrEqual && valueGetter(initialState) > utility::convertNumber<ValueType>(1e-6)) {
97 return true;
98 }
99 if (guarantee == solver::SolverGuarantee::LessOrEqual && valueGetter(initialState) < utility::convertNumber<ValueType>(-1e-6)) {
100 return true;
101 }
102 return false;
103 }
104 bool requiresGuarantee(solver::SolverGuarantee const& guarantee) const {
106 }
107
108 private:
109 uint64_t initialState;
110};
111} // namespace derivative
112} // namespace storm
bool terminateNow(std::function< ValueType(uint64_t const &)> const &valueGetter, solver::SolverGuarantee const &guarantee) const
bool requiresGuarantee(solver::SolverGuarantee const &guarantee) const
Retrieves whether the termination criterion requires the given guarantee in order to decide terminati...
std::unique_ptr< modelchecker::ExplicitQuantitativeCheckResult< ConstantType > > check(Environment const &env, storm::utility::parametric::Valuation< FunctionType > const &valuation, typename utility::parametric::VariableType< FunctionType >::type const &parameter, boost::optional< std::vector< ConstantType > > const &valueVector=boost::none)
check calculates the deriative of the model w.r.t.
void specifyFormula(Environment const &env, modelchecker::CheckTask< logic::Formula, FunctionType > const &checkTask)
specifyFormula specifies a CheckTask.
SparseDerivativeInstantiationModelChecker(storm::models::sparse::Dtmc< FunctionType > const &model)
Instantiates a new SparseDerivativeInstantiationModelChecker.
This class represents a discrete-time Markov chain.
Definition Dtmc.h:13
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.
std::vector< MatrixEntry< index_type, value_type > >::iterator iterator
A class that provides convenience operations to display run times.
Definition Stopwatch.h:13
std::map< typename VariableType< FunctionType >::type, typename CoefficientType< FunctionType >::type > Valuation
Definition parametric.h:43
TargetType convertNumber(SourceType const &number)