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
16
17namespace storm {
18
19namespace analysis {
20class Order;
21} // namespace analysis
22
23namespace storage {
24template<typename ParametricType>
25class ParameterRegion;
26} // namespace storage
27
28namespace transformer {
29
40template<typename ParametricType, typename ConstantType>
42 public:
46
54 RobustParameterLifter(storm::storage::SparseMatrix<ParametricType> const& pMatrix, std::vector<ParametricType> const& pVector,
55 storm::storage::BitVector const& selectedRows, storm::storage::BitVector const& selectedColumns, bool generateRowLabels = false,
56 bool useMonotonicity = false);
57
59
67 storm::storage::BitVector const& selectedRows);
68
77 std::shared_ptr<storm::analysis::Order> reachabilityOrder,
78 std::shared_ptr<storm::analysis::LocalMonotonicityResult<VariableType>> localMonotonicityResult);
79
80 // Returns the resulting matrix. Should only be called AFTER specifying a region
82
83 // Returns the resulting vector. Should only be called AFTER specifying a region
84 std::vector<Interval> const& getVector() const;
85
86 std::vector<std::set<VariableType>> const& getOccurringVariablesAtState() const;
87
88 std::map<VariableType, std::set<uint_fast64_t>> const& getOccuringStatesAtVariable() const;
89
90 // Returns whether the curent region is all ill-defined.
92
93 /*
94 * We minimize the number of function evaluations by only calling evaluate() once for each unique pair of function and valuation.
95 * The result of each evaluation is then written to all positions in the matrix (and the vector) where the corresponding (function,valuation) occurred.
96 */
98 public:
101 bool operator==(RobustAbstractValuation const& other) const;
102
103 std::size_t getHashValue() const;
104
105 std::set<VariableType> const& getParameters() const;
106
107 uint64_t getNumTransitions() const;
108
110
111 void initialize();
112
113 std::optional<std::map<VariableType, std::set<CoefficientType>>> const& getExtrema() const;
114
115 std::optional<Annotation> const& getAnnotation() const;
116
117 private:
118 std::set<CoefficientType> cubicEquationZeroes(RawPolynomial polynomial, VariableType parameter);
119
120 std::optional<std::set<CoefficientType>> zeroesSMT(RationalFunction function, VariableType parameter);
121
122 std::optional<std::set<CoefficientType>> zeroesCarl(UniPoly polynomial, VariableType parameter);
123
124 std::set<VariableType> parameters;
125
126 storm::RationalFunction const transition;
127
128 // position and value of the extrema of each of the functions (if computable)
129 std::optional<std::map<VariableType, std::set<CoefficientType>>> extrema;
130
131 // extrema could not be computed => use interval arithmetic
132 std::optional<Annotation> annotation;
133 };
134
135 private:
141 class FunctionValuationCollector {
142 public:
143 FunctionValuationCollector() = default;
144
149 Interval& add(RobustAbstractValuation& valuation);
150
151 bool evaluateCollectedFunctions(storm::storage::ParameterRegion<ParametricType> const& region,
152 storm::solver::OptimizationDirection const& dirForUnspecifiedParameters);
153
154 private:
155 class RobustAbstractValuationHash {
156 public:
157 std::size_t operator()(RobustAbstractValuation const& valuation) const {
158 return valuation.getHashValue();
159 }
160 };
161
162 // Stores the collected functions with the valuations together with a placeholder for the result.
163 std::unordered_map<RobustAbstractValuation, Interval, RobustAbstractValuationHash> collectedValuations;
164 // Stores regions and bounds for abstract evaluations that use them
165 // We store this here because we cannot change the existing robustabstractvaluations in collectedValuations
166 std::unordered_map<RobustAbstractValuation, std::vector<std::pair<Interval, Interval>>, RobustAbstractValuationHash> regionsAndBounds;
167 };
168
169 FunctionValuationCollector functionValuationCollector;
170
171 storm::storage::SparseMatrix<Interval> matrix; // The resulting matrix;
172 std::vector<std::pair<typename storm::storage::SparseMatrix<Interval>::iterator, Interval&>>
173 matrixAssignment; // Connection of matrix entries with placeholders
174
175 std::vector<uint64_t> oldToNewColumnIndexMapping; // Mapping from old to new columnIndex
176 std::vector<uint64_t> oldToNewRowIndexMapping; // Mapping from old to new columnIndex
177 std::vector<uint64_t> rowGroupToStateNumber; // Mapping from new to old columnIndex
178
179 bool currentRegionAllIllDefined = false;
180
181 std::vector<Interval> vector;
182 std::vector<std::pair<typename std::vector<Interval>::iterator, Interval&>> vectorAssignment; // Connection of vector entries with placeholders
183
184 std::vector<std::set<VariableType>> occurringVariablesAtState;
185 std::map<VariableType, std::set<uint_fast64_t>> occuringStatesAtVariable;
186};
187
188} // namespace transformer
189} // 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.
LabParser.cpp.
carl::Interval< double > Interval
Interval type.
carl::MultivariatePolynomial< RationalFunctionCoefficient > RawPolynomial