3#include "storm-config.h"
24template<
typename ValueType>
29template<
typename ValueType>
34template<
typename ValueType>
36 std::vector<ValueType>
const* b, std::vector<ValueType>& result, std::vector<uint_fast64_t>* choices)
const {
37 multiplyAndReduce(env, dir, this->matrix.getRowGroupIndices(), x, b, result, choices);
40template<
typename ValueType>
42 std::vector<ValueType>
const* b, std::vector<uint_fast64_t>* choices,
bool backwards)
const {
43 multiplyAndReduceGaussSeidel(env, dir, this->matrix.getRowGroupIndices(), x, b, choices, backwards);
46template<
typename ValueType>
51 for (uint64_t i = 0; i < n; ++i) {
53 multiply(env, x, b, x);
55 STORM_LOG_WARN(
"Aborting after " << i <<
" of " << n <<
" multiplications.");
61template<
typename ValueType>
63 std::vector<ValueType>
const* b, uint64_t n)
const {
67 for (uint64_t i = 0; i < n; ++i) {
68 multiplyAndReduce(env, dir, x, b, x);
70 STORM_LOG_WARN(
"Aborting after " << i <<
" of " << n <<
" multiplications");
76template<
typename ValueType>
79 if (this->cachedVector) {
80 this->cachedVector->resize(size);
82 this->cachedVector = std::make_unique<std::vector<ValueType>>(size);
84 return *this->cachedVector;
87template<
typename ValueType>
92 if (type == MultiplierType::ViOperator && (std::is_same_v<ValueType, storm::RationalFunction> || std::is_same_v<ValueType, storm::Interval>)) {
93 STORM_LOG_INFO(
"Switching multiplier type from 'vioperator' to 'native' because the given ValueType is not supported by the VI Operator multiplier.");
94 type = MultiplierType::Native;
98 case MultiplierType::ViOperator:
99 if constexpr (std::is_same_v<ValueType, storm::RationalFunction> || std::is_same_v<ValueType, storm::Interval>) {
100 throw storm::exceptions::NotImplementedException() <<
"VI Operator multiplier not supported with given value type.";
103 return std::make_unique<ViOperatorMultiplier<ValueType, true>>(matrix);
105 return std::make_unique<ViOperatorMultiplier<ValueType, false>>(matrix);
107 case MultiplierType::Native:
108 return std::make_unique<NativeMultiplier<ValueType>>(matrix);
110 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 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.
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).