20template<
typename ValueType>
25template<
typename ValueType>
30template<
typename ValueType>
32 std::vector<ValueType>
const* b, std::vector<ValueType>& result, std::vector<uint_fast64_t>* choices)
const {
33 multiplyAndReduce(env, dir, this->matrix.getRowGroupIndices(), x, b, result, choices);
36template<
typename ValueType>
38 std::vector<ValueType>
const* b, std::vector<uint_fast64_t>* choices,
bool backwards)
const {
39 multiplyAndReduceGaussSeidel(env, dir, this->matrix.getRowGroupIndices(), x, b, choices, backwards);
42template<
typename ValueType>
47 for (uint64_t i = 0; i < n; ++i) {
49 multiply(env, x, b, x);
51 STORM_LOG_WARN(
"Aborting after " << i <<
" of " << n <<
" multiplications.");
57template<
typename ValueType>
59 std::vector<ValueType>
const* b, uint64_t n)
const {
63 for (uint64_t i = 0; i < n; ++i) {
65 multiplyAndReduce(env, dir, x, b, x);
67 STORM_LOG_WARN(
"Aborting after " << i <<
" of " << n <<
" multiplications");
73template<
typename ValueType>
75 std::vector<ValueType>
const* b, uint64_t n, ValueType factor)
const {
79 for (uint64_t i = 0; i < n; ++i) {
81 std::transform(x.begin(), x.end(), x.begin(), [factor](ValueType& c) { return c * factor; });
82 multiplyAndReduce(env, dir, x, b, x);
84 STORM_LOG_WARN(
"Aborting after " << i <<
" of " << n <<
" multiplications");
90template<
typename ValueType>
92 ValueType factor)
const {
96 for (uint64_t i = 0; i < n; ++i) {
98 std::transform(x.begin(), x.end(), x.begin(), [factor](ValueType& c) { return c * factor; });
99 multiply(env, x, b, x);
101 STORM_LOG_WARN(
"Aborting after " << i <<
" of " << n <<
" multiplications");
107template<
typename ValueType>
110 if (this->cachedVector) {
111 this->cachedVector->resize(size);
113 this->cachedVector = std::make_unique<std::vector<ValueType>>(size);
115 return *this->cachedVector;
118template<
typename ValueType>
123 if (type == MultiplierType::ViOperator && (std::is_same_v<ValueType, storm::RationalFunction> || std::is_same_v<ValueType, storm::Interval>)) {
124 STORM_LOG_INFO(
"Switching multiplier type from 'vioperator' to 'native' because the given ValueType is not supported by the VI Operator multiplier.");
125 type = MultiplierType::Native;
129 case MultiplierType::ViOperator:
130 if constexpr (std::is_same_v<ValueType, storm::RationalFunction> || std::is_same_v<ValueType, storm::Interval>) {
131 throw storm::exceptions::NotImplementedException() <<
"VI Operator multiplier not supported with given value type.";
134 return std::make_unique<ViOperatorMultiplier<ValueType, true>>(matrix);
136 return std::make_unique<ViOperatorMultiplier<ValueType, false>>(matrix);
138 case MultiplierType::Native:
139 return std::make_unique<NativeMultiplier<ValueType>>(matrix);
141 STORM_LOG_THROW(
false, storm::exceptions::IllegalArgumentException,
"Unknown MultiplierType");
SolverEnvironment & solver()
storm::solver::MultiplierType const & getType() const
MultiplierEnvironment & multiplier()
std::unique_ptr< Multiplier< ValueType > > create(Environment const &env, storm::storage::SparseMatrix< ValueType > const &matrix)
std::vector< ValueType > & provideCachedVector(uint64_t size) const
virtual void clearCache() const
void multiplyAndReduceGaussSeidel(Environment const &env, OptimizationDirection const &dir, std::vector< ValueType > &x, std::vector< ValueType > const *b, std::vector< uint_fast64_t > *choices=nullptr, bool backwards=true) const
Performs a matrix-vector multiplication in gauss-seidel style and then minimizes/maximizes over the r...
void multiplyAndReduce(Environment const &env, OptimizationDirection const &dir, std::vector< ValueType > const &x, std::vector< ValueType > const *b, std::vector< ValueType > &result, std::vector< uint_fast64_t > *choices=nullptr) const
Performs a matrix-vector multiplication x' = A*x + b and then minimizes/maximizes over the row groups...
void repeatedMultiplyWithFactor(Environment const &env, std::vector< ValueType > &x, std::vector< ValueType > const *b, uint64_t n, ValueType factor) const
Performs repeated matrix-vector multiplication x' = A*(factor * x) + b.
void repeatedMultiply(Environment const &env, std::vector< ValueType > &x, std::vector< ValueType > const *b, uint64_t n) const
Performs repeated matrix-vector multiplication, using x[0] = x and x[i + 1] = A*x[i] + b.
void repeatedMultiplyAndReduceWithFactor(Environment const &env, OptimizationDirection const &dir, std::vector< ValueType > &x, std::vector< ValueType > const *b, uint64_t n, ValueType factor) const
Performs repeated matrix-vector multiplication x' = A*(factor * x) + b, minimizes/maximizes over the ...
Multiplier(storm::storage::SparseMatrix< ValueType > const &matrix)
void repeatedMultiplyAndReduce(Environment const &env, OptimizationDirection const &dir, std::vector< ValueType > &x, std::vector< ValueType > const *b, uint64_t n) const
Performs repeated matrix-vector multiplication x' = A*x + b and then minimizes/maximizes over the row...
A class that holds a possibly non-square matrix in the compressed row storage format.
bool hasTrivialRowGrouping() const
Retrieves whether the matrix has a trivial row grouping.
A class that provides convenience operations to display run times.
bool updateProgress(uint64_t count)
Updates the progress to the current count and prints it if the delay passed.
void setMaxCount(uint64_t maxCount)
Sets the maximal possible count.
void startNewMeasurement(uint64_t startCount)
Starts a new measurement, dropping all progress information collected so far.
#define STORM_LOG_INFO(message)
#define STORM_LOG_WARN(message)
#define STORM_LOG_THROW(cond, exception, message)
bool isTerminate()
Check whether the program should terminate (due to some abort signal).