21template<
typename ValueType,
typename SolutionType>
26template<
typename ValueType,
typename SolutionType>
31template<
typename ValueType,
typename SolutionType>
33 std::vector<ValueType>
const* b, std::vector<SolutionType>& result,
35 std::vector<uint_fast64_t>* choices)
const {
36 multiplyAndReduce(env, dir, this->
matrix.getRowGroupIndices(), x, b, result, uncertaintyResolutionMode, choices);
39template<
typename ValueType,
typename SolutionType>
41 std::vector<ValueType>
const* b, std::vector<uint_fast64_t>* choices,
42 bool backwards)
const {
46template<
typename ValueType,
typename SolutionType>
52 for (uint64_t i = 0; i < n; ++i) {
56 STORM_LOG_WARN(
"Aborting after " << i <<
" of " << n <<
" multiplications.");
62template<
typename ValueType,
typename SolutionType>
64 std::vector<ValueType>
const* b, uint64_t n,
69 for (uint64_t i = 0; i < n; ++i) {
73 STORM_LOG_WARN(
"Aborting after " << i <<
" of " << n <<
" multiplications");
79template<
typename ValueType,
typename SolutionType>
81 std::vector<SolutionType>& x, std::vector<ValueType>
const* b, uint64_t n,
87 for (uint64_t i = 0; i < n; ++i) {
89 std::transform(x.begin(), x.end(), x.begin(), [factor](SolutionType& c) { return c * factor; });
92 STORM_LOG_WARN(
"Aborting after " << i <<
" of " << n <<
" multiplications");
98template<
typename ValueType,
typename SolutionType>
100 uint64_t n, SolutionType factor)
const {
104 for (uint64_t i = 0; i < n; ++i) {
106 std::transform(x.begin(), x.end(), x.begin(), [factor](SolutionType& c) { return c * factor; });
109 STORM_LOG_WARN(
"Aborting after " << i <<
" of " << n <<
" multiplications");
115template<
typename ValueType,
typename SolutionType>
120 this->
cachedVector = std::make_unique<std::vector<SolutionType>>(size);
125template<
typename ValueType,
typename SolutionType>
131 if (type == MultiplierType::ViOperator &&
133 STORM_LOG_INFO(
"Switching multiplier type from 'vioperator' to 'native' because the given ValueType is not supported by the VI Operator multiplier.");
134 type = MultiplierType::Native;
138 case MultiplierType::ViOperator:
140 throw storm::exceptions::NotImplementedException() <<
"VI Operator multiplier not supported with given value type.";
143 return std::make_unique<ViOperatorMultiplier<ValueType, true, SolutionType>>(
matrix);
145 return std::make_unique<ViOperatorMultiplier<ValueType, false, SolutionType>>(matrix);
147 case MultiplierType::Native:
148 if constexpr (std::is_same_v<ValueType, SolutionType>) {
149 return std::make_unique<NativeMultiplier<ValueType>>(matrix);
151 STORM_LOG_THROW(
false, storm::exceptions::NotImplementedException,
"Native multiplier not implemented for unequal ValueType and SolutionType.");
154 STORM_LOG_THROW(
false, storm::exceptions::IllegalArgumentException,
"Unknown MultiplierType");
SolverEnvironment & solver()
storm::solver::MultiplierType const & getType() const
MultiplierEnvironment & multiplier()
std::unique_ptr< Multiplier< ValueType, SolutionType > > create(Environment const &env, storm::storage::SparseMatrix< ValueType > const &matrix)
Multiplier(storm::storage::SparseMatrix< ValueType > const &matrix)
void repeatedMultiplyWithFactor(Environment const &env, std::vector< SolutionType > &x, std::vector< ValueType > const *b, uint64_t n, SolutionType factor) const
Performs repeated matrix-vector multiplication x' = A*(factor * x) + b.
void multiplyAndReduce(Environment const &env, OptimizationDirection const &dir, std::vector< SolutionType > const &x, std::vector< ValueType > const *b, std::vector< SolutionType > &result, UncertaintyResolutionMode const &uncertaintyResolutionMode=UncertaintyResolutionMode::Unset, 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...
std::unique_ptr< std::vector< SolutionType > > cachedVector
void repeatedMultiply(Environment const &env, std::vector< SolutionType > &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< SolutionType > &x, std::vector< ValueType > const *b, uint64_t n, SolutionType factor, UncertaintyResolutionMode const &uncertaintyResolutionMode=UncertaintyResolutionMode::Unset) const
Performs repeated matrix-vector multiplication x' = A*(factor * x) + b, minimizes/maximizes over the ...
void multiplyAndReduceGaussSeidel(Environment const &env, OptimizationDirection const &dir, std::vector< SolutionType > &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...
std::vector< SolutionType > & provideCachedVector(uint64_t size) const
virtual void clearCache() const
storm::storage::SparseMatrix< ValueType > const & matrix
virtual void multiply(Environment const &env, std::vector< SolutionType > const &x, std::vector< ValueType > const *b, std::vector< SolutionType > &result) const =0
Performs a matrix-vector multiplication x' = A*x + b.
void repeatedMultiplyAndReduce(Environment const &env, OptimizationDirection const &dir, std::vector< SolutionType > &x, std::vector< ValueType > const *b, uint64_t n, UncertaintyResolutionMode const &uncertaintyResolutionMode=UncertaintyResolutionMode::Unset) 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.
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)
UncertaintyResolutionMode
bool isTerminate()
Check whether the program should terminate (due to some abort signal).
constexpr bool IsIntervalType
Helper to check if a type is an interval.