Storm 1.11.1.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
RobustParameterLifter.h
Go to the documentation of this file.
1#pragma once
2
3#include <memory>
4#include <set>
5#include <unordered_map>
6#include <vector>
7
15
16namespace storm {
17
18namespace analysis {
19class Order;
20} // namespace analysis
21
22namespace storage {
23template<typename ParametricType>
24class ParameterRegion;
25} // namespace storage
26
27namespace transformer {
28
39template<typename ParametricType, typename ConstantType>
41 public:
45
53 RobustParameterLifter(storm::storage::SparseMatrix<ParametricType> const& pMatrix, std::vector<ParametricType> const& pVector,
54 storm::storage::BitVector const& selectedRows, storm::storage::BitVector const& selectedColumns, bool generateRowLabels = false,
55 bool useMonotonicity = false);
56
58
66 storm::storage::BitVector const& selectedRows);
67
76 std::shared_ptr<storm::analysis::Order> reachabilityOrder,
77 std::shared_ptr<storm::analysis::LocalMonotonicityResult<VariableType>> localMonotonicityResult);
78
79 // Returns the resulting matrix. Should only be called AFTER specifying a region
81
82 // Returns the resulting vector. Should only be called AFTER specifying a region
83 std::vector<Interval> const& getVector() const;
84
85 std::vector<std::set<VariableType>> const& getOccurringVariablesAtState() const;
86
87 std::map<VariableType, std::set<uint_fast64_t>> const& getOccuringStatesAtVariable() const;
88
89 // Returns whether the curent region is all ill-defined.
91
92 /*
93 * We minimize the number of function evaluations by only calling evaluate() once for each unique pair of function and valuation.
94 * The result of each evaluation is then written to all positions in the matrix (and the vector) where the corresponding (function,valuation) occurred.
95 */
97 public:
100 bool operator==(RobustAbstractValuation const& other) const;
101
102 std::size_t getHashValue() const;
103
104 std::set<VariableType> const& getParameters() const;
105
106 uint64_t getNumTransitions() const;
107
109
110 void initialize();
111
112 std::optional<std::map<VariableType, std::set<CoefficientType>>> const& getExtrema() const;
113
114 std::optional<Annotation> const& getAnnotation() const;
115
116 private:
117 std::set<CoefficientType> cubicEquationZeroes(RawPolynomial polynomial, VariableType parameter);
118
119 std::optional<std::set<CoefficientType>> zeroesSMT(RationalFunction function, VariableType parameter);
120
121 std::optional<std::set<CoefficientType>> zeroesCarl(UniPoly polynomial, VariableType parameter);
122
123 std::set<VariableType> parameters;
124
125 storm::RationalFunction const transition;
126
127 // position and value of the extrema of each of the functions (if computable)
128 std::optional<std::map<VariableType, std::set<CoefficientType>>> extrema;
129
130 // extrema could not be computed => use interval arithmetic
131 std::optional<Annotation> annotation;
132 };
133
134 private:
140 class FunctionValuationCollector {
141 public:
142 FunctionValuationCollector() = default;
143
148 Interval& add(RobustAbstractValuation& valuation);
149
150 bool evaluateCollectedFunctions(storm::storage::ParameterRegion<ParametricType> const& region,
151 storm::solver::OptimizationDirection const& dirForUnspecifiedParameters);
152
153 private:
154 class RobustAbstractValuationHash {
155 public:
156 std::size_t operator()(RobustAbstractValuation const& valuation) const {
157 return valuation.getHashValue();
158 }
159 };
160
161 // Stores the collected functions with the valuations together with a placeholder for the result.
162 std::unordered_map<RobustAbstractValuation, Interval, RobustAbstractValuationHash> collectedValuations;
163 // Stores regions and bounds for abstract evaluations that use them
164 // We store this here because we cannot change the existing robustabstractvaluations in collectedValuations
165 std::unordered_map<RobustAbstractValuation, std::vector<std::pair<Interval, Interval>>, RobustAbstractValuationHash> regionsAndBounds;
166 };
167
168 FunctionValuationCollector functionValuationCollector;
169
170 storm::storage::SparseMatrix<Interval> matrix; // The resulting matrix;
171 std::vector<std::pair<typename storm::storage::SparseMatrix<Interval>::iterator, Interval&>>
172 matrixAssignment; // Connection of matrix entries with placeholders
173
174 std::vector<uint64_t> oldToNewColumnIndexMapping; // Mapping from old to new columnIndex
175 std::vector<uint64_t> oldToNewRowIndexMapping; // Mapping from old to new columnIndex
176 std::vector<uint64_t> rowGroupToStateNumber; // Mapping from new to old columnIndex
177
178 bool currentRegionAllIllDefined = false;
179
180 std::vector<Interval> vector;
181 std::vector<std::pair<typename std::vector<Interval>::iterator, Interval&>> vectorAssignment; // Connection of vector entries with placeholders
182
183 std::vector<std::set<VariableType>> occurringVariablesAtState;
184 std::map<VariableType, std::set<uint_fast64_t>> occuringStatesAtVariable;
185};
186
187} // namespace transformer
188} // namespace storm
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.
RobustAbstractValuation(RobustAbstractValuation const &other)=default
std::optional< std::map< VariableType, std::set< CoefficientType > > > const & getExtrema() const
This class lifts parameter choices to nondeterminism: For each row in the given matrix that considerd...
storm::analysis::MonotonicityResult< VariableType >::Monotonicity Monotonicity
void specifyRegion(storm::storage::ParameterRegion< ParametricType > const &region, storm::solver::OptimizationDirection const &dirForParameters, std::shared_ptr< storm::analysis::Order > reachabilityOrder, std::shared_ptr< storm::analysis::LocalMonotonicityResult< VariableType > > localMonotonicityResult)
Specifies the region for the parameterlifter, the reachability order is used to see if there is local...
storm::storage::SparseMatrix< Interval > const & getMatrix() const
std::map< VariableType, std::set< uint_fast64_t > > const & getOccuringStatesAtVariable() const
std::vector< Interval > const & getVector() const
storm::utility::parametric::CoefficientType< ParametricType >::type CoefficientType
std::vector< std::set< VariableType > > const & getOccurringVariablesAtState() const
void specifyRegion(storm::storage::ParameterRegion< ParametricType > const &region, storm::solver::OptimizationDirection const &dirForParameters)
storm::utility::parametric::VariableType< ParametricType >::type VariableType
void specifyRegion(storm::storage::ParameterRegion< ParametricType > const &region, storm::solver::OptimizationDirection const &dirForParameters, storm::storage::BitVector const &selectedRows)
Specifies the region for the parameterlifter, the Bitvector works as a fixed (partial) scheduler,...
MonotonicityKind
The results of monotonicity checking for a single Parameter Region.
carl::Interval< double > Interval
Interval type.
carl::MultivariatePolynomial< RationalFunctionCoefficient > RawPolynomial